diff --git a/butterrobot_plugins_contrib/fun.py b/butterrobot_plugins_contrib/fun.py index 8aa0de6..33b69f6 100644 --- a/butterrobot_plugins_contrib/fun.py +++ b/butterrobot_plugins_contrib/fun.py @@ -1,3 +1,5 @@ +import random + import dice from butterrobot.plugins import Plugin @@ -20,4 +22,13 @@ class DicePlugin(Plugin): def on_message(cls, message: Message): if message.text.startswith("!dice"): roll = int(dice.roll(message.text.replace("!dice ", ""))) - yield Message(chat=message.chat, reply_to=message.id, text=roll) \ No newline at end of file + yield Message(chat=message.chat, reply_to=message.id, text=roll) + + +class CoinPlugin(Plugin): + id = "contrib/fun/coin" + + @classmethod + def on_message(cls, message: Message): + if message.text.startswith("!coin"): + yield Message(chat=message.chat, reply_to=message.id, text=random.choice(("heads", "tails"))) diff --git a/pyproject.toml b/pyproject.toml index 3fd04a0..ca320ab 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,8 +30,9 @@ ipdb = "^0.13.2" [tool.poetry.plugins] [tool.poetry.plugins."butterrobot.plugins"] "fun.loquito" = "butterrobot_plugins_contrib.fun:LoquitoPlugin" -"dev.ping" = "butterrobot_plugins_contrib.dev:PingPlugin" "fun.dice" = "butterrobot_plugins_contrib.fun:DicePlugin" +"fun.coin" = "butterrobot_plugins_contrib.fun:CoinPlugin" +"dev.ping" = "butterrobot_plugins_contrib.dev:PingPlugin" [build-system] requires = ["poetry>=0.12"]