misc(aurora): some whitelabel changes
All checks were successful
Pylint / Pylint (3.11) (push) Successful in 43s
All checks were successful
Pylint / Pylint (3.11) (push) Successful in 43s
This commit is contained in:
parent
9cbe87bd66
commit
b1edf79409
2 changed files with 27 additions and 27 deletions
|
@ -30,12 +30,12 @@ async def create_guild_table(guild: Guild):
|
|||
cursor = database.cursor()
|
||||
|
||||
try:
|
||||
cursor.execute(f"SELECT * FROM `moderation_{guild.id}`")
|
||||
cursor.execute(f"SELECT * FROM `{guild.id}`")
|
||||
logger.debug("SQLite Table exists for server %s (%s)", guild.name, guild.id)
|
||||
|
||||
except sqlite3.OperationalError:
|
||||
query = f"""
|
||||
CREATE TABLE `moderation_{guild.id}` (
|
||||
CREATE TABLE `{guild.id}` (
|
||||
moderation_id INTEGER PRIMARY KEY,
|
||||
timestamp INTEGER NOT NULL,
|
||||
moderation_type TEXT NOT NULL,
|
||||
|
@ -56,17 +56,17 @@ async def create_guild_table(guild: Guild):
|
|||
"""
|
||||
cursor.execute(query)
|
||||
|
||||
index_query_1 = "CREATE INDEX idx_target_id ON moderation_{}(target_id);"
|
||||
index_query_1 = "CREATE INDEX idx_target_id ON {}(target_id);"
|
||||
cursor.execute(index_query_1.format(guild.id))
|
||||
|
||||
index_query_2 = "CREATE INDEX idx_moderator_id ON moderation_{}(moderator_id);"
|
||||
index_query_2 = "CREATE INDEX idx_moderator_id ON {}(moderator_id);"
|
||||
cursor.execute(index_query_2.format(guild.id))
|
||||
|
||||
index_query_3 = "CREATE INDEX idx_moderation_id ON moderation_{}(moderation_id);"
|
||||
index_query_3 = "CREATE INDEX idx_moderation_id ON {}(moderation_id);"
|
||||
cursor.execute(index_query_3.format(guild.id))
|
||||
|
||||
insert_query = f"""
|
||||
INSERT INTO `moderation_{guild.id}`
|
||||
INSERT INTO `{guild.id}`
|
||||
(moderation_id, timestamp, moderation_type, target_type, target_id, moderator_id, role_id, duration, end_timestamp, reason, resolved, resolved_by, resolve_reason, expired, changes, metadata)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
"""
|
||||
|
@ -93,7 +93,7 @@ async def create_guild_table(guild: Guild):
|
|||
database.commit()
|
||||
|
||||
logger.debug(
|
||||
"SQLite Table (moderation_%s) created for %s (%s)",
|
||||
"SQLite Table (%s) created for %s (%s)",
|
||||
guild.id,
|
||||
guild.name,
|
||||
guild.id,
|
||||
|
@ -157,7 +157,7 @@ async def mysql_log(
|
|||
|
||||
moderation_id = await get_next_case_number(guild_id=guild_id, cursor=cursor)
|
||||
|
||||
sql = f"INSERT INTO `moderation_{guild_id}` (moderation_id, timestamp, moderation_type, target_type, target_id, moderator_id, role_id, duration, end_timestamp, reason, resolved, resolved_by, resolve_reason, expired, changes, metadata) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
|
||||
sql = f"INSERT INTO `{guild_id}` (moderation_id, timestamp, moderation_type, target_type, target_id, moderator_id, role_id, duration, end_timestamp, reason, resolved, resolved_by, resolve_reason, expired, changes, metadata) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
|
||||
val = (
|
||||
moderation_id,
|
||||
timestamp,
|
||||
|
@ -184,7 +184,7 @@ async def mysql_log(
|
|||
database.close()
|
||||
|
||||
logger.debug(
|
||||
"Row inserted into moderation_%s!\n%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s",
|
||||
"Row inserted into %s!\n%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s",
|
||||
guild_id,
|
||||
moderation_id,
|
||||
timestamp,
|
||||
|
@ -212,7 +212,7 @@ async def fetch_case(moderation_id: int, guild_id: str) -> dict:
|
|||
database = connect()
|
||||
cursor = database.cursor()
|
||||
|
||||
query = f"SELECT * FROM moderation_{guild_id} WHERE moderation_id = ?;"
|
||||
query = f"SELECT * FROM {guild_id} WHERE moderation_id = ?;"
|
||||
cursor.execute(query, (moderation_id,))
|
||||
result = cursor.fetchone()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue