diff --git a/ext/test.py b/ext/test.py new file mode 100644 index 0000000..58ef5c9 --- /dev/null +++ b/ext/test.py @@ -0,0 +1,23 @@ +# pybot-f test extension ... + +import discord +from discord import app_commands +from discord.ext import commands + +class TestCog(commands.GroupCog, name="testcogparent"): + def __init__(self, bot: commands.Bot) -> None: + self.bot = bot + super().__init__() # this is now required in this context. + + @app_commands.command(name="sub1") + async def my_sub_command_1(self, interaction: discord.Interaction) -> None: + """ /parent sub-1 """ + await interaction.response.send_message("Hello from sub command 1", ephemeral=True) + + @app_commands.command(name="sub2") + async def my_sub_command_2(self, interaction: discord.Interaction) -> None: + """ /parent sub-2 """ + await interaction.response.send_message("Hello from sub command 2", ephemeral=True) + +async def setup(bot: commands.Bot) -> None: + await bot.add_cog(TestCog(bot)) \ No newline at end of file diff --git a/pybot-f.py b/pybot-f.py index cf190e6..5aa019d 100644 --- a/pybot-f.py +++ b/pybot-f.py @@ -37,5 +37,5 @@ async def joined(ctx, member: discord.Member): """Says when a member joined.""" await ctx.send(f'{member.name} joined {discord.utils.format_dt(member.joined_at)}') - -bot.run('OTc5MzU2MjY4NzkzODMxNDI1.GTX-gW.l7Oc7YoVfAQIUBarQ3jXB6upNKYdD0jeCuAGXE') \ No newline at end of file +bot.load_extension("ext/test.py") +bot.run(bottoken) \ No newline at end of file