mirror of
https://code.lenaisten.de/Lenaisten/lenaverse-bot.git
synced 2024-11-22 06:53:00 +00:00
"lsstuff" app command
This commit is contained in:
parent
20da5bd078
commit
8a328270cd
2 changed files with 18 additions and 2 deletions
|
@ -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()
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue