parent
3f6ec00ffe
commit
dc941c1985
@ -0,0 +1,31 @@
|
|||||||
|
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
|
@ -1,8 +0,0 @@
|
|||||||
from edmond.plugin import Plugin
|
|
||||||
|
|
||||||
|
|
||||||
class OpinionPlugin(Plugin):
|
|
||||||
|
|
||||||
def __init__(self, bot):
|
|
||||||
super().__init__(bot)
|
|
||||||
|
|
Loading…
Reference in new issue