diff --git a/lenaverse_bot/core/bot.py b/lenaverse_bot/core/bot.py index a373773..cf163c0 100644 --- a/lenaverse_bot/core/bot.py +++ b/lenaverse_bot/core/bot.py @@ -2,7 +2,7 @@ import logging import discord -from .commands import post +from .commands import lsstuff, post _logger = logging.getLogger(__name__) @@ -16,6 +16,7 @@ class LenaverseBot(discord.Client): self.tree = discord.app_commands.CommandTree(self) self.tree.add_command(post) + self.tree.add_command(lsstuff) async def setup_hook(self): await self.tree.sync() diff --git a/lenaverse_bot/core/commands.py b/lenaverse_bot/core/commands.py index f5b588a..bde9a45 100644 --- a/lenaverse_bot/core/commands.py +++ b/lenaverse_bot/core/commands.py @@ -37,9 +37,24 @@ class PostModal(ui.Modal, title="foobar2000"): await view.wait() if view.value: - await interaction.user.send(f"Confirmed '{self.content.value}'") + await interaction.user.send(self.content.value) @discord.app_commands.command() async def post(interaction: discord.Interaction): await interaction.response.send_modal(PostModal()) + + +@discord.app_commands.command() +async def lsstuff(interaction: discord.Interaction): + msg = "" + for guild in interaction.client.guilds: + msg += f"\n- {guild.name}" + for channel in guild.channels: + msg += f"\n - {channel.name}" + + if isinstance(channel, discord.ForumChannel | discord.TextChannel): + for thread in channel.threads: + msg += f"\n - {thread.name}" + + await interaction.response.send_message(msg, ephemeral=True)