feat (timer): Add configured opt-out role.

This commit is contained in:
2024-09-01 23:41:07 +10:00
parent 49c2c4c3bd
commit 7069c87e8e

View File

@@ -195,7 +195,8 @@ class Timer:
Uses voice channel member cache as source-of-truth. Uses voice channel member cache as source-of-truth.
""" """
if (chan := self.channel): if (chan := self.channel):
members = [m for m in chan.members if not m.bot] optout_role = self.guild.get_role(self.bot.config.cafe.getint('optoutrole'))
members = [m for m in chan.members if not m.bot and (optout_role not in m.roles)]
else: else:
members = [] members = []
return members return members
@@ -437,7 +438,7 @@ class Timer:
) )
tasks.append(asyncio.create_task(notify_hook.send(kick_message), name='kick-message')) tasks.append(asyncio.create_task(notify_hook.send(kick_message), name='kick-message'))
if self.voice_alerts: if self.voice_alerts and self.members:
after_tasks.append(asyncio.create_task(self._voice_alert(to_stage), name='voice-alert')) after_tasks.append(asyncio.create_task(self._voice_alert(to_stage), name='voice-alert'))
for task in tasks: for task in tasks: