From 47708cf998102d77388940bdfbf5d6eb7cc19838 Mon Sep 17 00:00:00 2001 From: gpkvt Date: Fri, 12 Aug 2022 10:10:40 +0200 Subject: [PATCH] Leave function early when command was processed --- tts.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/tts.py b/tts.py index ab02cfc..7744a12 100644 --- a/tts.py +++ b/tts.py @@ -150,6 +150,8 @@ class IRC: logging.debug('Msg:') logging.debug(msg) logging.debug('Msg length: '+str(msglen)) + logging.debug('Deny List:') + logging.debug(self.tts_denied) if 'broadcaster' in badges or 'moderator' in badges: if msg.startswith('!dtts'): @@ -166,6 +168,8 @@ class IRC: logging.info("Removing "+str(user)+" from allowed list") self.tts_allowed.remove(user) + return True + if msg.startswith('!ptts'): logging.debug("!ptts command detected") user = msg.replace('!ptts', '').strip().lower() @@ -181,20 +185,24 @@ class IRC: logging.info("Removing "+str(user)+" from deny list") self.tts_denied.remove(user) - logging.debug('Deny List:') - logging.debug(self.tts_denied) + return True if msg.startswith('!toff'): logging.info('TTS is now turned off') msg_queue.clear() msg_queue_raw.clear() self.tts_status = False + + return True + if msg.startswith('!ton'): logging.info('TTS is now turned on') msg_queue.clear() msg_queue_raw.clear() self.tts_status = True + return True + if msg.startswith('!tts'): logging.debug('!tts command detected') @@ -247,7 +255,9 @@ class IRC: msg = {"TTS": tts, "msg": msg, "badges": badges, "subscriber": subscriber, "msgid": msgid, "user": user, "length": msglen, "queuetime": now, "timestamp": str(time.time_ns())} msg_queue_raw.append(msg) - return resp + return True + + return False class HTTPserv(BaseHTTPRequestHandler): def log_message(self, format, *args):