From 6f7e7ce7b04a6709a3696164cdfbe2a010652e2e Mon Sep 17 00:00:00 2001 From: Uwe Pfeifer Date: Thu, 26 May 2022 15:56:36 +0200 Subject: [PATCH] reset bot token, testing ext functionality. --- ext/test.py | 23 +++++++++++++++++++++++ pybot-f.py | 4 ++-- 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 ext/test.py 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