Skip to content

Commit adfee94

Browse files
committed
Replace ban_days with ban_seconds
1 parent 9956732 commit adfee94

3 files changed

Lines changed: 12 additions & 5 deletions

File tree

techsupport_bot/commands/moderator.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ async def handle_ban_user(
111111
result = await moderation.ban_user(
112112
guild=interaction.guild,
113113
user=target,
114-
delete_days=delete_days,
114+
delete_seconds=delete_days * 86400,
115115
reason=f"{reason} - banned by {interaction.user}",
116116
)
117117
if not result:
@@ -496,7 +496,9 @@ async def handle_warn_user(
496496
ban_result = await moderation.ban_user(
497497
guild=interaction.guild,
498498
user=target,
499-
delete_days=config.extensions.moderator.ban_delete_duration.value,
499+
delete_seconds=(
500+
config.extensions.moderator.ban_delete_duration.value * 86400
501+
),
500502
reason=(
501503
f"Over max warning count {new_count_of_warnings} out of"
502504
f" {config.moderation.max_warnings} (final warning:"

techsupport_bot/core/moderation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99

1010
async def ban_user(
11-
guild: discord.Guild, user: discord.User, delete_days: int, reason: str
11+
guild: discord.Guild, user: discord.User, delete_seconds: int, reason: str
1212
) -> bool:
1313
"""A very simple function that bans a given user from the passed guild
1414
@@ -25,7 +25,7 @@ async def ban_user(
2525
await guild.ban(
2626
user,
2727
reason=reason,
28-
delete_message_days=delete_days,
28+
delete_message_seconds=delete_seconds,
2929
)
3030
return True
3131

techsupport_bot/functions/automod.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,12 @@ async def response(
258258
)
259259

260260
await moderation.ban_user(
261-
ctx.guild, ctx.author, 7, total_punishment.violation_string
261+
ctx.guild,
262+
ctx.author,
263+
delete_seconds=(
264+
config.extensions.moderator.ban_delete_duration.value * 86400
265+
),
266+
reason=total_punishment.violation_string,
262267
)
263268
await modlog.log_ban(
264269
self.bot,

0 commit comments

Comments
 (0)