Skip to content

Commit

Permalink
actually added roll command
Browse files Browse the repository at this point in the history
  • Loading branch information
Mole1424 committed Feb 6, 2024
1 parent 9dc276b commit e441125
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 1 addition & 2 deletions apollo.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@
"cogs.commands.quotes",
"cogs.commands.rolemenu",
"cogs.commands.reminders",
# TODO: Roll has performance issues with large values, removing till stabilised
# "cogs.commands.roll",
"cogs.commands.roll",
"cogs.commands.run",
"cogs.commands.roomsearch",
"cogs.commands.say",
Expand Down
6 changes: 4 additions & 2 deletions cogs/commands/roll.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def __init__(self, bot: Bot):
async def roll(self, ctx: Context, *, message: clean_content):
display_name = get_name_string(ctx.message)
p = await Parallelism.get(self.bot)
future = p.execute_on_process(run, message, display_name)
future = asyncio.wrap_future(p.execute_on_process(run, message, display_name))

try:
result = await asyncio.wait_for(future, DICE_TIMEOUT)
Expand All @@ -88,7 +88,9 @@ async def roll(self, ctx: Context, *, message: clean_content):
@app_commands.command(name="roll", description=SHORT_HELP_TEXT)
async def roll_slash(self, int: discord.Interaction, dice: str):
p = await Parallelism.get(self.bot)
future = p.execute_on_process(run, dice, int.user.display_name)
future = asyncio.wrap_future(
p.execute_on_process(run, dice, int.user.display_name)
)

try:
result = await asyncio.wait_for(future, DICE_TIMEOUT)
Expand Down

0 comments on commit e441125

Please sign in to comment.