added StartButtonDB because discord custom id suck
parent
536370ec17
commit
75c3f98c98
23
dbutil.py
23
dbutil.py
|
@ -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 = {}
|
||||
|
|
Loading…
Reference in New Issue