You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 21, 2025. It is now read-only.
However, this creates an issue if the content was intended to have multiple spaces somewhere. The proposition in this issue is to be able to parse a space-separated string as a single token if it is wrapped with " (quotes).
This makes the send command like the following, so we don't have any issues if the content has multiple spaces.
$send #<channel-name> "content"
An additional proposition is to also be able to parse a JSON if present, discussion regarding this is welcome in the comments.
The text was updated successfully, but these errors were encountered:
After updating the tokenization, does it need to accept the old send command also? Or only the new one which guarantees content inside double quotes?
Also is it okay if the content includes the double quotes and we handle the double quotes in the send.ts handler?
Yes, we need to accept both formats
so $send #123 content more content would pass 4 arguments (#123, content, more, content) while $send #123 content "more content" would pass 3 arguments (#123, content, more content)
Also is it okay if the content includes the double quotes and we handle the double quotes in the send.ts handler?
We would ideally want to do all arg parsing in the message create method itself, so that command.handler(message, ...args); is passed the right number of args
For parsing the message, the discord bot splits the message by spaces and identifies each item as a token, as shown below.
discord-bot/src/events/messageCreate.ts
Line 8 in 6df5dab
This can cause issues in commands like
$send
, which has the following syntax.In the current code, every token after the second argument is joined with " " (spaces) to create the
content
, as shown below.https://github.com/dyte-in/discord-bot/blob/main/src/commands/handlers/send.ts#L38
However, this creates an issue if the content was intended to have multiple spaces somewhere. The proposition in this issue is to be able to parse a space-separated string as a single token if it is wrapped with
"
(quotes).This makes the send command like the following, so we don't have any issues if the content has multiple spaces.
An additional proposition is to also be able to parse a JSON if present, discussion regarding this is welcome in the comments.
The text was updated successfully, but these errors were encountered: