-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: fill ctx.match
and add ctx.commandMatch
#57
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think, we should add fuzz tests
src/command.ts
Outdated
const commands = ctx.msg.text.split(prefix).map((text) => ({ text })); | ||
|
||
for (const { text } of commands) { | ||
const [command, username] = text.split("@"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's not good. for example /send_email user@mail
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This made me completely rewrite the command matching logic lol
But it works now, plus I've added tests for the new findMatchingCommand
method, including one with a @
in the command.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's good! Thank you!
I don't really have the time for that right now, but I'd gladly review a new PQ :) |
ctx.match
ctx.commandMatch
Example usage:
Closes #58