mirror of https://gitlab.com/gpvkt/twitchtts.git
Bugfix: delete msg from queue, error in whitelist config
This commit is contained in:
parent
3eacc1a5d6
commit
976086f00a
22
tts.py
22
tts.py
|
@ -21,7 +21,7 @@ class IRC:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.irc = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
self.irc = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
self.tts_denied = []
|
self.tts_denied = []
|
||||||
if conf['WHITELIST_USER']:
|
if 'WHITELIST_USER' in conf:
|
||||||
self.tts_allowed = conf['WHITELIST_USER']
|
self.tts_allowed = conf['WHITELIST_USER']
|
||||||
else:
|
else:
|
||||||
self.tts_allowed = []
|
self.tts_allowed = []
|
||||||
|
@ -69,20 +69,24 @@ class IRC:
|
||||||
logging.info('CLEARMSG received')
|
logging.info('CLEARMSG received')
|
||||||
msgid = False
|
msgid = False
|
||||||
|
|
||||||
|
global msg_queue_raw
|
||||||
|
filtered_msg_queue = []
|
||||||
|
|
||||||
tags = resp.split(';')
|
tags = resp.split(';')
|
||||||
for tag in tags:
|
for tag in tags:
|
||||||
if "target-msg-id=" in tag:
|
if "target-msg-id=" in tag:
|
||||||
msgid = tag.rsplit('target-msg-id=',1)[1]
|
msgid = tag.rsplit('target-msg-id=',1)[1]
|
||||||
logging.debug('Trying to suppress message')
|
logging.debug('Trying to suppress message')
|
||||||
logging.debug(msg)
|
logging.debug(msgid)
|
||||||
for key in list(msg_queue_raw.keys()):
|
|
||||||
logging.debug('key:')
|
for msg in list(msg_queue_raw):
|
||||||
logging.debug(key)
|
pprint(msg)
|
||||||
logging.debug('msg_queue_raw:')
|
if msg['msgid'] == msgid:
|
||||||
logging.debug(msg_queue_raw)
|
|
||||||
if msg_queue_raw[key]['msgid'] == msg['msgid']:
|
|
||||||
logging.info('Suppressing message '+str(msgid))
|
logging.info('Suppressing message '+str(msgid))
|
||||||
del msg_queue_raw[key]
|
else:
|
||||||
|
filtered_msg_queue.append(msg)
|
||||||
|
|
||||||
|
msg_queue_raw = filtered_msg_queue
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue