2022-11-11 21:45:54 +01:00
|
|
|
# administration.py by freaky (freaky@freakyonline.de)
|
|
|
|
# ---
|
|
|
|
#
|
|
|
|
# This extension is for administrating the bot.
|
|
|
|
|
|
|
|
import discord
|
|
|
|
from discord import app_commands
|
|
|
|
from discord.ext import commands
|
|
|
|
|
|
|
|
class AdminExt(commands.GroupCog, name="admin"):
|
|
|
|
def __init__(self, bot: commands.Bot) -> None:
|
|
|
|
self.bot = bot
|
|
|
|
super().__init__() # this is now required in this context.
|
|
|
|
|
2022-11-12 16:26:18 +01:00
|
|
|
@app_commands.command(name="stop", description="Stops (shuts down) the bot")
|
2022-11-11 22:42:06 +01:00
|
|
|
@commands.is_owner()
|
2022-11-11 21:45:54 +01:00
|
|
|
async def admin_stop(self, interaction: discord.Interaction) -> None:
|
|
|
|
""" /admin stop """
|
|
|
|
await interaction.response.send_message("The bot will now shutdown. Good bye! :)", ephemeral=True)
|
2022-11-11 22:39:08 +01:00
|
|
|
await self.bot.close()
|
2022-11-11 21:45:54 +01:00
|
|
|
|
|
|
|
|
|
|
|
async def setup(bot: commands.Bot) -> None:
|
2022-11-12 16:26:18 +01:00
|
|
|
await bot.add_cog(AdminExt(bot))
|