mirror of
https://github.com/Paillat-dev/Botator.git
synced 2026-01-02 01:06:19 +00:00
Update code.py
This commit is contained in:
35
code/code.py
35
code/code.py
@@ -259,25 +259,22 @@ async def on_message(message):
|
|||||||
prompt = ""
|
prompt = ""
|
||||||
#get the channel id from the database
|
#get the channel id from the database
|
||||||
c.execute("SELECT channel_id FROM data WHERE guild_id = ?", (message.guild.id,))
|
c.execute("SELECT channel_id FROM data WHERE guild_id = ?", (message.guild.id,))
|
||||||
if str(message.channel.id) != str(c.fetchone()[0]):
|
for msg in messages:
|
||||||
prompt = message.author.display_name + ":" + message.content + "\n"
|
if msg.author.bot:
|
||||||
else:
|
prompt += f"Botator: {msg.content}\n"
|
||||||
for msg in messages:
|
else:
|
||||||
if msg.author.bot:
|
#replace the mentions of each user with their name
|
||||||
prompt += f"Botator: {msg.content}\n"
|
#first get all the mentions in the message
|
||||||
else:
|
mentions = re.findall(r"<@!?\d+>", msg.content)
|
||||||
#replace the mentions of each user with their name
|
#then replace each mention with the name of the user
|
||||||
#first get all the mentions in the message
|
for mention in mentions:
|
||||||
mentions = re.findall(r"<@!?\d+>", msg.content)
|
#get the user id
|
||||||
#then replace each mention with the name of the user
|
id = mention[2:-1]
|
||||||
for mention in mentions:
|
#get the user
|
||||||
#get the user id
|
user = await bot.fetch_user(id)
|
||||||
id = mention[2:-1]
|
#replace the mention with the name
|
||||||
#get the user
|
msg.content = msg.content.replace(mention, msg.guild.get_member(user.id).display_name)
|
||||||
user = await bot.fetch_user(id)
|
prompt += f"{msg.author.display_name}: {msg.content}\n"
|
||||||
#replace the mention with the name
|
|
||||||
msg.content = msg.content.replace(mention, msg.guild.get_member(user.id).display_name)
|
|
||||||
prompt += f"{msg.author.display_name}: {msg.content}\n"
|
|
||||||
#get the prompt_prefix from the database
|
#get the prompt_prefix from the database
|
||||||
c.execute("SELECT prompt_prefix FROM data WHERE guild_id = ?", (message.guild.id,))
|
c.execute("SELECT prompt_prefix FROM data WHERE guild_id = ?", (message.guild.id,))
|
||||||
prompt = f"This is a conversation with an AI in a discord chat. The AI is called \"Botator\" Only the {prompt_size} last messages are used as a prompt.\n Botator has been coded by Jérémie Cotti. His usernme in discord is \"Paillat\". He's 15 years old. No other language. Jérémie used openai's ai models to create Botator and Binded it with discord." + str(c.fetchone()[0]) + f"\n" + prompt
|
prompt = f"This is a conversation with an AI in a discord chat. The AI is called \"Botator\" Only the {prompt_size} last messages are used as a prompt.\n Botator has been coded by Jérémie Cotti. His usernme in discord is \"Paillat\". He's 15 years old. No other language. Jérémie used openai's ai models to create Botator and Binded it with discord." + str(c.fetchone()[0]) + f"\n" + prompt
|
||||||
|
|||||||
Reference in New Issue
Block a user