mirror of
https://github.com/Paillat-dev/Botator.git
synced 2026-01-02 09:16:19 +00:00
Debugged
This commit is contained in:
17
code/code.py
17
code/code.py
@@ -39,13 +39,18 @@ async def setup(ctx, channel: discord.TextChannel, api_key):
|
|||||||
return
|
return
|
||||||
#check if the guild is already in the database bi checking if there is a key for the guild
|
#check if the guild is already in the database bi checking if there is a key for the guild
|
||||||
c.execute("SELECT * FROM data WHERE guild_id = ?", (ctx.guild.id,))
|
c.execute("SELECT * FROM data WHERE guild_id = ?", (ctx.guild.id,))
|
||||||
if c.fetchone()[2] is not None:
|
if c.fetchone() is not None:
|
||||||
await ctx.respond("This guild is already setup", ephemeral=True)
|
#in this case, the guild is already in the database, so we update the channel id and the api key
|
||||||
return
|
c.execute("UPDATE data SET channel_id = ?, api_key = ? WHERE guild_id = ?", (channel.id, api_key, ctx.guild.id))
|
||||||
#add the guild to the database
|
#we will also set the advanced settings to their default values
|
||||||
c.execute("INSERT INTO data VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", (ctx.guild.id, channel.id, api_key, False, 150, 1, 0, 0.6, 0, 5))
|
c.execute("UPDATE data SET is_active = ?, max_tokens = ?, temperature = ?, frequency_penalty = ?, presence_penalty = ?, uses_count_today = ?, prompt_size = ? WHERE guild_id = ?", (False, 64, 0.9, 0.0, 0.0, 0, 5, ctx.guild.id))
|
||||||
conn.commit()
|
conn.commit()
|
||||||
await ctx.respond("Setup complete", ephemeral=True)
|
await ctx.respond("The channel id and the api key have been updated", ephemeral=True)
|
||||||
|
else:
|
||||||
|
#in this case, the guild is not in the database, so we add it
|
||||||
|
c.execute("INSERT INTO data VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", (ctx.guild.id, channel.id, api_key, False, 64, 0.9, 0.0, 0.0, 0, 5))
|
||||||
|
conn.commit()
|
||||||
|
await ctx.respond("The channel id and the api key have been added", ephemeral=True)
|
||||||
#create a command called "enable" taht only admins can use
|
#create a command called "enable" taht only admins can use
|
||||||
@bot.command()
|
@bot.command()
|
||||||
##@discord.commands.permissions(administrator=True)
|
##@discord.commands.permissions(administrator=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user