butterrobot/butterrobot_plugins_contrib/fun.py

23 lines
648 B
Python
Raw Normal View History

2020-09-17 18:16:42 +00:00
import dice
2020-04-22 21:58:06 +00:00
from butterrobot.plugins import Plugin
from butterrobot.objects import Message
class LoquitoPlugin(Plugin):
id = "contrib/fun/loquito"
@classmethod
2020-10-28 10:19:30 +00:00
def on_message(cls, message):
2020-04-22 21:58:06 +00:00
if "lo quito" in message.text.lower():
2020-09-17 14:09:31 +00:00
yield Message(chat=message.chat, reply_to=message.id, text="Loquito tu.",)
2020-09-17 18:16:42 +00:00
class DicePlugin(Plugin):
id = "contrib/fun/dice"
@classmethod
2020-10-28 10:19:30 +00:00
def on_message(cls, message: Message):
2020-09-17 18:16:42 +00:00
if message.text.startswith("!dice"):
roll = int(dice.roll(message.text.replace("!dice ", "")))
yield Message(chat=message.chat, reply_to=message.id, text=roll)