From 5a4ee3dda36bc473283977a09b17a12aadc11833 Mon Sep 17 00:00:00 2001 From: Anorak_1 Date: Fri, 11 Aug 2023 10:55:56 +0200 Subject: [PATCH] Added get applications function --- dbutil.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dbutil.py b/dbutil.py index 4e54199..b6ae37d 100644 --- a/dbutil.py +++ b/dbutil.py @@ -93,6 +93,14 @@ class GuildAppDB(): if application_name in applications.keys(): return applications[application_name] + def get_applications(guild_id: str): + con = sqlite3.connect("applications.db") + cur = con.cursor() + cur.execute("SELECT applications_blob FROM app_guildapp_db WHERE guild_id=(?)", (guild_id, )) + application_blob = cur.fetchone() + applications = pickle.loads(application_blob[0]) + return list(applications.keys()) + def set_response_channel(guild_id: str, application_name: str, channel_id: str) -> str: con = sqlite3.connect("applications.db") cur = con.cursor()