Merge pull request 'Fixed afk command' (#465) from staging into master
All checks were successful
Deploy prod on push / pre-build (push) Successful in 1s
Deploy prod on push / build-bot (push) Successful in 1m56s
Deploy prod on push / build-web (push) Successful in 1m52s
Deploy prod on push / deploy (push) Successful in 23s

Reviewed-on: #465
This commit is contained in:
Sven Heidemann 2024-01-13 15:17:01 +01:00
commit baf7b8d7de

View File

@ -50,7 +50,10 @@ class AFKCommand(DiscordCommandABC):
self._logger.debug(__name__, f"Received command afk {ctx}") self._logger.debug(__name__, f"Received command afk {ctx}")
settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{ctx.guild.id}") settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{ctx.guild.id}")
if ctx.author.voice is None or ctx.author.voice.channel is None: if member is None:
member = ctx.author
if member.voice is None or member.voice.channel is None:
await self._message_service.send_ctx_msg( await self._message_service.send_ctx_msg(
ctx, ctx,
self._t.transform("modules.base.afk_command_channel_missing_message"), self._t.transform("modules.base.afk_command_channel_missing_message"),
@ -63,10 +66,7 @@ class AFKCommand(DiscordCommandABC):
) )
channel: VoiceChannel = ctx.guild.get_channel(settings.afk_command_channel_id) channel: VoiceChannel = ctx.guild.get_channel(settings.afk_command_channel_id)
try: try:
if member is not None: await member.move_to(channel)
await member.move_to(channel)
else:
await ctx.author.move_to(channel)
self._client_utils.moved_user(ctx.guild.id) self._client_utils.moved_user(ctx.guild.id)
except Exception as e: except Exception as e:
self._logger.error( self._logger.error(