#393 #399

Merged
edraft merged 5 commits from #393 into dev 2023-10-03 10:53:36 +02:00
Showing only changes of commit dd86c3a657 - Show all commits

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