Improved handling of invalid messages

This commit is contained in:
gpkvt 2022-10-20 02:42:51 +02:00
parent b36279aae0
commit 479078444a
3 changed files with 18 additions and 5 deletions

View File

@ -2,6 +2,12 @@
All notable changes to this project will be documented in this file. If there is a `Changed` section please read carefully, as this often means that you will need to adapt your `config.yml`.
## [1.7.3] - 2022-10-20
### Fixed 1.7.3
* Crash when message has no/invalid metadata
## [1.7.2] - 2022-10-17
### Fixed 1.7.2

BIN
tts.exe

Binary file not shown.

9
tts.py
View File

@ -171,6 +171,8 @@ class IRC:
logging.debug('PRIVMSG received')
tags = self.__get_tags(resp)
if not tags:
return False
message = self.__get_message(resp)
self.__priviledged_commands(message, tags)
@ -185,6 +187,7 @@ class IRC:
"""
tags = resp.split(';')
for tag in tags:
if tag.startswith('badges='):
badges = tag.rsplit('badges=',1)[1]
@ -199,10 +202,14 @@ class IRC:
logging.debug('Username: %s', user)
tags = {}
try:
tags['badges'] = badges
tags['subscriber'] = subscriber
tags['msgid'] = msgid
tags['user'] = user
except: # pylint: disable=bare-except
logging.error('Received an invalid message')
return False
return tags
@ -1610,7 +1617,7 @@ if __name__ == "__main__":
sys.tracebacklimit = 3
VERSION = "1.7.2"
VERSION = "1.7.3"
CONF = {}
tts_done = []
MSG_QUEUE_RAW = []