Moved help message from private to team chat

This commit is contained in:
Sven Heidemann 2023-10-03 09:46:14 +02:00
parent aba6e48e2b
commit dd86c3a657

View File

@ -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")