3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 09:19:23 +01:00

fantasy: don't error when bots are removed while processing (e.g. on shutdown)

This commit is contained in:
James Lu 2016-09-06 18:06:29 -07:00
parent e2747839d1
commit aacc3149ce

View File

@ -22,7 +22,9 @@ def handle_fantasy(irc, source, command, args):
# 3) The message starts with one of our fantasy prefixes. # 3) The message starts with one of our fantasy prefixes.
# 4) The sender is NOT a PyLink client (this prevents infinite # 4) The sender is NOT a PyLink client (this prevents infinite
# message loops). # message loops).
for botname, sbot in world.services.items(): for botname, sbot in world.services.copy().items():
if botname not in world.services: # Bot was removed during iteration
continue
log.debug('(%s) fantasy: checking bot %s', irc.name, botname) log.debug('(%s) fantasy: checking bot %s', irc.name, botname)
servuid = sbot.uids.get(irc.name) servuid = sbot.uids.get(irc.name)
if servuid in irc.channels[channel].users: if servuid in irc.channels[channel].users: