Skip to content
Snippets Groups Projects
Commit fe97115b authored by Bruce Cowan's avatar Bruce Cowan
Browse files

Fix plugin

It turns out that callback_mention doesn't work for the bot itself, so use
callback_message, and now self.bot_identifier is an object with a long IRC
identifier, so have to get it to be sane string.
parent 96784a43
No related branches found
No related tags found
No related merge requests found
......@@ -28,14 +28,14 @@ class Justforfun(BotPlugin):
self.bad = re.compile(r'\b(silly|bad)\b', re.IGNORECASE)
self.congrats = re.compile(r'\bcongrat(s|ulations)\b', re.IGNORECASE)
def callback_mention(self, message, mentioned_people):
def callback_message(self, message):
""" Listens for rude or nice things about the bot """
if self.bot_identifier not in mentioned_people:
if str(self.bot_identifier).split('!')[0] not in message.body:
return
if self.good.search(message.body):
self.send(message.to, "you're welcome", message)
self.send(message.to, "you're welcome", message, True)
if self.bad.search(message.body):
self.send(message.to, "sorry", message)
self.send(message.to, "sorry", message, True)
if self.congrats.search(message.body):
self.send(message.to, "thank you", message)
self.send(message.to, "thank you", message, True)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment