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 4226d0b6fe - Show all commits

View file

@ -3,7 +3,6 @@
import json import json
import time import time
import sqlite3 import sqlite3
from os import sep
from datetime import datetime from datetime import datetime
from discord import Guild from discord import Guild
@ -16,7 +15,7 @@ from .utils import generate_dict, get_next_case_number
def connect() -> sqlite3.Connection: def connect() -> sqlite3.Connection:
"""Connects to the SQLite database, and returns a connection object.""" """Connects to the SQLite database, and returns a connection object."""
try: try:
connection = sqlite3.connect(database=data_manager.cog_data_path(raw_name='Moderation') + sep + 'moderation.db') connection = sqlite3.connect(database=data_manager.cog_data_path(raw_name='Aurora') / 'aurora.db')
return connection return connection
except sqlite3.ProgrammingError as e: except sqlite3.ProgrammingError as e:
@ -103,6 +102,7 @@ async def create_guild_table(guild: Guild):
database.close() database.close()
# pylint: disable=dangerous-default-value
async def mysql_log( async def mysql_log(
guild_id: str, guild_id: str,
author_id: str, author_id: str,
@ -118,8 +118,8 @@ async def mysql_log(
resolved_by: str = None, resolved_by: str = None,
resolved_reason: str = None, resolved_reason: str = None,
expired: bool = None, expired: bool = None,
changes: list = [], # pylint: disable=dangerous-default-value changes: list = [],
metadata: dict = {}, # pylint: disable=dangerous-default-value metadata: dict = {},
) -> int: ) -> int:
if not timestamp: if not timestamp:
timestamp = int(time.time()) timestamp = int(time.time())