forked from sh-edraft.de/sh_discord_bot
Fixed stats group #46
This commit is contained in:
parent
a29e33a3f9
commit
82365a24ba
@ -84,17 +84,22 @@ class StatsGroup(DiscordCommandABC):
|
|||||||
descriptions += f'\n{statistic.description}'
|
descriptions += f'\n{statistic.description}'
|
||||||
|
|
||||||
embed.add_field(name=self._t.transform('modules.stats.list.statistic'), value=statistics, inline=True)
|
embed.add_field(name=self._t.transform('modules.stats.list.statistic'), value=statistics, inline=True)
|
||||||
embed.add_field(name=self._t.transform('modules.stats.list.description'), value=statistics, inline=True)
|
embed.add_field(name=self._t.transform('modules.stats.list.description'), value=descriptions, inline=True)
|
||||||
await self._message_service.send_ctx_msg(ctx, embed, wait_before_delete=wait)
|
await self._message_service.send_ctx_msg(ctx, embed, wait_before_delete=wait)
|
||||||
self._logger.trace(__name__, f'Finished command stats list')
|
self._logger.trace(__name__, f'Finished command stats list')
|
||||||
|
|
||||||
@stats.command()
|
@stats.command()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
async def view(self, ctx: Context, name: str, wait: int = None):
|
async def view(self, ctx: Context, name: str, wait: int = None):
|
||||||
self._logger.debug(__name__, f'Received command stats {ctx}:{name}')
|
self._logger.debug(__name__, f'Received command stats view {ctx}:{name}')
|
||||||
if not await self._client_utils.check_if_bot_is_ready_yet_and_respond(ctx):
|
if not await self._client_utils.check_if_bot_is_ready_yet_and_respond(ctx):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if not self._permissions.is_member_moderator(ctx.author):
|
||||||
|
await self._message_service.send_ctx_msg(ctx, self._t.transform('common.no_permission_message'))
|
||||||
|
self._logger.trace(__name__, f'Finished command stats view')
|
||||||
|
return
|
||||||
|
|
||||||
if ctx.guild is None:
|
if ctx.guild is None:
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -122,7 +127,7 @@ class StatsGroup(DiscordCommandABC):
|
|||||||
self._logger.error(__name__, f'Cannot view statistic {name}', e)
|
self._logger.error(__name__, f'Cannot view statistic {name}', e)
|
||||||
await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.stats.view.failed'))
|
await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.stats.view.failed'))
|
||||||
|
|
||||||
self._logger.trace(__name__, f'Finished stats command')
|
self._logger.trace(__name__, f'Finished stats view command')
|
||||||
|
|
||||||
@view.autocomplete('name')
|
@view.autocomplete('name')
|
||||||
async def view_autocomplete(self, interaction: discord.Interaction, current: str) -> TList[app_commands.Choice[str]]:
|
async def view_autocomplete(self, interaction: discord.Interaction, current: str) -> TList[app_commands.Choice[str]]:
|
||||||
|
Loading…
Reference in New Issue
Block a user