Newsonic
Newsonic

Reputation: 403

Discord bot can't mention everyone despite having its permission

Here is the sendMessage function:

async def sendMessage(color, title, value, should_delete=True, channel=""):
    embed = discord.Embed(color=color)
    embed.add_field(name=title, value=value, inline=False)
    if channel == "":
        msg = await client.send_message(message_obj.channel, embed=embed)
    else:
        msg = await client.send_message(client.get_channel(channel), embed=embed)
    if should_delete:
        await delete_msg(msg)

The bot can mention anyone but everyone and here. Despite having mention everyone permission.

sendMessage(OK_COLOR_HASH, "title", "Hello @everyone")

Edit: When I converted the message type to the normal one instead of embed one, it worked.

Upvotes: 2

Views: 6320

Answers (2)

You can try this block code. roles return a list all guild's roles, but first role always a default guild role (default_role) and that's why you must use slicing function.

@bot.command()
async def test(ctx):
    await ctx.send(ctx.message.guild.roles[0])

Or you can do something like this.

 @bot.command()
 async def test(ctx):
     await ctx.send(ctx.message.guild.default_role)

Upvotes: 0

Kanasaki
Kanasaki

Reputation: 146

You can try to sending a mention to everyone through the default_role attribute

@bot.command(pass_context=True)
async def evy(msg):
    await bot.say(msg.message.server.default_role)

Upvotes: 2

Related Questions