From dd86c3a6578438c8358958ecef3cbb72ae03d590 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Tue, 3 Oct 2023 09:46:14 +0200 Subject: [PATCH] Moved help message from private to team chat --- ...n_voice_state_update_event_help_channel.py | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/kdb-bot/src/modules/base/events/base_on_voice_state_update_event_help_channel.py b/kdb-bot/src/modules/base/events/base_on_voice_state_update_event_help_channel.py index 5bcd1f95..3e1b3da0 100644 --- a/kdb-bot/src/modules/base/events/base_on_voice_state_update_event_help_channel.py +++ b/kdb-bot/src/modules/base/events/base_on_voice_state_update_event_help_channel.py @@ -31,6 +31,17 @@ class BaseOnVoiceStateUpdateEventHelpChannel(OnVoiceStateUpdateABC): self._logger.info(__name__, f"Module {type(self)} loaded") + async def _notify_team(self, member: discord.Member): + self._logger.debug(__name__, f"Notify team that a member needs help") + settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{member.guild.id}") + channel = member.guild.get_channel(settings.team_channel_id) + await self._message_service.send_channel_message( + channel, + self._t.transform("modules.base.member_joined_help_voice_channel").format(member.mention), + is_persistent=True, + ) + self._logger.trace(__name__, f"Notified team that a member need help") + @EventChecks.check_is_ready() async def on_voice_state_update( self, @@ -44,14 +55,6 @@ class BaseOnVoiceStateUpdateEventHelpChannel(OnVoiceStateUpdateABC): if after.channel is None or after.channel.id != settings.help_voice_channel_id: return - mods = [ - *self._permissions.get_admins(member.guild.id), - *self._permissions.get_moderators(member.guild.id), - ] - for a in mods: - await self._message_service.send_dm_message( - self._t.transform("modules.base.member_joined_help_voice_channel").format(member.mention), - a, - ) + await self._notify_team(member) self._logger.debug(__name__, f"Module {type(self)} stopped")