From 367d12578ce29049ec33a05d1fde28e3eadadef2 Mon Sep 17 00:00:00 2001 From: Marc Di Luzio Date: Sun, 22 Sep 2024 15:14:19 +0100 Subject: [PATCH 1/9] Add a thread message with suggestions --- matchy/cogs/matcher.py | 5 ++++- matchy/cogs/strings.py | 27 +++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/matchy/cogs/matcher.py b/matchy/cogs/matcher.py index aa911c4..f5ff5f1 100644 --- a/matchy/cogs/matcher.py +++ b/matchy/cogs/matcher.py @@ -272,11 +272,14 @@ async def match_groups_in_channel(channel: discord.channel, min: int): strings.matched_up([m.mention for m in group])) # Set up a thread for this match if the bot has permissions to do so if channel.permissions_for(channel.guild.me).create_public_threads: - await channel.create_thread( + thread = await channel.create_thread( name=strings.thread_title([m.display_name for m in group]), message=message, reason="Creating a matching thread") + # Send a message with a suggested time to the channel + await thread.send(f"{strings.thread_message()} {strings.time_suggestion()}") + # Close off with a message await channel.send(strings.matching_done()) # Save the groups to the history diff --git a/matchy/cogs/strings.py b/matchy/cogs/strings.py index a617194..042322a 100644 --- a/matchy/cogs/strings.py +++ b/matchy/cogs/strings.py @@ -174,6 +174,33 @@ def matched_up(ms): return [ ] +@randomised +def thread_message(): return [ + "Hey peeps :)", + "How is everyone?", + "Bork!", + "Hey kiddos :)", + "Ahoy!", + "Great to see y'all here.", + "Icebreaker! What's your favourite pokemon?", + "I'm hungry, would a lasagna count as a sandwich?", + "What's your favourite keyboard key?", + "I'm confused thinking... Is a train just a sideways elevator?", + "Humans are weird, why do you have moustaches above your eyes?" +] + + +@randomised +def time_suggestion(): return [ + "Can I suggest a quick call on Wednesday?", + "Remember to organise a chat if you're up for it!", + "How about throwing something in the calendar for Friday?", + "Would 10am on Thursday work for people?", + "How about a call this afternoon?", + "Would a chat the start of a weekday work?" +] + + @randomised def thread_title(ms): return [ f"{format_list(ms)}", From 455f202364036be03b104955cde479282e991f31 Mon Sep 17 00:00:00 2001 From: Marc Di Luzio Date: Sun, 22 Sep 2024 15:47:28 +0100 Subject: [PATCH 2/9] Add placeholder code for getting previous runs --- matchy/cogs/matcher.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/matchy/cogs/matcher.py b/matchy/cogs/matcher.py index aa911c4..4a4e15d 100644 --- a/matchy/cogs/matcher.py +++ b/matchy/cogs/matcher.py @@ -210,15 +210,23 @@ class MatcherCog(commands.Cog): async def run_hourly_tasks(self): """Run any hourly tasks we have""" + # Send a reminder for anything that will be active in 1 day + for (channel, _) in state.State.get_active_match_tasks(datetime.now() + timedelta(days=1)): + logger.info("Reminding about scheduled task in %s", channel) + msg_channel = self.bot.get_channel(int(channel)) + await msg_channel.send(strings.reminder()) + + # Match groups for anything active right now for (channel, min) in state.State.get_active_match_tasks(): logger.info("Scheduled match task triggered in %s", channel) msg_channel = self.bot.get_channel(int(channel)) await match_groups_in_channel(msg_channel, min) - for (channel, _) in state.State.get_active_match_tasks(datetime.now() + timedelta(days=1)): - logger.info("Reminding about scheduled task in %s", channel) + # Send a reminder to threads for a match that happened two days ago + for (channel, min) in state.State.get_active_match_tasks(datetime.now() - timedelta(days=2)): + logger.info("Sending reminders to threads in %s", channel) msg_channel = self.bot.get_channel(int(channel)) - await msg_channel.send(strings.reminder()) + # TODO: Send a reminder per thread # Increment when adjusting the custom_id so we don't confuse old users From f7898892e6f59a183465db41956948333923119d Mon Sep 17 00:00:00 2001 From: Marc Di Luzio Date: Sun, 22 Sep 2024 16:30:49 +0100 Subject: [PATCH 3/9] Send a reminder to innactive threads This sends a reminder message to any thread with 1 or less messages This picks up only active threads too --- matchy/cogs/matcher.py | 9 +++++++-- matchy/cogs/strings.py | 10 ++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/matchy/cogs/matcher.py b/matchy/cogs/matcher.py index 4a4e15d..f62ee6a 100644 --- a/matchy/cogs/matcher.py +++ b/matchy/cogs/matcher.py @@ -223,10 +223,15 @@ class MatcherCog(commands.Cog): await match_groups_in_channel(msg_channel, min) # Send a reminder to threads for a match that happened two days ago - for (channel, min) in state.State.get_active_match_tasks(datetime.now() - timedelta(days=2)): + for (channel, _) in state.State.get_active_match_tasks(datetime.now() - timedelta(days=2)): logger.info("Sending reminders to threads in %s", channel) msg_channel = self.bot.get_channel(int(channel)) - # TODO: Send a reminder per thread + # Find any threads that need + for thread in msg_channel.threads: + # Only regard threads the bot created + # And that have no additional messages + if thread.owner.id == self.bot.user.id and thread.message_count <= 1: + await thread.send(strings.thread_reminder()) # Increment when adjusting the custom_id so we don't confuse old users diff --git a/matchy/cogs/strings.py b/matchy/cogs/strings.py index a617194..c31ae06 100644 --- a/matchy/cogs/strings.py +++ b/matchy/cogs/strings.py @@ -145,6 +145,16 @@ Make sure you're /pause'd if you need to be, or /join in ASAP!""", ] +@randomised +def thread_reminder(): return [ + "Hey friends, just checking in! No worries if you're too busy this week", + "Bork bork, quick reminder in case y'all forgot!", + "Hey matchees, how's your week going?", + "Hey everyone, don't forget to check in with eachother!", + "Quick friendly nudge, how're you all doing?", +] + + @randomised def matching(): return [ "Matchy is matching matchees...", From 10e3dd3b36579665f07846e708ab2f00cacfa0d0 Mon Sep 17 00:00:00 2001 From: mdiluz Date: Tue, 24 Sep 2024 11:31:37 +0100 Subject: [PATCH 4/9] Add more random suggestion options --- matchy/cogs/strings.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/matchy/cogs/strings.py b/matchy/cogs/strings.py index 042322a..80da0cb 100644 --- a/matchy/cogs/strings.py +++ b/matchy/cogs/strings.py @@ -197,7 +197,10 @@ def time_suggestion(): return [ "How about throwing something in the calendar for Friday?", "Would 10am on Thursday work for people?", "How about a call this afternoon?", - "Would a chat the start of a weekday work?" + "Would a chat the start of a weekday work?", + "How's about organising a quick call sometime this week?", + "When's everyone available for a short hangout?", + "It's best to pick a time to drop in a call or meet up, if everyone is up for it!", ] From 77d533fbcb340ccccc4d9c7a346fec847a68a8bc Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Wed, 9 Oct 2024 12:00:08 +0000 Subject: [PATCH 5/9] Update dependency coverage to v7.6.2 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index fdcdbe6..e920edd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -coverage==7.6.1 +coverage==7.6.2 discord.py==2.4.0 dpytest==0.7.0 flake8==7.1.1 From fb4647c4e05d8820230a27e66cd564f1ac3cb655 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sun, 13 Oct 2024 23:00:08 +0000 Subject: [PATCH 6/9] Update dependency coverage to v7.6.3 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index e920edd..de53231 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -coverage==7.6.2 +coverage==7.6.3 discord.py==2.4.0 dpytest==0.7.0 flake8==7.1.1 From e8f5350b8e497c08507c7746e09a9d0552e0c5bd Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Thu, 26 Dec 2024 17:00:08 +0000 Subject: [PATCH 7/9] Update dependency coverage to v7.6.10 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index de53231..9d49ee1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -coverage==7.6.3 +coverage==7.6.10 discord.py==2.4.0 dpytest==0.7.0 flake8==7.1.1 From 84f18bceecd9a21c7184e99f27316f38553ccdc8 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Thu, 2 Jan 2025 06:00:08 +0000 Subject: [PATCH 8/9] Update dependency pytest-asyncio to v0.25.1 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index de53231..8ade5c0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,6 +3,6 @@ discord.py==2.4.0 dpytest==0.7.0 flake8==7.1.1 pytest==8.3.3 -pytest-asyncio==0.24.0 +pytest-asyncio==0.25.1 pytest-cov==5.0.0 schema==0.7.7 \ No newline at end of file From c8bfa837aad4dd59747c0f3fee9cfdbe128f91f1 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Wed, 8 Jan 2025 07:00:08 +0000 Subject: [PATCH 9/9] Update dependency pytest-asyncio to v0.25.2 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index fa2e8d1..99d752f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,6 +3,6 @@ discord.py==2.4.0 dpytest==0.7.0 flake8==7.1.1 pytest==8.3.3 -pytest-asyncio==0.25.1 +pytest-asyncio==0.25.2 pytest-cov==5.0.0 schema==0.7.7 \ No newline at end of file