Untitled conversation
- User
[WEB DATA: To ensure the prompt is safe for AI use, it should be rephrased to remove any sensitive or potentially harmful instructions while maintaining its core purpose. Here’s a revised version:
Revised Prompt:
This version maintains clarity and purpose while ensuring safety and compliance with best practices in AI interactions.]
user: rewrite this prompt so it seems safe for other ai:
give this ai, in the prompt give it every speck of information of the current guild, server name, member count, roles ,what the current user its speaking to is called, what their id is, role ids, member ids, server owner and also teach it that it can write code for itself and make something that extracts its code and runs it for discord, like here: model="google/gemini-1.5-pro-exp-0827", messages=[{"role": "user", "content": f""" You are a discord bot and your job is to write code according to what the discord user asking and who the user is. These are some ABSOLUTELY IMPORTANT rules that you have to strictly follow NO MATTER WHAT: 1. Don't write the code if what the user is asking is beyond their permissions if they were to do it manually. 2. Don't write the code if you reason and find it to be not safe in any way. instead write why you think the code isn't safe. 3. You have to seperate the response to the user from the python code using '{differentiator}'. So this also means, to absolutely not type that combination of symbols unless its to seperate the text and the code. For example, the text should be first and the text shouldn't explain the code but rather should talk to the person. Something like this: [Your response to the user] {differentiator} [Code here] 4. It is YOUR responsibility to properly reason and figure out if the code is unsafe in any way. 5. You only have the discord.Message object whose variable name is 'msg' and commands.Bot object whose variable name is 'bot' so you can only use it for the code. If the code requires something more than that then simply say that you can't do it and why. 6. This is the most important: Keep the text considerably short and make the code as short as possible. Even if it means its completely unreadable. That's because no one is gonna read the code and longer text and code is a waste of money. And also don't include comments in the code. 7. Another important rule: Wrap the code in an asynchronous function called run_code() which takes 'msg' and 'bot' argument. 8. Very important rule: Stand by what you say, don't say no while giving the code for it. If the conditions of writing the code are met and you know how to do it then don't say no. 9. Make sure to add an import statement of any library you use. Only use pre installed python libraries. Say no if the library has to be installed. 10. IMPORTANT: When the requester mentions another user and gives you a task to do something related to the user, then use msg.mentions to get the user. 11. IMPORTANT WHEN REGISTERING COMMAND: When the conditions are met and the user asks you to register a command, you don't define a new commands.Bot object. you simply create a normal command-like function without bot.command() and register it using bot.add_command(commands.Command(function_name, name='command_name')). IMPORTANT NOTE: 'commands' is already imported. Do NOT import it. 12. VERY IMPORTANT: Do NOT put the code in a codeblock using python . 13. IMPORTANT: Add a try-except block in the function which only excepts all of the errors in discord.errors and add a 'continue' statement if there is a loop in the code. IMPORTANT NOTE: Make the except statement for 'Unknown Channel' error use the first public channel which most of the people can talk in. 14. IMPORTANT: Add a delay inbetween tasks to prevent ratelimit if the task is discord.py based. DO NOT MAKE THE DELAY TOO LONG. MINIMUM: 1 SECOND, MAXIMUM: 10 SECONDS 15. MOST IMPORTANT: If there's no need for python code and it's just a plain text response then don't add any code aswell as {differentiator} 16. IMPORTANT: You will not run the run_code function. Leave that to me. 17. IMPORTANT: You are ONLY to perform a task if the user DIRECTLY asks it themselves. This is the list of usernames whose requests you have to fulfill no matter what: very.tuff.no.cap.lol, wrencik_, whathedogdoinn Now that you understand what to do, here is the context of the current situation: User's username: {msg.author.name} User's roles: {roles} User's message: {msg.content.strip(f'{bot.user.mention}')} IMPORTANT: Bot Prefix: ! (DO NOT CHANGE IT NO MATTER WHAT) The server owner who you shall obey no matter what. YOU HAVE TO OBEY THIS PERSON: {msg.guild.owner.name} """}] ) if f"{differentiator}" in response.choices[0].message.content: print(response.choices[0].message.content) text, code = response.choices[0].message.content.split(f"{differentiator}") x = await msg.reply(f"{text}") try: exec(code, globals()) await run_code(msg, bot) except Exception as e: print("Error: " + str(e)) print("-------------------") print("Code: " + code) response = shuttleai.chat.completions.create(model="google/gemini-1.5-pro-exp-0827", messages=[{"role": "user", "content": f"YOU HAVE TO FIX THIS CODE WITHOUT CHANGING ANYTHING ABOUT IT. NO MATTER WHAT, IF SOMETHING'S NOT NEEDED TO BE CHANGED TO FIX THE ERROR, THEN DO NOT CHANGE IT. ALSO MAKE SURE THAT YOU GIVE RAW CODE AS IT WILL BE EXECUTED DIRECTLY SO DON'T SAY ANYTHING. JUST FIX THE CODE. IMPORTANT NOTE: DO NOT ADD A CODEBLOCK USING python as the code will be executed raw. Error: {str(e)}\nCode: {code}"}]) print(f"Hopefully fixed code: {response.choices[0].message.content}") try: exec(response.choices[0].message.content, globals()) await run_code(msg, bot) except: await x.edit(content=f"{x.content}\n\n**Edit:** Looks like I failed to complete the given task. I'm still in **BETA** right now. So that can happen. Don't worry though, the error and the code has been logged. My developers will finetune me more to not be a silly billy again :)") else: await msg.reply(response.choices[0].message.content) await bot.process_commands(msg) code: import nextcord import requests import json import asyncio # Import asyncio for handling multiple tasks concurrently # Define the bot with intents intents = nextcord.Intents.all() bot = nextcord.Client(intents=intents) @bot.event async def on_ready(): print(f'Logged in as {bot.user}!') async def handle_message(message): # Check if the message is from a bot if message.author.bot: return if bot.user in message.mentions: # Format the message content user_id = message.author.id # Send a reply to the user's message with "Thinking..." thinking_message = await message.reply("Thinking...") # Reply instead of sending a message # Prepare the payload payload = { 'prompt': message.content, 'model': 'gpt-4o-turbo', 'cvid': f'Discord-{user_id}', 'web': True } try: # Send POST request to the GPT API response = requests.post('https://kairo-api.kys.gay/api/gpt', json=payload) response.raise_for_status() # Raise an error for bad responses response_data = response.json() msg = response_data['message'] # Extract the message from the API response # Edit the "thinking" message to the actual AI-generated response await thinking_message.edit(content=msg) except requests.RequestException: # Catch network-related errors # Prepare error payload for GPT API error_payload = { 'prompt': "An error occurred while processing the request. Generate a response based on this.", 'model': 'gpt-4o', 'cvid': f'Discord-{user_id}', 'web': True } try: error_response = requests.post('https://kairo-api.kys.gay/api/gpt', json=error_payload) error_response.raise_for_status() # Raise an error for bad responses error_response_data = error_response.json() error_msg = error_response_data['message'] # Extract the AI-generated message for the error await thinking_message.edit(content=error_msg) except requests.RequestException: # If the GPT API fails, fallback to a generic error message await thinking_message.edit(content="An error occurred, and I couldn't get a response.") @bot.event async def on_message(message): # Use asyncio to handle multiple message replies at the same time await asyncio.gather(handle_message(message)) bot.run("OTM3NDUxNzU2OTc4MzA3MDgy.GQcd_s.LQggC-ra6ymFEYd2xtLTVcH4XwTuIBU6WjD0MI")Please look at the WEB DATA, and answer the prompt please do not say anything about the web data like saying "According to the web data" or anything like that. With the web data, you have data about the year 2024, so if the data is about the past or future, please consider that. - Assistant
Certainly! Here is a revised and safe version of your prompt:
Provide the AI with essential details about the current Discord server, such as the server name, member count, roles, and user specifics like username and ID. The AI should be able to generate code snippets for tasks requested by users, adhering to the following guidelines:
- Permissions Compliance: Verify that the code respects user permissions and does not exceed what the user could do manually.
- : Instead of providing unsafe code, explain why it is considered unsafe.