我的 Discord Bot 遇到問題。id 做什么,它根據命令創建一個通道并為特定角色分配權限“VIEW_CHANNEL”?,F在的問題是,我需要獲取角色的 ID。我試過這個(下面的代碼)但它不起作用。let admin = message.guild.roles.cache.find(role => role.name === "LuisChatAdmin").id;編輯:這是錯誤。對不起,我忘了附上它。(node:11956) UnhandledPromiseRejectionWarning: TypeError [INVALID_TYPE]: Supplied parameter is not a User nor a Role. at Function.resolve (C:\Users\User\Desktop\Stuff\Schei?e die sich verpissen soll\LuisChat\node_modules\discord.js\src\structures\PermissionOverwrites.js:177:28) at C:\Users\User\Desktop\Stuff\Schei?e die sich verpissen soll\LuisChat\node_modules\discord.js\src\managers\GuildChannelManager.js:109:81 at Array.map (<anonymous>) at GuildChannelManager.create (C:\Users\User\Desktop\Stuff\Schei?e die sich verpissen soll\LuisChat\node_modules\discord.js\src\managers\GuildChannelManager.js:109:51) at Client.<anonymous> (C:\Users\User\Desktop\Stuff\Schei?e die sich verpissen soll\LuisChat\bot.js:230:34) at Client.emit (events.js:333:22) at MessageCreateAction.handle (C:\Users\User\Desktop\Stuff\Schei?e die sich verpissen soll\LuisChat\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14) at Object.module.exports [as MESSAGE_CREATE] (C:\Users\User\Desktop\Stuff\Schei?e die sich verpissen soll\LuisChat\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32) at WebSocketManager.handlePacket (C:\Users\User\Desktop\Stuff\Schei?e die sich verpissen soll\LuisChat\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31) at WebSocketShard.onPacket (C:\Users\User\Desktop\Stuff\Schei?e die sich verpissen soll\LuisChat\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22)
DiscordJS 獲取角色的 ID
萬千封印
2023-03-03 15:43:08