fix(moderation): fixed moderation imports

This commit is contained in:
Seaswimmer 2023-12-18 16:43:28 -05:00
parent 7c3310af32
commit e2c165297d
Signed by untrusted user: cswimr
GPG key ID: 1EBC234EEDA901AE

View file

@ -1,4 +1,4 @@
from datetime import timedelta from datetime import timedelta, strptime
import json import json
from redbot.core import commands from redbot.core import commands
from discord import Message, ButtonStyle, Interaction, ui from discord import Message, ButtonStyle, Interaction, ui
@ -69,6 +69,13 @@ class ImportModerationView(ui.View):
if 'metadata' not in case or not case['metadata']: if 'metadata' not in case or not case['metadata']:
case['metadata'] = {} case['metadata'] = {}
duration_t = strptime(case['duration'], "%H:%M:%S")
duration = timedelta(
hours=duration_t.hours,
minutes=duration_t.minutes,
seconds=duration_t.seconds
)
await mysql_log( await mysql_log(
self.ctx.guild.id, self.ctx.guild.id,
case['moderator_id'], case['moderator_id'],
@ -76,7 +83,7 @@ class ImportModerationView(ui.View):
case['target_type'], case['target_type'],
case['target_id'], case['target_id'],
case['role_id'], case['role_id'],
case['duration'], duration,
case['reason'], case['reason'],
timestamp=case['timestamp'], timestamp=case['timestamp'],
resolved=case['resolved'], resolved=case['resolved'],