fix(aurora): fixed durations, again
This commit is contained in:
parent
e62bd62e29
commit
5a53e3327b
1 changed files with 8 additions and 3 deletions
|
@ -3,7 +3,7 @@
|
||||||
import json
|
import json
|
||||||
import time
|
import time
|
||||||
import sqlite3
|
import sqlite3
|
||||||
from datetime import datetime
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
from discord import Guild
|
from discord import Guild
|
||||||
from redbot.core import data_manager
|
from redbot.core import data_manager
|
||||||
|
@ -110,7 +110,7 @@ async def mysql_log(
|
||||||
target_type: str,
|
target_type: str,
|
||||||
target_id: int,
|
target_id: int,
|
||||||
role_id: int,
|
role_id: int,
|
||||||
duration,
|
duration: timedelta,
|
||||||
reason: str,
|
reason: str,
|
||||||
database: sqlite3.Connection = None,
|
database: sqlite3.Connection = None,
|
||||||
timestamp: int = None,
|
timestamp: int = None,
|
||||||
|
@ -127,7 +127,12 @@ async def mysql_log(
|
||||||
if duration != "NULL":
|
if duration != "NULL":
|
||||||
end_timedelta = datetime.fromtimestamp(timestamp) + duration
|
end_timedelta = datetime.fromtimestamp(timestamp) + duration
|
||||||
end_timestamp = int(end_timedelta.timestamp())
|
end_timestamp = int(end_timedelta.timestamp())
|
||||||
duration = str(duration)
|
|
||||||
|
total_seconds = int(duration.total_seconds())
|
||||||
|
hours = total_seconds // 3600
|
||||||
|
minutes = (total_seconds % 3600) // 60
|
||||||
|
seconds = total_seconds % 60
|
||||||
|
duration = f"{hours}:{minutes}:{seconds}"
|
||||||
else:
|
else:
|
||||||
end_timestamp = 0
|
end_timestamp = 0
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue