This commit is contained in:
Nikolaj
2024-10-30 15:31:46 +01:00
parent e955ef4e28
commit 2f4e606fbf
9 changed files with 1032 additions and 3 deletions

View File

@ -2,12 +2,18 @@ import datetime # Used in hello_func
from interactions import SlashContext, Embed, SlashCommand
from .name_generator import NameGenerator
from .roll import DieRoller
def gen_help_text(commands: list[SlashCommand]):
return '\n'.join([f"`/{i.name}`\t{i.description}" for i in commands])
class Other():
def __init__(self, bot):
self.bot = bot
self._name_generator = NameGenerator()
self._roller = DieRoller()
# Responds with a greeting of a time-appropriate maner
async def hello_func(self, ctx: SlashContext):
@ -48,3 +54,12 @@ class Other():
except:
await ctx.send(f"Could not find a help file for the command '/{command}'")
async def generate_name(self, ctx: SlashContext):
await ctx.send(self._name_generator.generate())
async def roll_dice(self, ctx: SlashContext, dice: str):
try:
roll = self._roller.roll(dice)
await ctx.send(f":game_die:Rolling dice `{dice}`\n{roll}")
except:
await ctx.send("There was an error in the rolling")