Search code examples
pythondiscordpermissionsbots

message.channel.send(xxx) is requiring admin, is this right?


Python, discord bot, I'm getting

Failed to send response, 403 Forbidden (error code: 50013): Missing Permissions

when running

await message.channel.send(result)

unless I set the role to admin. I've given the role everything possible but admin. Why do I need admin, is this normal or am I missing something? I thought I should only need send?

Sample code:


@ bot.event async def on_message(message):

if message.author == bot.user): # Don't process messages generated by the BOT itself
    return

if message.content.startswith('$hello'):

    await message.channel.send('Hello to you too!')

if message.content.startswith('$inspire'):

    await message.channel.send(get_quote())


# Call for every post, to see if this is a FIRST post
result=await set_to_prospect_roles_on_first(message)
if result is not None:
    print ("Sending, "+result)
    try:
        await message.channel.send(result)
    except Exception as e:
        print ("Failed to send response, " + str(e))

Any of the message.channel.send are failing, missing permission, unless I set the bot role to admin, then it works fine.

I feel I'm missing something and shouldn't require admin

Note: I also tried using message.reply and it too is requiring admin


Solution

  • I tested your code, and I found that it worked in channels that weren't private as long as it had the send messages permission. Check that the channels that you're using it in don't have permissions set that stop the bot sending messages.