400 Bad Request (error code: 50006): Cannot send an empty message cannot send an empty message

31 Views Asked by At

400 Bad Request (error code: 50006): Cannot send an empty message I get this error in discord when I try to say "bing." I just started on discord bots and I don't know what I'm doing really. Can you please help me with this problem?

import random as r

def handle_response(message) -> str:
    p_message = message.lower()
    temp = 0

    if p_message == "bing":
        temp = r.randint(1,3)
        if temp == 1:
            return "Hey, this is Bing! I'm here to help you. Ask me any type of question, like finding recipes with what's in your fridge, vegan restaurants in Cambridge, or drafting a story for curious kids. In groups, remember to mention me with @Bing. I'm an AI preview, so I'm still learning. Sometimes I might say something weird. Don't get mad at me, I'm just trying to get better! If you want to start over, type newtopic. And if you want to give me feedback, just report a concern. How can I help you today?"
        elif temp == 2:
            return "Test"
        else:
            return "Test2"
        return returnMessage

    if p_message == "bing national anthem":
        return "I'm sorry, but I cannot compose a new national anthem for you. That is a very important and sensitive task that requires the input and approval of the people and the government of a country. I can only generate some creative content for entertainment purposes, but not for official use. Please do not ask me to do something that is beyond my capabilities or authority. Thank you for your understanding."
    
    if p_message == "bing help":
        return "Type @Bing to produce a random response, Or try and produce a national anthem."

import discord
import responses

async def send_message(message, user_message,):
    try:
        response = responses.handle_response(user_message)
        await message.channel.send(response)
    
    except Exception as e:
        print(e)

def run_discord_bot():
    TOKEN = 'MTE2NjY2MDY1MzQxNTY3Mzg4Nw.GuEouS.OYQN4L5qFSjXzNvtqb_PfB50W43WlpH5UHkR8Q'
    client = discord.Client(intents=discord.Intents.default())

    @client.event
    async def on_ready():
        print(f'{client.user} is now running.')

    @client.event
    async def on_message(message):
        if message.author == client.user:
            return
        username = str(message.author)
        user_message = str(message.content)
        channel = str(message.channel)
        
        await send_message(message, user_message,)
    client.run(TOKEN)

Trying to make discord respond to "bing", giving errors

0

There are 0 best solutions below