Update makeprompt.py

This commit is contained in:
Paillat
2023-03-06 23:16:32 +01:00
parent 10a0c24cf4
commit 6c4f8166b0

View File

@@ -33,7 +33,8 @@ async def chat_process(self, message):
tts = data[11] tts = data[11]
pretend_to_be = data[12] pretend_to_be = data[12]
pretend_enabled = data[13] pretend_enabled = data[13]
try: cp.execute("SELECT * FROM data WHERE guild_id = ?", (message.guild.id,))
except: pass
try: try:
c.execute("SELECT * FROM model WHERE guild_id = ?", (message.guild.id,)) # get the model in the database c.execute("SELECT * FROM model WHERE guild_id = ?", (message.guild.id,)) # get the model in the database
model = c.fetchone()[1] model = c.fetchone()[1]
@@ -42,15 +43,17 @@ async def chat_process(self, message):
try: premium = cp.fetchone()[2] # get the premium status of the guild try: premium = cp.fetchone()[2] # get the premium status of the guild
except: premium = 0 # if the guild is not in the database, it's not premium except: premium = 0 # if the guild is not in the database, it's not premium
channels = [] # create the channels list
channels = []
try: try:
cp.execute("SELECT * FROM channels WHERE guild_id = ?", (message.guild.id,)) # get the channels in the premium database cp.execute("SELECT * FROM channels WHERE guild_id = ?", (message.guild.id,))
if premium: channels = cp.fetchone()[1:] # if the guild is premium, add the channels to the channels list if premium:
debug("Premium channels: "+str(channels)) #for 5 times, we get c.fetchone()[1] to c.fetchone()[5] and we add it to the channels list, each time with try except
except: for i in range(5):
debug("Error while getting premium channels") #we use the i variable to get the channel id
channels = [] # if the guild is not premium, the channels list is empty try: channels.append(str(cp.fetchone()[i+1]))
except: pass
except: channels = []
if api_key is None: return # if the api key is not set, return if api_key is None: return # if the api key is not set, return