From a3a9a6876ac86830489f6294f04a9a32a0e3f605 Mon Sep 17 00:00:00 2001 From: Cpt-Dingus <100243410+Cpt-Dingus@users.noreply.github.com> Date: Sun, 1 Sep 2024 23:44:11 +0200 Subject: [PATCH 1/3] Ducks don't timeout anymore --- techsupport_bot/commands/duck.py | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/techsupport_bot/commands/duck.py b/techsupport_bot/commands/duck.py index 1f7cdfe2..ba6ea69d 100644 --- a/techsupport_bot/commands/duck.py +++ b/techsupport_bot/commands/duck.py @@ -380,17 +380,7 @@ def message_check( f"seconds. Time would have been {duration_exact} seconds" ) ) - # Only attempt timeout if we know we can do it - if ( - channel.guild.me.top_role > message.author.top_role - and channel.guild.me.guild_permissions.moderate_members - ): - asyncio.create_task( - message.author.timeout( - timedelta(seconds=config.extensions.duck.cooldown.value), - reason="Missed a duck", - ) - ) + asyncio.create_task( message.channel.send( content=message.author.mention, From 03631fd87e3cd3dbda76e7332ebf1f63558a4cde Mon Sep 17 00:00:00 2001 From: Cpt-Dingus <100243410+Cpt-Dingus@users.noreply.github.com> Date: Sun, 1 Sep 2024 23:47:37 +0200 Subject: [PATCH 2/3] unused import --- techsupport_bot/commands/duck.py | 1 - 1 file changed, 1 deletion(-) diff --git a/techsupport_bot/commands/duck.py b/techsupport_bot/commands/duck.py index ba6ea69d..3405087f 100644 --- a/techsupport_bot/commands/duck.py +++ b/techsupport_bot/commands/duck.py @@ -6,7 +6,6 @@ import datetime import functools import random -from datetime import timedelta from typing import TYPE_CHECKING, Self import discord From abb85601d908988b6b22fd42ab8c25ee18f2cb0d Mon Sep 17 00:00:00 2001 From: ajax146 <31014239+ajax146@users.noreply.github.com> Date: Sun, 27 Apr 2025 14:08:45 -0400 Subject: [PATCH 3/3] Make duck timeout a config option --- techsupport_bot/commands/duck.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/techsupport_bot/commands/duck.py b/techsupport_bot/commands/duck.py index b7db8e0e..d1562b3b 100644 --- a/techsupport_bot/commands/duck.py +++ b/techsupport_bot/commands/duck.py @@ -6,6 +6,7 @@ import datetime import functools import random +from datetime import timedelta from typing import TYPE_CHECKING, Self import discord @@ -63,6 +64,13 @@ async def setup(bot: bot.TechSupportBot) -> None: description="The amount of time to wait between bef/bang messages", default=5, ) + config.add( + key="mute_for_cooldown", + datatype="bool", + title="Uses the timeout feature for cooldown", + description="If enabled, users who miss will be timed out for the cooldown seconds", + default=True, + ) config.add( key="success_rate", datatype="int", @@ -376,6 +384,22 @@ def message_check( ) ) + if ( + config.extensions.duck.mute_for_cooldown.value + and config.extensions.duck.cooldown.value > 0 + ): + # Only attempt timeout if we know we can do it + if ( + channel.guild.me.top_role > message.author.top_role + and channel.guild.me.guild_permissions.moderate_members + ): + asyncio.create_task( + message.author.timeout( + timedelta(seconds=config.extensions.duck.cooldown.value), + reason="Missed a duck", + ) + ) + asyncio.create_task( message.channel.send( content=message.author.mention,