fix(moderation): fixed timeouts being unable to log because of an issue with time formatting
Some checks failed
Pylint / Pylint (push) Failing after 1m13s
Some checks failed
Pylint / Pylint (push) Failing after 1m13s
This commit is contained in:
parent
5d7bab59cc
commit
f298567224
1 changed files with 4 additions and 2 deletions
|
@ -1,4 +1,4 @@
|
||||||
from datetime import datetime
|
from datetime import datetime, timedelta
|
||||||
import logging
|
import logging
|
||||||
import time
|
import time
|
||||||
import discord
|
import discord
|
||||||
|
@ -75,7 +75,9 @@ class Moderation(commands.Cog):
|
||||||
moderation_type = 'UNBAN'
|
moderation_type = 'UNBAN'
|
||||||
elif entry.action == discord.AuditLogAction.member_update:
|
elif entry.action == discord.AuditLogAction.member_update:
|
||||||
if entry.after.timed_out_until is not None:
|
if entry.after.timed_out_until is not None:
|
||||||
duration = entry.after.timed_out_until
|
duration_datetime = datetime.now() - entry.after.timed_out_until
|
||||||
|
minutes = round(duration_datetime.total_seconds() / 60)
|
||||||
|
duration = timedelta(minutes=minutes)
|
||||||
moderation_type = 'TIMEOUT'
|
moderation_type = 'TIMEOUT'
|
||||||
else:
|
else:
|
||||||
moderation_type = 'UNTIMEOUT'
|
moderation_type = 'UNTIMEOUT'
|
||||||
|
|
Loading…
Reference in a new issue