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

`TypeError: member.hasPermission() is not a function`在disco

`TypeError: member.hasPermission() is not a function` when checking permissions in discord.js(`TypeError: member.hasPermission() is not a function`在discord.js中檢查權限時)
本文介紹了`TypeError: member.hasPermission() is not a function`在discord.js中檢查權限時的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我正在嘗試為我的 Discord 機器人創建一個 has-permission 命令,該命令需要兩個參數:要檢查的用戶和要檢查的權限.您可以在 bot 的 GitHub 存儲庫 中查看代碼(config.jsoncode> 文件被隱藏,因為它包含有關我的機器人應用程序的私人信息).

I am trying to make a has-permission command for my Discord bot, which takes two arguments: the user to check, and the permission to check for. You can see the code in the bot's GitHub repository (the config.json file is hidden due to it containing private information about my bot application).

不和諧截圖:

機器人只是回復嘗試執行該命令時出錯!.

控制臺截圖:

控制臺只是說 TypeError: member.hasPermission is not a function.

有沒有辦法解決這個問題?似乎這是我在執行此命令時遇到的唯一問題.

Is there any way around this? It seems like this is the only problem I am having making this command.

推薦答案

你需要使用:

const member = message.mentions.members.first();

代替:

const member = message.mentions.users.first();

因為 message.mentions.members.first() 將是消息中第一個提到的成員,您需要使用 Member.hasPermission().使用 message.mentions.users.first().hasPermission() 時,您正在使用 User.hasPermission(),但您不能.

as message.mentions.members.first() will be the first mentioned member in the message, and you need to use Member.hasPermission(). When using message.mentions.users.first().hasPermission(), you're using User.hasPermission() and you just can't.

這篇關于`TypeError: member.hasPermission() is not a function`在discord.js中檢查權限時的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 服務器時的歡迎消息)
主站蜘蛛池模板: 国产精品国产成人国产三级 | 亚洲一区久久 | 久久精品免费观看 | 亚洲综合色视频在线观看 | 99re在线视频免费观看 | 国产免费一区二区 | 午夜视频一区二区三区 | 99国产精品99久久久久久粉嫩 | 在线免费观看毛片 | 日韩一区二区三区在线 | 午夜视频免费在线观看 | 成人亚洲 | 国产欧美精品区一区二区三区 | 精品中文字幕一区 | 亚洲精品乱码久久久久久黑人 | 国精品一区| 精品国产乱码久久久久久老虎 | 国产精品 欧美精品 | 欧美日韩一本 | 天天影视综合 | 免费精品在线视频 | 久久大陆 | 久久亚洲国产 | 欧美一区永久视频免费观看 | 超碰国产在线 | 日韩欧美中文 | 国产精品成人一区二区三区吃奶 | 免费在线黄色av | 产真a观专区 | 久久精品一区二区三区四区 | 欧美日韩亚洲一区 | 亚洲国产成人精品久久久国产成人一区 | 国产在线观看一区二区 | 国产精品入口麻豆www | 91影视| 美国av毛片 | 久久亚洲春色中文字幕久久久 | 欧美一区二区三区免费在线观看 | 81精品国产乱码久久久久久 | 欧美影院久久 | 超碰人人人人 |