TwitchIO icon indicating copy to clipboard operation
TwitchIO copied to clipboard

User input is not properly tokenized

Open Vgr255 opened this issue 1 year ago • 1 comments

The ext.commands.stringparser.StringParser.process_string method doesn't properly tokenize input if there is no space before a ". This is due to setting the start of the word after the ", dropping everything before it. As such, something like foo"bar" will be tokenized as ["bar"] -- it should be tokenized as ["foo", "bar"].

I believe the following code will fix this, though I haven't been able to test it yet:

            elif loc == '"':
                if not self.ignore:
                    if self.start != self.count:
                        self.words[self.index] = msg[self.start : self.count]
                        self.index += 1
                    self.start = self.count + 1
                    self.ignore = True

If I get some time this week, I'll attempt to PR this.

Thank you!

Vgr255 avatar Aug 08 '22 23:08 Vgr255

Hello! Thanks for the issue. If this is a general help question, for a faster response consider joining the official Discord Server

Else if you have an issue with the library please wait for someone to help you here.

github-actions[bot] avatar Aug 08 '22 23:08 github-actions[bot]