Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow same user to send multiple same commands #5

Open
DominicZ8 opened this issue Sep 23, 2023 · 4 comments
Open

Allow same user to send multiple same commands #5

DominicZ8 opened this issue Sep 23, 2023 · 4 comments

Comments

@DominicZ8
Copy link

DominicZ8 commented Sep 23, 2023

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.

@jooapa
Copy link

jooapa commented Feb 1, 2024

I dont think he's gonna see this
Doug_Thanos_(cropped)-1

@Gammer0909
Copy link

Honestly, I'd just create a PR and move on. He stated on the livestream where explained all of these he wouldn't be taking PRs, but it doesn't hurt to submit one anyway. Furthermore, if you haven't already, you can fork the repo and push this code to your fork.

@Gammer0909
Copy link

Oops, I forgot
LGTM 👍

@CutestNekoAqua
Copy link

Honestly, I'd just create a PR and move on. He stated on the livestream where explained all of these he wouldn't be taking PRs, but it doesn't hurt to submit one anyway. Furthermore, if you haven't already, you can fork the repo and push this code to your fork.

same philosophy here. altho he seems to skim over PRs from time to time, merging the ones that look genuine and closing ones that look like jokes.

Source

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants