Browse Source

Fix crash after #unsubscribe

The #unsubscribe command was setting the person's subscription to None
which obviously can't be compiled to a regex.  This caused a crash on
the first now/next update after someone did #unsubscribe.  Fix this
simply by skipping any subscription where the regex is set to None.

Change-Id: I11d42bcb1a0e3bc2e4105d6c2afa39f3a37af278
changes/70/656970/1
Adam Spiers 2 years ago
parent
commit
0145545e78
  1. 3
      ptgbot/bot.py

3
ptgbot/bot.py

@ -394,6 +394,9 @@ class PTGBot(SASL, SSL, irc.bot.SingleServerIRCBot):
trackloc = "%s (%s)" % (track, location)
for nick, regexp in self.data.get_subscriptions().items():
if regexp is None:
# Person did #unsubscribe, so skip
continue
event_text = " ".join([track, adverb, params])
if re.search(regexp, event_text, re.IGNORECASE):
message = "%s in %s: %s" % (adverb, trackloc, params)

Loading…
Cancel
Save