Skip to content

Allow same user to send multiple same commands #5

@DominicZ8

Description

@DominicZ8

Currently Twitch handles repeating commands like this:

  1. "down" = "down"
  2. "down" = "down [?]" (adds (?) after command, since it thinks it's spam)
  3. "down" = "down
  4. "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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions