matrix-rssbot/commands/coin.py
Kumi 1dc0378853
Create a bot class
Make everything compatible with that
2023-04-25 11:25:53 +00:00

13 lines
No EOL
400 B
Python

from nio.events.room_events import RoomMessageText
from nio.rooms import MatrixRoom
from random import SystemRandom
async def command_coin(room: MatrixRoom, event: RoomMessageText, bot):
bot.logger.log("Flipping a coin...")
heads = SystemRandom().choice([True, False])
body = "Flipping a coin... It's " + ("heads!" if heads else "tails!")
await bot.send_message(room, body, True)