Update code.py

This commit is contained in:
Paillat
2022-11-29 14:13:59 +01:00
parent 486fb52ff6
commit dfc12defed

View File

@@ -165,6 +165,8 @@ async def help(ctx):
embed.add_field(name="/delete", value="Delete all your data from our server", inline=False) embed.add_field(name="/delete", value="Delete all your data from our server", inline=False)
embed.add_field(name="/cancel", value="Cancel the last message sent by the bot", inline=False) embed.add_field(name="/cancel", value="Cancel the last message sent by the bot", inline=False)
embed.add_field(name="/default", value="Set the advanced settings to their default values", inline=False) embed.add_field(name="/default", value="Set the advanced settings to their default values", inline=False)
# embed.add_field(name="/help", value="Show this message", inline=False)
embed.add_field(name="/help", value="Show this message", inline=False) embed.add_field(name="/help", value="Show this message", inline=False)
await ctx.respond(embed=embed, ephemeral=True) await ctx.respond(embed=embed, ephemeral=True)
#when a message is sent into a channel check if the guild is in the database and if the bot is enabled #when a message is sent into a channel check if the guild is in the database and if the bot is enabled
@@ -244,6 +246,11 @@ async def on_message(message):
messages = await message.channel.history(limit=prompt_size).flatten() messages = await message.channel.history(limit=prompt_size).flatten()
messages.reverse() messages.reverse()
prompt = "" prompt = ""
#get the channel id from the database
c.execute("SELECT channel_id FROM data WHERE guild_id = ?", (message.guild.id,))
if str(message.channel.id) != str(c.fetchone()[0]):
prompt = msg.author.display_name + ":" + message.content + "\n"
else:
for msg in messages: for msg in messages:
if msg.author.bot: if msg.author.bot:
prompt += f"Botator: {msg.content}\n" prompt += f"Botator: {msg.content}\n"