Discord Python Allow one user to identify another within command

Tags: ,



I’m working on a bot for discord that tracks information related to a game. I would like staff members to alter the data of regular players with a bot command. Is there a way to grab the mention out of the command?

&do_thing @target specifics

I’m familiar with extracting the nickname and discord ID for the author. I need to get that info for the target.

Any help appreciated.

Answer

If you mean pinging/mentioning another discord user with the message, then you should check out this previously asked question.

The basic gist is that you can use message.mentions[0].id to get the first tagged user in the message.

Please make sure to check the forum for previously asked similar questions before you ask your own, in order to avoid asking repetitive questions.



Source: stackoverflow