Edm0nd/edmond/plugins/mood.py

32 lines
722 B
Python
Raw Normal View History

2020-10-09 12:19:58 +02:00
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