diff --git a/cogs/fun.py b/cogs/fun.py index 549837f..355622c 100644 --- a/cogs/fun.py +++ b/cogs/fun.py @@ -7,8 +7,8 @@ import discohook import time import aiohttp -@discohook.command.slash('dice', description = 'Roll a dice!') -async def dice_command(interaction): +@discohook.command.slash('dice_old', description = 'Roll a dice!') +async def old_dice_command(interaction): # Dice! number = random.randint(1, 6) text = "You rolled a...\n-# (Wait 1 second)" @@ -87,7 +87,7 @@ async def funfact_cmd(interaction): await interaction.response.send(text) await session.close() -@discohook.command.slash('randomgif', description = 'Get a free cool gif from my gifs.') +@discohook.command.slash('randomgif', description='Get a free cool gif from my gifs.') async def randomgif_cmd(interaction): gifs = ["https://cdn.discordapp.com/attachments/1366521106940559470/1499180770500280320/image0.gif ", "https://cdn.discordapp.com/attachments/1478830458950127797/1499169563064008804/togif.30a22110.gif", @@ -101,4 +101,17 @@ async def randomgif_cmd(interaction): ] await interaction.response.send(random.choice(gifs) + "\n **heres ur tuff gif**") + +@discohook.command.slash('dice', description="roll a dice using Discord's roll a dice system.", options=[ + discohook.Option.integer('dice_num', "The number of dice", required=True, max_value=10, min_value=1), + discohook.Option.integer('dice_sides', "The number of sides on the dice", required=True, choices=[ + discohook.Choice("D6", 6), discohook.Choice("D10", 10), discohook.Choice("D20", 20) + ] + )] +) +async def dice_command(interaction: discohook.Interaction, dice_num, dice_sides): + channel_id = interaction.channel_id + guild_id = interaction.guild_id + link = f"https://discord.com/channels/{guild_id}/{channel_id}/roll-dice/{dice_num}d{dice_sides}" + interaction.response.send(f"Click [here]({link}) to roll.") \ No newline at end of file diff --git a/main.py b/main.py index d3b2563..584c6e0 100644 --- a/main.py +++ b/main.py @@ -8,7 +8,7 @@ import aiohttp import discohook from starlette.responses import JSONResponse from cogs.utils import ping_command, timestamp_command, info_command -from cogs.fun import dice_command, decide_command, rps_command, gtn_command, funfact_cmd, randomgif_cmd +from cogs.fun import dice_command, decide_command, rps_command, gtn_command, funfact_cmd, randomgif_cmd, old_dice_command def run(): @contextlib.asynccontextmanager @@ -52,7 +52,8 @@ def run(): rps_command, gtn_command, funfact_cmd, - randomgif_cmd + randomgif_cmd, + old_dice_command ) return app