N
N
NANDIorg2020-12-30 13:46:20
Python
NANDIorg, 2020-12-30 13:46:20

How to get user id in discord api?

How can I get the id of the user who wrote to my bot

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Anton Neverov, 2020-12-30
@TTATPuOT

https://discordapp.com/developers/docs/resources/c... - the Message object that the bot receives when sending a message to it
https://discordapp.com/developers/docs/resources/u... - the author field at the Message object.
And user has its id.
You should at least initially try to solve your problem before asking a question.

A
Andrey, 2020-12-30
@anerev

I did not work with the Discord API, but usually the server sends json in response, which has an id field

S
sergeo1, 2020-01-05
@sergeo1

Bot = commands.Bot(command_prefix= '!')
@Bot.event
async def on_message(message:discord.Message):
 id = message.author.id
 ...

Should work, if not, write

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question