From 2310ac3e2dacc96401b2da5ee99d038f79b330cb Mon Sep 17 00:00:00 2001 From: Conatum Date: Sun, 27 Aug 2023 09:07:29 +0300 Subject: [PATCH] ux (timers): Respond to presence click. --- src/modules/pomodoro/ui/status.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/modules/pomodoro/ui/status.py b/src/modules/pomodoro/ui/status.py index c9cd7d74..ac8208f4 100644 --- a/src/modules/pomodoro/ui/status.py +++ b/src/modules/pomodoro/ui/status.py @@ -46,10 +46,30 @@ class TimerStatusUI(LeoUI): Does not send a visible response. """ - await press.response.defer() + t = self.bot.translator.t member: discord.Member = press.user if member.voice and member.voice.channel and member.voice.channel.id == self.timer.data.channelid: self.timer.last_seen[member.id] = utc_now() + response = discord.Embed( + colour=discord.Colour.brand_green(), + description=t(_p( + 'ui:timer_status|button:present|ack', + "Thank you for marking your presence.\n" + "Good luck and stay productive!" + )) + ) + await press.response.send_message(embed=response, ephemeral=True) + await self.timer.update_status_card() + else: + response = discord.Embed( + colour=discord.Colour.brand_red(), + description=t(_p( + 'ui:timer_status|button:present|error:not_in_timer', + "You are not in this timer! " + "Join the timer channel by pressing {channel}." + )).format(channel=self.timer.channel.mention if self.timer.channel else "**ERROR**") + ) + await press.response.send_message(embed=response, ephemeral=True) async def refresh_present_button(self): t = self.bot.translator.t