convert Moderation to sqlite3 (and rename it to Aurora) #12

Merged
cswimr merged 16 commits from sqlite3 into main 2023-12-28 05:22:52 -05:00
Showing only changes of commit 5a53e3327b - Show all commits

View file

@ -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