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

discord.js V12“過濾器"未定義

discord.js V12 #39;filter#39; undefined(discord.js V12“過濾器未定義)
本文介紹了discord.js V12“過濾器"未定義的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

所以我將我的機器人更新為 discord.js V12 命令;whois 出現錯誤(node:553) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'filter' of undefined

So I was updating my bot to discord.js V12 the command ;whois is bringing up an error (node:553) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'filter' of undefined

Node.js 是 Discord.js 的當前版本,我知道它是否與代碼有關

Node.js is the current version for Discord.js I do know if it has to do with the code

const { MessageEmbed } = require("discord.js");
const { stripIndents } = require("common-tags");
const { getMember, formatDate } = require("../../functions.js");

module.exports = {
  config:{
    name: "whois",
    aliases: ["who", "user", "info"],
   category: "info",
    description: "Returns user information",
    usage: "[username | id | mention]"
  },
    run: (client, message, args) => {
        const member = getMember(message, args.join(" "));

        // Member variables
        const joined = formatDate(member.joinedAt);
        const roles = member.roles
            .filter(r => r.id !== message.guild.id)
            .map(r => r).join(", ") || 'none';

如果我刪除 .filter &.map 使用 .createdAT 彈出另一個錯誤

If I remove .filter & .map another error pops up with .createdAT

  // User variables
        const created = formatDate(member.user.createdAt);

        const embed = new MessageEmbed()
            .setFooter(member.displayName, member.user.displayAvatarURL({ dynamic:true }))
            .setThumbnail(member.user.displayAvatarURL({ dynamic:true }))
            .setColor(member.displayHexColor === '#000000' ? '#ffffff' : member.displayHexColor)
            .setAuthor(`${member.displayName} | WHOIS`, member.user.displayAvatarURL)

            .addField('Member information:', stripIndents`** Display name:** ${member.displayName}
            ** Joined at:** ${joined}
            ** Roles:** ${roles}`, true)

            .addField('User information:', stripIndents`** ID:** ${member.user.id}
            ** Username**: ${member.user.username}
            ** Tag**: ${member.user.tag}
            ** Created at**: ${created}`, true)

            .setTimestamp()

        if (member.user.presence.game) 
            embed.addField('Currently playing', stripIndents`** Name:** ${member.user.presence.activity.name}`);

        message.channel.send(embed);
    }
}

現在這就是整個 whois 代碼,我不知道還有什么需要更新的.

Now thats is the whole whois code I don't know what else needs to get updated.

推薦答案

要在 v12 中訪問 GuildMemberroles 集合,您需要使用 cache.

To access the GuildMember's roles collection in v12 you need to use cache.

const roles = member.roles.cache.filter(r => r.id !== message.guild.id).map(r => r).join(", ") || 'none';

這篇關于discord.js V12“過濾器"未定義的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

相關文檔推薦

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(如何讓我的機器人提及發出該機器人命令的人)
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 服務器時的歡迎消息)
主站蜘蛛池模板: 日韩精品久久久久久 | 91精品国产欧美一区二区 | 日韩一及片| 亚洲欧美日韩在线不卡 | 一区二区视频在线 | 欧美中文字幕在线 | 国产精品久久99 | 国产精品国产成人国产三级 | 国产精品资源在线 | 狠狠干天天干 | 欧美一区二区免费电影 | 99精品欧美一区二区三区综合在线 | 涩涩操| 欧美日韩一区二区在线观看 | 久久精品a级毛片 | 色欧美片视频在线观看 | 亚洲日本免费 | 亚洲欧洲一区二区 | 91精品久久久久久久99 | 久久亚洲综合 | 欧美男人亚洲天堂 | 亚洲精品av在线 | 黄色av网站在线观看 | 欧美日韩综合精品 | 久久亚洲91| av男人天堂影院 | 夜夜操天天操 | 久久精品99久久 | 天天操天天舔 | 成人免费淫片aa视频免费 | 欧美aaaaaaaa| 婷婷精品| 天天干免费视频 | 狠狠干网站 | 天天干精品 | 一级a性色生活片久久毛片 一级特黄a大片 | www.婷婷 | 在线不卡| 97视频成人 | 久久91 | 成人精品一区二区 |