feat(moderation): added database argument to mysql-log
Some checks failed
Pylint / Pylint (3.10) (push) Failing after 45s
Some checks failed
Pylint / Pylint (3.10) (push) Failing after 45s
This commit is contained in:
parent
d62ea24bd9
commit
621f29be5c
1 changed files with 4 additions and 2 deletions
|
@ -273,7 +273,7 @@ class Moderation(commands.Cog):
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
async def mysql_log(self, guild_id: str, author_id: str, moderation_type: str, target_id: int, role_id: int, duration, reason: str):
|
async def mysql_log(self, guild_id: str, author_id: str, moderation_type: str, target_id: int, role_id: int, duration, reason: str, database: mysql.connector.MySQLConnection = None):
|
||||||
timestamp = int(time.time())
|
timestamp = int(time.time())
|
||||||
|
|
||||||
if duration != "NULL":
|
if duration != "NULL":
|
||||||
|
@ -282,6 +282,7 @@ class Moderation(commands.Cog):
|
||||||
else:
|
else:
|
||||||
end_timestamp = 0
|
end_timestamp = 0
|
||||||
|
|
||||||
|
if not database:
|
||||||
database = await self.connect()
|
database = await self.connect()
|
||||||
cursor = database.cursor()
|
cursor = database.cursor()
|
||||||
|
|
||||||
|
@ -291,6 +292,7 @@ class Moderation(commands.Cog):
|
||||||
val = (moderation_id, timestamp, moderation_type, target_id, author_id, role_id, duration, end_timestamp, f"{reason}", 0, "NULL", "NULL", 0, [])
|
val = (moderation_id, timestamp, moderation_type, target_id, author_id, role_id, duration, end_timestamp, f"{reason}", 0, "NULL", "NULL", 0, [])
|
||||||
cursor.execute(sql, val)
|
cursor.execute(sql, val)
|
||||||
|
|
||||||
|
cursor.close()
|
||||||
database.commit()
|
database.commit()
|
||||||
database.close()
|
database.close()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue