From e40f8a3655c63460629580c2bc6dbcc7b8d67d76 Mon Sep 17 00:00:00 2001 From: gpkvt Date: Thu, 11 Aug 2022 20:04:01 +0200 Subject: [PATCH] Always convert usernames to lowercase --- README.md | 5 ++++- tts.py | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 90f4a78..dc0a21e 100644 --- a/README.md +++ b/README.md @@ -85,6 +85,8 @@ whitelist: Use this section to define key:value pairs of usernames. The first value is the Twitch username, the second value is how the bot should pronouce the user, when reading the message. This is helpfull if you have regulars with numbers or strangs chars in the name. You can add new/change entries on the fly without restarting the bot (changes took up to 60 seconds). +Please note: The key (real username) MUST be lowercase. + ### whitelist You can add a whitelist section to `config.yml`, a whitelist will override any other settings like `subonly` and `modonly`. Only users on the whitelist are allowed to use `!tts`. Broadcasters and mods can temporarily add users (including themselfs) to the whitelist by using the `!ptts` command, though. @@ -100,6 +102,8 @@ whitelist: To disable the whitelist remove it from `config.yml` completely. If you just leave `whitelist:` without entries, everyone must be whitelisted using `!ptts`. The permit is temporarily until the bot restarts or the user is removed from the (temporary) whitelist using `!dtts`. +Please note: Usernames MUST be lowercase. + ## Usage Execute `tts.exe` (or `tts.py` if you have Python installed), open the TTS webpage in your browser (the URL depends on your `bind` and `port` configuration, usually it's just http://localhost). Click the `Init` button at the button of the TTS webpage (you should hear `Init complete`). @@ -110,6 +114,5 @@ Additional commands (broadcaster and mods only) are: * `!toff`: Turn TTS off (will also empty the current TTS queue) * `!ton`: Turn TTS back on - * `!dtts `: Disable TTS for the given user * `!ptts `: Allow TTS for the given user diff --git a/tts.py b/tts.py index 60ccc66..adc9a15 100644 --- a/tts.py +++ b/tts.py @@ -109,7 +109,7 @@ class IRC: msgid = tag.rsplit('id=',1)[1] logging.debug('Message ID: '+str(msgid)) if tag.startswith('display-name='): - user = tag.rsplit('display-name=',1)[1] + user = tag.rsplit('display-name=',1)[1].lower() logging.debug('Username: '+str(user)) msg = resp.rsplit('PRIVMSG #',1)[1] @@ -124,7 +124,7 @@ class IRC: if 'broadcaster' in badges or 'moderator' in badges: if msg.startswith('!dtts'): logging.debug("!dtts command detected") - user = msg.replace('!dtts', '').strip() + user = msg.replace('!dtts', '').strip().lower() if user not in self.tts_denied: logging.info("Adding "+str(user)+" to deny list") self.tts_denied.append(user) @@ -134,7 +134,7 @@ class IRC: if msg.startswith('!ptts'): logging.debug("!ptts command detected") - user = msg.replace('!ptts', '').strip() + user = msg.replace('!ptts', '').strip().lower() self.tts_allowed.append(user)