Leave function early when command was processed

This commit is contained in:
gpkvt 2022-08-12 10:10:40 +02:00
parent d37363be45
commit 34437a0ccb
1 changed files with 13 additions and 3 deletions

16
tts.py
View File

@ -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):