K
K
kikibyk2019-11-18 15:10:19
Node.js
kikibyk, 2019-11-18 15:10:19

How to get an avatar using a member's id?

How can I get a member avatar? I have a problem with this.. Screenshot below
5dd28a1a0895e083865908.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
fgvnovoross, 2019-11-24
@fgvnovoross

Easy question!

var user = message.mentions.users.first(); //Получаем первого упомянутого в сообщении юзера
if(!user) return message.reply("юзер не упомянут");
var url = user.avatarURL; //Получаем его аватарку! Всё просто!

If you need to get EXACTLY BY ID, then here:
//Типа вы уже объявили переменную id
var user = client.users.get(id); //Получаем юзера из users
if(!user) return message.reply("юзер не найден");
var url = user.avatarURL; //Готово!

If you need a code for getting id from a message, then I can code it ;)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question