This repository has been archived on 2022-07-14. You can view files and clone it, but cannot push or open issues or pull requests.
sh_gismo/src/modules/base/service/help_command_service.py

41 lines
1.6 KiB
Python

from cpl_core.configuration import ConfigurationABC
from cpl_core.logging import LoggerABC
from discord.ext import commands
from discord.ext.commands import Context
from gismo_core.abc.bot_service_abc import BotServiceABC
from gismo_core.abc.client_utils_service_abc import ClientUtilsServiceABC
from gismo_core.abc.command_abc import CommandABC
from gismo_core.abc.message_service_abc import MessageServiceABC
from modules.base.base_settings import BaseSettings
class HelpCommandService(CommandABC):
def __init__(
self,
config: ConfigurationABC,
logger: LoggerABC,
message_service: MessageServiceABC,
bot: BotServiceABC,
client_utils: ClientUtilsServiceABC
):
CommandABC.__init__(self)
self._config = config
self._logger = logger
self._message_service = message_service
self._bot = bot
self._client_utils = client_utils
self._logger.trace(__name__, f'Loaded command service: {type(self).__name__}')
@commands.command()
async def help(self, ctx: Context, persistent_flag: str = None):
self._logger.debug(__name__, f'Received command ping {ctx}:{persistent_flag}')
self._client_utils.received_command(ctx.guild.id)
settings: BaseSettings = self._config.get_configuration(f'Base_{ctx.guild.id}')
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 ping command')