You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
722 B

import random
from enum import Enum
from edmond.plugin import Plugin
class Mood(Enum):
CALM = 0
PISSED = 1
class MoodPlugin(Plugin):
QUESTIONS = ["how are you?"]
def __init__(self, bot):
super().__init__(bot)
def on_welcome(self, event):
mood = random.choice(list(Mood))
self.set_runtime_value("mood", mood)
def on_pubmsg(self, event):
if not self.should_answer_question(event.arguments[0]):
return False
mood = self.get_runtime_value("mood")
if mood == Mood.CALM:
self.bot.say(event.target, "I'm calm.")
elif mood == Mood.PISSED:
self.bot.say(event.target, "I'm pissed off.")
return True