make this reply to the authors message and also add a thinking inital…
- User
PROMPT: user: make this reply to the authors message and also add a thinking inital message that replies to the uathors message and then it edits itself to the message from the api: import nextcord import requests import json # 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}!') @bot.event async def on_message(message): # Check if the message is from a bot or if the bot is not mentioned if message.author.bot: return if bot.user in message.mentions: # Format the message content user_id = message.author.id # Prepare the payload payload = { 'prompt': message.content, 'model': 'gpt-4o', 'cvid': f'Discord-{user_id}', 'web': True } # Send POST request try: response = requests.post('https://kairo-api.kys.gay/api/gpt', json=payload) response_data = response.json() msg = response_data['message'] # Handle the response await message.channel.send(msg) # Adjust according to the desired response format except Exception as e: await message.channel.send(f"An error occurred: {str(e)}") bot.run("OTM3NDUxNzU2OTc4MzA3MDgy.GQcd_s.LQggC-ra6ymFEYd2xtLTVcH4XwTuIBU6WjD0MI")
- Assistant
Sure, I can help with that! Here's how you can edit your script to first send an initial thinking message and then edit it with the response received from the API:
python