User name auto complete on certain commands #32
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe the pull request
Certain commands in the Twitch chat require a user name to be entered
after the command. This PR enforces the auto completion to only
suggest user names and not to suggest any of the available emotes for
the user when providing the first argument.
This feature will work for the following commands at this moment of
writing.
/ban
/block
/mod
/purge
/timeout
/unban
/unblock
/unmod
/untimeout
/unvip
/user
/vip
/w
Why
This prevents the user from entering an emote instead a username when
for example trying to ban someone.
How
Whenever the 'tab' key is pressed it checks if the one of the previous mentioned commands is typed in, next it checks if the word the user currently is typing is the first argument after the command. If this first argument check was not in place the user would not be able to auto complete any available emote.
The commands which are processed like this are described in the Commands.ts found in the constants folder. In the command description it states if a username is an argument or not.