the conversation history in handlemention now always puts the messages from the channel…
- User
the conversation history in handle_mention now always puts the messages from the channel history. I only want this to happen if the channel id doesnt exist:
import traceback import discord import asyncio import random
from tools.utils import ( process_message, check_ignored_words, clean_reply, handle_message_exception, reject_message, random_sleep, extract_context, read_json, handle_error, ) from config.config import BREAK_STRING, TYPING_SPEED, TOKEN, DEV_ID from tools.ai import get_response, img2txt from tools.commands import CommandHandler
Initialize client and data structures
client = discord.Client() channel_locks = {} last_messages = {} conversation_history = {} user_generating = {}
async def get_name(user): try: return user.nick except AttributeError: try: return user.display_name except AttributeError: return user.global_name
async def get_system_prompt(message): guild_name = message.guild.name guild_owner = await get_name(message.guild.owner) if message.guild.owner else "None" channel_name = message.channel.name
codedata = await read_json() system_prompt = data["system_prompt"] system_prompt += f"""Do not include Name: or Message: or Reply: in your response. Do not include assistant in your response. Do not include 'User is replying to the message:' in your response. Only include the message content in your response, without anything else. Format text using markdown. You have the capability to sometimes add reactions to a message, just include react(<unicode_emoji>) at the very first of your reply, with the unicode_emoji replaced with an emoji representing your reaction to the message. for example: "react(💀)", or "react(😭)". The emoji MUST be a unicode emoji and not text. You also have the capability to respond with a gif only, just respond with gif() only, with the query replaced with the gif you want to send in the context. for example: "gif(my reaction to that information)", "gif(femboy speech bubble)" etc.. This could be used if someone insults you, or if you want to send a gif as a response to a message, or as a conversation starter. You have the capability to sometimes split messages into multiple messages to talk in a more conversational tone, if you ever want to, just include '{BREAK_STRING}' to split the message into two different messages, for example: "hey there{BREAK_STRING}whatsup". The name of the user will be provided to you. You SHOULD NOT send too many multiple messages, only a maximum of 2! Try not to always split your messages, only do it when you want to sound more conversational. Try not to continuosly send gifs, or add reactions to every message, only do it once in a while.
Information about your environment:
- The server you are in is called: {guild_name}
- The owner of this server is {guild_owner}
- Assistant