Updated .gitignore last time

Added guilds command

BEWARE: All administration.py commands are runnable by ALL Guild Admins so don't put the bot in any additional guilds. I first have to fix this by only making it possible on a specific guild.
This commit is contained in:
Uwe Pfeifer 2024-06-18 13:55:05 +02:00
parent 36acc3f863
commit 2d307c6598
3 changed files with 14 additions and 4 deletions

View file

@ -15,7 +15,7 @@ class AdminExt(commands.GroupCog, name="admin"):
self.bot = bot
super().__init__() # this is now required in this context.
@app_commands.default_permissions()
@app_commands.command(name="stop", description="Stops (shuts down) the bot")
@commands.is_owner()
async def admin_stop(self, interaction: discord.Interaction) -> None:
@ -23,7 +23,7 @@ class AdminExt(commands.GroupCog, name="admin"):
await interaction.response.send_message("The bot will now shutdown. Good bye! :)")
await self.bot.close()
@app_commands.default_permissions()
@app_commands.command(name="say", description="Makes the bot repeat what you type")
@app_commands.describe(text="Text to send to the channel/query.")
@commands.is_owner()
@ -31,6 +31,16 @@ class AdminExt(commands.GroupCog, name="admin"):
""" /admin say <text> """
await interaction.response.send_message(text)
@app_commands.default_permissions()
@app_commands.command(name="guilds", description="List guilds the bot is in")
@commands.is_owner()
async def admin_guilds(self, interaction: discord.Interaction) -> None:
"""/admin guilds"""
guilds = [guild async for guild in self.bot.fetch_guilds(limit=150)]
for guild in guilds:
guild = ''.join(str(guild))
await interaction.response.send_message(guild, ephemeral=True)
async def setup(bot: commands.Bot) -> None:
await bot.add_cog(AdminExt(bot))