Skip to content

Commit dfdc0e7

Browse files
committed
feat: CV2
1 parent 021a7bd commit dfdc0e7

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

cogs/modmail.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2415,7 +2415,7 @@ async def cog_load(self):
24152415
async def snooze_auto_unsnooze_task(self):
24162416
await self.bot.wait_until_ready()
24172417
while True:
2418-
now = datetime.utcnow()
2418+
now = datetime.now(timezone.utc)
24192419
snoozed = await self.bot.api.logs.find({"snoozed": True}).to_list(None)
24202420
for entry in snoozed:
24212421
start = entry.get("snooze_start")

core/paginator.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,7 @@ def __init__(self, handler: PaginatorSession, *args, **kwargs):
223223
self.clear_items() # clear first so we can control the order
224224
self.fill_items()
225225

226-
@discord.ui.button(label="Stop", style=ButtonStyle.danger)
227-
async def stop_button(self, interaction: Interaction, button: Button):
226+
async def stop_callback(self, interaction: Interaction):
228227
await self.handler.close(interaction=interaction)
229228

230229
def fill_items(self):
@@ -244,7 +243,10 @@ def fill_items(self):
244243

245244
self.handler._buttons_map[label] = button
246245
self.add_item(button)
247-
self.add_item(self.stop_button)
246+
247+
stop_button = Button(label="Stop", style=ButtonStyle.danger)
248+
stop_button.callback = self.stop_callback
249+
self.add_item(stop_button)
248250

249251
async def interaction_check(self, interaction: Interaction):
250252
"""Only allow the message author to interact"""

core/thread.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1694,8 +1694,10 @@ async def create(
16941694
else:
16951695
destination = message.channel
16961696
view = ConfirmThreadCreationView()
1697-
view.add_item(AcceptButton(self.bot.config["confirm_thread_creation_accept"]))
1698-
view.add_item(DenyButton(self.bot.config["confirm_thread_creation_deny"]))
1697+
view.add_item(
1698+
AcceptButton("accept-thread-creation", self.bot.config["confirm_thread_creation_accept"])
1699+
)
1700+
view.add_item(DenyButton("deny-thread-creation", self.bot.config["confirm_thread_creation_deny"]))
16991701
confirm = await destination.send(
17001702
embed=discord.Embed(
17011703
title=self.bot.config["confirm_thread_creation_title"],

core/utils.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -581,8 +581,9 @@ def return_or_truncate(text, max_length):
581581

582582

583583
class AcceptButton(discord.ui.Button):
584-
def __init__(self, emoji):
585-
super().__init__(style=discord.ButtonStyle.gray, emoji=emoji)
584+
def __init__(self, custom_id: str, emoji: str):
585+
super().__init__(style=discord.ButtonStyle.gray, emoji=emoji, custom_id=custom_id)
586+
self.view: ConfirmThreadCreationView
586587

587588
async def callback(self, interaction: discord.Interaction):
588589
self.view.value = True
@@ -591,8 +592,9 @@ async def callback(self, interaction: discord.Interaction):
591592

592593

593594
class DenyButton(discord.ui.Button):
594-
def __init__(self, emoji):
595-
super().__init__(style=discord.ButtonStyle.gray, emoji=emoji)
595+
def __init__(self, custom_id: str, emoji: str):
596+
super().__init__(style=discord.ButtonStyle.gray, emoji=emoji, custom_id=custom_id)
597+
self.view: ConfirmThreadCreationView
596598

597599
async def callback(self, interaction: discord.Interaction):
598600
self.view.value = False

0 commit comments

Comments
 (0)