Comments (7)
I have thought about using something like https://crates.io/crates/unicase which would handle case insensitivity
from twilight.
Would it only have to be case insensitive for ASCII characters?
I ask because str::eq_ignore_ascii_case
only works for ASCII characters and the other possible ways I can think of implementing this require extra String
allocations due to the possibility of Unicode characters changing length.
from twilight.
Ah yes, that should work. Thanks!
from twilight.
Actually it may be harder than that, at least with the way the parser is currently structured. As you can not use UniCase
in .start_with
which may be an issue if we supports non separated commands.
Non seperated commands also gives the other issue that it may not always give the same result, but I will have to look a bit more into that and open a new issue.
from twilight.
Yeah I hit that part last night.
I was able to make it work on the assumption that the length would be the same so that a command like !weiß
would able to match on !WEISS
as ß
and SS
are both two bytes. However characters like ff
wont match on FF
.
I played around with a few of these characters but I can't really figure out a way to make them work.
For future reference, the Unicode website has a text file called SpecialCasing.txt with characters that go from one to many characters when upper cased.
from twilight.
Also with that assumption you are going to run into problems with Greek small sigma, as you don't know if is the end of the word, but if we go with the fix in #81 for #80 it should be possible to do with unicase.
from twilight.
Sigma is one of the cases where the assumption would actually work as all three variants are 2 bytes long.
Regarding fix #81, wouldn't using trim_start_matches
allow the command to be repeated (e.g. the command "echo" would match "echoecho") and in that case would unicase work?
from twilight.
Related Issues (20)
- Failed event deserialization: image hash isn't in a discord image hash format
- String option trims prefixed zeros of integer input
- Lavalink v4 update will break twilight-lavalink HOT 3
- Better discoverability of the book
- `UpdateFollowup` falsely returns `EmptyBody` HOT 1
- Invalid UpdateRolePositions body
- Expose HeaderMap in addition to HeaderIter for twilight-http responses HOT 9
- Unable to deserialize gateway ready event due to missing fields HOT 15
- [RFC] Flatten `PartialX` Types with `X`
- Support Media Channels
- Deserialization errors for members with joined_at=null HOT 1
- `Message.referenced_message` field doesn't exist or is `null` ambiguous
- Creating a ban does not delete any messages
- Investigate static HTTP form boundary
- Formatter macros HOT 10
- Editing a guild member (changing voice-channel) hangs indefinitely HOT 6
- Error message is unhelpful, and this doesn't require an error HOT 1
- Make `ListBody<T>` lazily deserializable HOT 4
- GuildCreate does not have guild_scheduled_event
- Allow setting an initial resume_url on the Shard
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from twilight.