Strip @ from usernames for black/whitelist

This commit is contained in:
gpkvt 2022-08-11 09:46:07 +02:00
parent aa0ff1a129
commit b27b51b52f
2 changed files with 9 additions and 1 deletions

BIN
dist/tts.exe vendored

Binary file not shown.

10
tts.py
View File

@ -31,7 +31,7 @@ class IRC:
try:
self.irc.connect((server, port))
except ConnectionResetError:
logging.fatal('Twitch refused to connect, please check your settings and try again (or just try again, as Twitch sometimes refuses to connect for no reason).')
logging.fatal('Twitch refused to connect, please check your settings and try again.')
sys.exit(252)
self.irc.settimeout(1)
@ -125,6 +125,10 @@ class IRC:
if msg.startswith('!dtts'):
logging.debug("!dtts command detected")
user = msg.replace('!dtts', '').strip()
if user.startswith('@'):
logging.debug('Removing "@" from username')
user = user.replace('@', '')
if user not in self.tts_denied:
logging.info("Adding "+str(user)+" to deny list")
self.tts_denied.append(user)
@ -136,6 +140,10 @@ class IRC:
logging.debug("!ptts command detected")
user = msg.replace('!ptts', '').strip()
if user.startswith('@'):
logging.debug('Removing "@" from username')
user = user.replace('@', '')
self.tts_allowed.append(user)
if user in self.tts_denied: