28 lines
727 B
Python
28 lines
727 B
Python
import discord
|
|
import random
|
|
from discord.ext import commands
|
|
from discord import app_commands
|
|
|
|
class flip(commands.Cog):
|
|
def __init__(self, bot):
|
|
self.bot = bot
|
|
|
|
@commands.Cog.listener()
|
|
async def on_ready(self):
|
|
print("Flip Online")
|
|
|
|
@app_commands.command(name="flip", description="Flip a coin")
|
|
async def flip(self, interaction: discord.Interaction):
|
|
num = [
|
|
'1',
|
|
'2'
|
|
]
|
|
flip_num = random.choice(num)
|
|
if flip_num == '1':
|
|
await interaction.response.send_message("Heads!!")
|
|
elif flip_num == "2":
|
|
await interaction.response.send_message("Tails!!")
|
|
|
|
|
|
async def setup(bot):
|
|
await bot.add_cog(flip(bot)) |