Moved app message functions under MessageDB class

for hinting
main
Anorak_1 2023-08-08 17:33:37 +02:00
parent 11ed17f2ea
commit 838600c369
1 changed files with 19 additions and 17 deletions

View File

@ -2,6 +2,8 @@ import json
import os import os
import sqlite3 import sqlite3
class MessageDB():
def add_application_msg(msg_id: str, author_id: str, guild_id: str) -> None: def add_application_msg(msg_id: str, author_id: str, guild_id: str) -> None:
data = (msg_id, author_id, guild_id) data = (msg_id, author_id, guild_id)
con = sqlite3.connect("applications.db") con = sqlite3.connect("applications.db")
@ -9,7 +11,7 @@ def add_application_msg(msg_id: str, author_id: str, guild_id: str) -> None:
cur.execute("INSERT INTO app_msg_db VALUES (?, ?, ?)", data) cur.execute("INSERT INTO app_msg_db VALUES (?, ?, ?)", data)
con.commit() con.commit()
def get_application_msg(msg_id: str): def get_application_msg(msg_id: str) -> tuple[str, str]:
con = sqlite3.connect("applications.db") con = sqlite3.connect("applications.db")
cur = con.cursor() cur = con.cursor()
cur.execute(f"SELECT user_id, guild_id FROM app_msg_db WHERE msg_id={msg_id}") cur.execute(f"SELECT user_id, guild_id FROM app_msg_db WHERE msg_id={msg_id}")