DeepBlue/cogs/fun/coinflip.py

23 lines
683 B
Python
Raw Permalink Normal View History

2020-01-08 02:26:36 +01:00
'''
Flips a coin.
Will probably reworked into a "games" cog to
hold more interactive commands
'''
2020-01-07 02:41:08 +01:00
import discord
import random
from discord.ext import commands
class Coinflip(commands.Cog):
2020-01-08 02:26:36 +01:00
def __init__(self, client: discord.Client):
2020-01-07 02:41:08 +01:00
self.client = client
2020-01-08 21:18:17 +01:00
@commands.command(name="coinflip", description="Flips a coin and reacts with the result", usage="coin", aliases=["coin", "flip"])
2020-01-08 02:26:36 +01:00
async def coinflip(self, ctx: commands.Context):
2020-01-07 02:41:08 +01:00
if random.randint(0, 1) == 0:
await ctx.message.add_reaction("🌑")
else:
await ctx.message.add_reaction("🌕")
2020-01-08 02:26:36 +01:00
def setup(client: discord.Client):
2020-01-07 02:41:08 +01:00
client.add_cog(Coinflip(client))