Improved some commands #54

This commit is contained in:
Sven Heidemann 2022-10-04 13:23:15 +02:00
parent 97e4f8ec29
commit a23815998c
4 changed files with 11 additions and 2 deletions

View File

@ -11,7 +11,6 @@ from modules.base.command.afk_command import AFKCommand
from modules.base.command.help_command import HelpCommand
from modules.base.command.info_command import InfoCommand
from modules.base.command.ping_command import PingCommand
from modules.base.command.user_info_command import UserInfoCommand
from modules.base.events.base_on_command_error_event import BaseOnCommandErrorEvent
from modules.base.events.base_on_command_event import BaseOnCommandEvent
from modules.base.events.base_on_member_join_event import BaseOnMemberJoinEvent
@ -36,7 +35,6 @@ class BaseModule(ModuleABC):
self._dc.add_command(HelpCommand)
self._dc.add_command(InfoCommand)
self._dc.add_command(PingCommand)
self._dc.add_command(UserInfoCommand)
# events
self._dc.add_event(DiscordEventTypesEnum.on_command.value, BaseOnCommandEvent)
self._dc.add_event(DiscordEventTypesEnum.on_command_error.value, BaseOnCommandErrorEvent)

View File

@ -1,6 +1,10 @@
from typing import List
import discord
from cpl_core.configuration import ConfigurationABC
from cpl_discord.command import DiscordCommandABC
from cpl_discord.service import DiscordBotServiceABC
from discord import app_commands
from discord.ext import commands
from discord.ext.commands import Context
@ -41,3 +45,8 @@ class HelpCommand(DiscordCommandABC):
is_persistent = persistent_flag == '--stay'
await self._message_service.send_ctx_msg(ctx, settings.help_command_reference_url, is_persistent=is_persistent)
self._logger.trace(__name__, f'Finished help command')
@help.autocomplete('persistent_flag')
async def help_autocomplete(self, interaction: discord.Interaction, current: str) -> List[app_commands.Choice[str]]:
flags = ['--stay']
return [app_commands.Choice(name=key, value=key) for key in flags]

View File

@ -6,6 +6,7 @@ from cpl_discord.service.discord_collection_abc import DiscordCollectionABC
from bot_core.abc.module_abc import ModuleABC
from bot_core.configuration.feature_flags_enum import FeatureFlagsEnum
from modules.moderator.command.purge_command import PurgeCommand
from modules.moderator.command.user_info_command import UserInfoCommand
class ModeratorModule(ModuleABC):
@ -19,4 +20,5 @@ class ModeratorModule(ModuleABC):
def configure_services(self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC):
# commands
self._dc.add_command(PurgeCommand)
self._dc.add_command(UserInfoCommand)
# events