久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

如何使用 discord.js 獲取特定的會員用戶名

How to get specific member username with discord.js(如何使用 discord.js 獲取特定的會員用戶名)
本文介紹了如何使用 discord.js 獲取特定的會員用戶名的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我想在嵌入消息中添加一個特定的成員信息(用戶名 + 頭像).有人知道怎么做嗎?

I would like to add one specific member information (username + avatar) into an embed message. Does someone know how to do that?

const feedback = new discord.RichEmbed()
.setColor([0, 0, 255])
.setFooter("Bot created by : " + message.author.username, message.author.avatarURL)
.setDescription("The text I want to be sent")

在上面的代碼中,我想通過特定的不和諧成員標識 id 更改message.author.username"和message.author.avatarUrl",例如:436577130583949315.

On the code above, I would like to change "message.author.username" and "message.author.avatarUrl" by a specific discord member identification id such as : 436577130583949315 for example.

但是我不知道從那個不和諧的識別號中能夠顯示用戶名和頭像的方式是什么.

However I don't know what is the way from that discord identification number to be able to show the username and the avatar.

提前感謝您的幫助:)

推薦答案

由于管理器的實現(xiàn),必須修改以下代碼以使用最新版本的 Discord.js(本次編輯時為 v12).

您可以通過用戶的 ID 從客戶端的用戶緩存中檢索用戶,Client#users.但是,不能保證每個用戶都始終被緩存,因此您可以使用 Client#fetchUser().請記住,它返回一個 Promise.如果用戶在緩存中,該方法將返回它.

You can retrieve a user by their ID from the client's cache of users, Client#users. However, every user isn't guaranteed to be cached at all times, so you can fetch a user from Discord using Client#fetchUser(). Keep in mind, it returns a Promise. If the user is in the cache, the method will return it.

例子:

// Async context needed for 'await'

try {
  const devID = '436577130583949315';
  const dev = await client.fetchUser(devID);

  const feedback = new discord.RichEmbed()
    .setColor([0, 0, 255])
    .setFooter(`Bot created by ${dev.tag}.`, dev.displayAvatarURL)
    .setDescription('Your text here.');

  await message.channel.send(feedback);
} catch(err) {
  console.error(err);
}

這篇關于如何使用 discord.js 獲取特定的會員用戶名的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權益,請聯(lián)系我們刪除處理,感謝您的支持!

相關文檔推薦

discord.js v12: How do I await for messages in a DM channel?(discord.js v12:我如何等待 DM 頻道中的消息?)
how to make my bot mention the person who gave that bot command(如何讓我的機器人提及發(fā)出該機器人命令的人)
How to fix Must use import to load ES Module discord.js(如何修復必須使用導入來加載 ES 模塊 discord.js)
How to list all members from a specific server?(如何列出來自特定服務器的所有成員?)
Discord bot: Fix ‘FFMPEG not found’(Discord bot:修復“找不到 FFMPEG)
Welcome message when joining discord Server using discord.js(使用 discord.js 加入 discord 服務器時的歡迎消息)
主站蜘蛛池模板: 在线中文字幕av | 精品亚洲一区二区 | 国产成人精品网站 | 欧美精品久久久久久久久久 | 宅男噜噜噜66一区二区 | 久热久 | 久久综合伊人 | 成人中文网 | 国内精品久久久久久久影视简单 | www.精品国产 | 激情 一区 | 一级片在线视频 | 国产成人精品一区二 | 日韩乱码av | www日韩| 男人天堂网址 | 成人性视频免费网站 | 色视频成人在线观看免 | 中文字幕在线观看视频一区 | 一本一道久久a久久精品综合蜜臀 | 老司机成人在线 | 国产成人精品区一区二区不卡 | 国产蜜臀97一区二区三区 | 久久久久国产 | 夜夜爽99久久国产综合精品女不卡 | 国产精品亚洲一区二区三区在线观看 | 色综合久久久 | 亚洲人va欧美va人人爽 | av天天干 | 久久综合久久综合久久 | 一级片子| 免费观看一级毛片 | 特级丰满少妇一级aaaa爱毛片 | 狠狠操电影 | 中文字幕一区二区三区乱码在线 | 亚洲欧美一区二区三区在线 | 成人免费高清 | 欧美不卡视频一区发布 | 日韩一级免费大片 | 婷婷色国产偷v国产偷v小说 | 欧美5区|