Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 21 additions & 8 deletions techsupport_bot/commands/duck.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,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",
Expand Down Expand Up @@ -376,17 +383,23 @@ 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
config.extensions.duck.mute_for_cooldown.value
and config.extensions.duck.cooldown.value > 0
):
asyncio.create_task(
message.author.timeout(
timedelta(seconds=config.extensions.duck.cooldown.value),
reason="Missed a duck",
# 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,
Expand Down
Loading