From 0c76135994a8fbfaf669c69fbe48da0ce8fd4d35 Mon Sep 17 00:00:00 2001 From: Morgan Humes Date: Tue, 10 Dec 2013 15:59:53 -0600 Subject: [PATCH] [coretasks] Gracefully handle removing user from bot.privileges If a user is not in the dict, a KeyError could occur throwing a nasty error into the room.wq --- willie/coretasks.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/willie/coretasks.py b/willie/coretasks.py index cea91eacc6..6e48f87fa7 100644 --- a/willie/coretasks.py +++ b/willie/coretasks.py @@ -286,7 +286,13 @@ def track_kick(bot, trigger): bot.channels.remove(trigger.sender) del bot.privileges[trigger.sender] else: - del bot.privileges[trigger.sender][nick] + # Temporary fix to stop KeyErrors from being sent to channel + # The privileges dict may not have all nicks stored at all times + # causing KeyErrors + try: + del bot.privileges[trigger.sender][nick] + except KeyError: + pass @willie.module.rule('.*')