From 0d28df7868b4985cdd6b138e47ae1ebdf8fd97a7 Mon Sep 17 00:00:00 2001 From: Anorak_1 Date: Sat, 12 Aug 2023 13:29:10 +0200 Subject: [PATCH] Added get_response_channel --- dbutil.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dbutil.py b/dbutil.py index 7d4445c..b760aac 100644 --- a/dbutil.py +++ b/dbutil.py @@ -139,6 +139,15 @@ class GuildAppDB(): else: return "error on set response channel: application not found" + def get_response_channel(guild_id: str, application_name: str) -> 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]) + if application_name in applications.keys(): + return applications[application_name]["resp_channel"] + def add_question(guild_id: str, application_name: str, question: str) -> str: con = sqlite3.connect("applications.db") cur = con.cursor()