cleartonic / twitchtriviabot

Twitch Trivia Bot
MIT License
23 stars 13 forks source link

Checking score crashes bot #21

Open digital420 opened 10 months ago

digital420 commented 10 months ago

Users pass the command !score in chat, and the bot crashes.

This happens on 2.2.0 and current version

Stack trace QSettings::value: Empty key passed QSettings::value: Empty key passed Traceback (most recent call last): File "/twitchbot/twitchtriviabot.py", line 343, in toggle_connect self.connect() File "/twitchbot/twitchtriviabot.py", line 387, in connect self.tb.main_loop(command_line_mode = False) File "/home/digital/Downloads/twitchbot/twitchtriviabot.py", line 713, in main_loop self.handle_triviabot_message(username, clean_message) File "/twitchbot/twitchtriviabot.py", line 617, in handle_triviabot_message func(username) File "/twitchbot/twitchtriviabot.py", line 627, in check_active_session_score user = self.active_session.check_user(username) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NullSession' object has no attribute 'check_user' Aborted (core dumped)

digital420 commented 10 months ago

This is caused by the files being emptied. Maybe a try statement and if files are empty return no scores available instead of crashing. After I was able to successfully answer a question the !score command functioned.

Once a person has registered a score all other users are ignored when using the !score command until they register a point. I think this may lead to user confusion and might be better handled with a no score found please play the game respond or something similar.

digital420 commented 10 months ago

!score - Reports user’s score (reports session score, total score for all trivia, and total wins for all trivia)

This does not seem to be the case either as it only reports last game score. Sorry to hit ya up with a few different bugs in this one.