-
Notifications
You must be signed in to change notification settings - Fork 92
Open
Description
Currently Twitch handles repeating commands like this:
- "down" = "down"
- "down" = "down [?]" (adds (?) after command, since it thinks it's spam)
- "down" = "down
- "down" = "down [?]"
to omit this I changed the code in TwitchPlays_TEMPLATE.py (line 62) so the msg variable works anyways:
def handle_message(message):
try:
msg = message['message'].lower()
chat_cmd = msg.split(" ")
if len(chat_cmd) > 1 and isinstance(chat_cmd[1], str) and len(chat_cmd[1]) > 1 and chat_cmd[1] not in ['right', 'up']:
print('ignore sentence')
else:
msg = chat_cmd[0]
Logic is:
if the command has multiple parts like "down [?]", split the string at the space and if the second part has only 1 character (like a "?") set msg = the first part before the space, so it counts as a valid command.
Additionally check if the second part after the space is longer than 1 character (could be a sentence in chat starting with a command word) ignore that by keeping the msg as is.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels