Discord.py: Get Mentions list from an embedded message

Created on 24 Aug 2020  路  2Comments  路  Source: Rapptz/discord.py

The Problem

Currently the library can't do an awful lot when reading messages sent by other bots. This is because unlike the Message object, the Embed object only has string values. Right now I'm trying to get a list of users that another bot has mentioned, but since all the mentions are embedded, simply using message.mentions returns an empty list - and I can't do anything like message.embeds[0].mentions because the Embed object doesn't have the functionality.

The Ideal Solution

Have message.mentions return a list of mentioned users inside embeds as well as outside, OR add a .mentions list to the Embed object.

The Current Solution

Manually parse the string "@UserName" to try and find the user mentioned. This isn't especially helpful since there's the possibility of duplicate users and no way to know which one the bot mentioned.

Summary

Add a way to see all users that a bot mentioned in an embedded message, either by adding them to the message.mentions list or by adding an Embed.mentions list.

wontfix

Most helpful comment

See #5744.

All 2 comments

See #5744.

This functionality definitely isn't going to happen -- for Message.mentions the issue above details why but for Embed.mentions the issue is a bit more nuanced. There are many parts within an embed that can have string content and by extension mentions, so it should be up to the user to decide how and why they want to parse it rather than the library. For example there is Embed.description and the field value of every field (of which there can be up to 25). Usually for parsing schemes like this you want to be more clear and have more control over it rather than something inflexible like a library provided attribute -- it's rare to want mentions from anywhere and do something strange with it. Likewise, there's nothing in the Embed class that allows it to resolve the mentions either so you'd just get strings anyway.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

PicklesJars picture PicklesJars  路  3Comments

danshat picture danshat  路  3Comments

tairabiteru picture tairabiteru  路  3Comments

JackL0 picture JackL0  路  3Comments

jzburda picture jzburda  路  3Comments