added StartButtonDB because discord custom id suck

main
Anorak_1 2023-08-12 13:28:28 +02:00
parent 536370ec17
commit 75c3f98c98
1 changed files with 23 additions and 0 deletions

View File

@ -25,6 +25,29 @@ class MessageDB():
cur.execute(f"DELETE FROM app_msg_db WHERE msg_id={msg_id}")
con.commit()
class StartButtonDB():
def add_start_msg(msg_id: str, app_name: str, guild_id: str) -> None:
data = (msg_id, app_name, guild_id)
con = sqlite3.connect("applications.db")
cur = con.cursor()
cur.execute("INSERT INTO app_start_db VALUES (?, ?, ?)", data)
con.commit()
def get_start_msg(msg_id: str) -> tuple[str, str]:
con = sqlite3.connect("applications.db")
cur = con.cursor()
cur.execute("SELECT app_name, guild_id FROM app_start_db WHERE msg_id=?", (str(msg_id), ))
#print(cur.fetchone())
app_name, guild_id = cur.fetchone()
return app_name, guild_id
def remove_start_msg(msg_id: str) -> None:
con = sqlite3.connect("applications.db")
cur = con.cursor()
cur.execute(f"DELETE FROM app_start_db WHERE msg_id={msg_id}")
con.commit()
class GuildAppDB():
def create_guild(guild_id: str, guild_name: str) -> None:
applications = {}