Update code.py

This commit is contained in:
Paillat
2022-12-06 12:18:33 +01:00
parent ede306cf07
commit 1b5caee04e

View File

@@ -250,7 +250,7 @@ async def advanced_help(ctx):
#when someone mentions the bot, check if the guild is in the database and if the bot is enabled. If it is, send a message answering the mention #when someone mentions the bot, check if the guild is in the database and if the bot is enabled. If it is, send a message answering the mention
@bot.command(name="pretend", description="Make the bot pretend to be someone else") @bot.command(name="pretend", description="Make the bot pretend to be someone else")
@discord.commands.option(name="pretend to be...", description="The person/thing you want the bot to pretend to be", required=True) @discord.commands.option(name="pretend to be...", description="The person/thing you want the bot to pretend to be", required=True)
async def pretend(ctx, pretend_to_be: str, message: str): async def pretend(ctx, pretend_to_be: str):
debug(f"The user {ctx.author} ran the pretend command in the channel {ctx.channel} of the guild {ctx.guild}, named {ctx.guild.name}") debug(f"The user {ctx.author} ran the pretend command in the channel {ctx.channel} of the guild {ctx.guild}, named {ctx.guild.name}")
#check if the guild is in the database #check if the guild is in the database
c.execute("SELECT * FROM data WHERE guild_id = ?", (ctx.guild.id,)) c.execute("SELECT * FROM data WHERE guild_id = ?", (ctx.guild.id,))
@@ -263,7 +263,7 @@ async def pretend(ctx, pretend_to_be: str, message: str):
await ctx.respond("The bot is disabled", ephemeral=True) await ctx.respond("The bot is disabled", ephemeral=True)
return return
#enable pretend if it is not enabled, and disable it if it is #enable pretend if it is not enabled, and disable it if it is
if c.fetchone()[11] == 0: if c.fetchone()[13] == 0:
c.execute("UPDATE data SET pretend = 1 WHERE guild_id = ?", (ctx.guild.id,)) c.execute("UPDATE data SET pretend = 1 WHERE guild_id = ?", (ctx.guild.id,))
conn.commit() conn.commit()
await ctx.respond("Pretend mode enabled", ephemeral=True) await ctx.respond("Pretend mode enabled", ephemeral=True)