diff --git a/src/modules/pomodoro/options.py b/src/modules/pomodoro/options.py index 5428d97a..5ed209a1 100644 --- a/src/modules/pomodoro/options.py +++ b/src/modules/pomodoro/options.py @@ -38,6 +38,7 @@ class TimerOptions(SettingGroup): _model = TimerData.Timer _column = TimerData.Timer.channelid.name + _allow_object = False @TimerConfig.register_model_setting class NotificationChannel(ModelData, ChannelSetting): @@ -51,6 +52,7 @@ class TimerOptions(SettingGroup): _model = TimerData.Timer _column = TimerData.Timer.notification_channelid.name + _allow_object = False @classmethod async def _check_value(cls, parent_id: int, value: Optional[discord.abc.GuildChannel], **kwargs): @@ -120,6 +122,7 @@ class TimerOptions(SettingGroup): _model = TimerData.Timer _column = TimerData.Timer.manager_roleid.name + _allow_object = False @classmethod def _format_data(cls, parent_id, data, timer=None, **kwargs): diff --git a/src/modules/pomodoro/timer.py b/src/modules/pomodoro/timer.py index e76a40e2..479f3edf 100644 --- a/src/modules/pomodoro/timer.py +++ b/src/modules/pomodoro/timer.py @@ -406,7 +406,7 @@ class Timer: "Remember to press {tick} to register your presence every stage.", len(needs_kick) ), locale=self.locale.value).format( - channel=self.channel.mention, + channel=f"<#{self.data.channelid}>", mentions=', '.join(member.mention for member in needs_kick), tick=self.bot.config.emojis.tick ) @@ -439,7 +439,7 @@ class Timer: if not stage: return - if not self.channel.permissions_for(self.guild.me).speak: + if not self.channel or not self.channel.permissions_for(self.guild.me).speak: return async with self.lguild.voice_lock: @@ -501,7 +501,7 @@ class Timer: "{channel} is now on **BREAK**! Take a rest, **FOCUS** starts {timestamp}" ) stageline = t(lazy_stageline).format( - channel=self.channel.mention, + channel=f"<#{self.data.channelid}>", timestamp=f"" ) return stageline @@ -550,12 +550,12 @@ class Timer: content = t(_p( 'timer|status|stopped:auto', "Timer stopped! Join {channel} to start the timer." - )).format(channel=self.channel.mention) + )).format(channel=f"<#{self.data.channelid}>") else: content = t(_p( 'timer|status|stopped:manual', "Timer stopped! Press `Start` to restart the timer." - )).format(channel=self.channel.mention) + )).format(channel=f"<#{self.data.channelid}>") card = await get_timer_card(self.bot, self, stage) await card.render()