23 lines
569 B
Python
23 lines
569 B
Python
|
import random
|
||
|
|
||
|
from edmond.plugin import Plugin
|
||
|
|
||
|
|
||
|
class BeersPlugin(Plugin):
|
||
|
|
||
|
REQUIRED_CONFIGS = ["commands", "beers", "opening_text"]
|
||
|
|
||
|
def __init__(self, bot):
|
||
|
super().__init__(bot)
|
||
|
|
||
|
def on_pubmsg(self, event):
|
||
|
if not self.should_handle_command(event.arguments[0]):
|
||
|
return False
|
||
|
beer = random.choice(self.config["beers"])
|
||
|
opening_text = self.config["opening_text"].format(
|
||
|
beer=beer,
|
||
|
target=event.source.nick
|
||
|
)
|
||
|
self.bot.say(event.target, opening_text)
|
||
|
return True
|