Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions techsupport_bot/commands/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import discord
import ui
from core import auxiliary, cogs
from discord import app_commands
from discord.ext import commands

if TYPE_CHECKING:
Expand All @@ -35,8 +36,43 @@ async def setup(bot: bot.TechSupportBot) -> None:
class ExtensionControl(cogs.BaseCog):
"""
The class that holds the extension commands

Attrs:
extension_app_command_group (app_commands.Group): The group for the /extension commands
"""

extension_app_command_group = app_commands.Group(
name="extension", description="...", extras={"module": "extension"}
)

@extension_app_command_group.command(
name="list_disabled",
description="Lists all disabled extensions in the current server",
extras={"module": "extension"},
)
async def list_disabled(self: Self, interaction: discord.Interaction) -> None:
"""This will read the current guild config and list all the
extensions that are currently disabled

Args:
interaction (discord.Interaction): The interaction that triggered the slash command
"""
config = self.bot.guild_configs[str(interaction.guild.id)]
missing_extensions = [
item
for item in self.bot.extension_name_list
if item not in config.enabled_extensions
]
if len(missing_extensions) == 0:
embed = auxiliary.prepare_confirm_embed(
message="No currently loaded extensions are disabled"
)
else:
embed = auxiliary.prepare_confirm_embed(
message=f"Disabled extensions: {missing_extensions}"
)
await interaction.response.send_message(embed=embed)

@commands.check(auxiliary.bot_admin_check_context)
@commands.group(
name="extension",
Expand Down