我最近为 discord.js 做了一个锁定命令。但是,每当我运行命令时,我都会收到错误消息。这是代码:
module.exports = {
name: "lock",
description: "Lock",
async run(client, message, args) {
if (!message.member.hasPermission("KICK_MEMBERS")) return message.channel.send('You can\'t use that!')
function lock(message) {
let channel = message.channel;
const Guild = client.guilds.cache.get("751424392420130907");
if (!Guild) return console.error("Couldn't find the guild.");
const Role = Guild.roles.cache.find(role => role.name == "Verified");
channel.overwritePermissions(
Role, {
'SEND_MESSAGES': false
},
'Competitive has Ended'
)
}
lock(message)
message.channel.send('Channel Locked')
}
}
正如我之前提到的,每当我运行此命令时,我都会收到以下错误:
(node:1354) UnhandledPromiseRejectionWarning: TypeError [INVALID_TYPE]: Supplied overwrites is not an Array or Collection of Permission Overwrites.
at TextChannel.overwritePermissions (/home/runner/SweatyBeautifulHelpfulWorker/node_modules/discord.js/src/structures/GuildChannel.js:208:9)
at lock (/home/runner/SweatyBeautifulHelpfulWorker/commands/lock.js:14:11)
at Object.run (/home/runner/SweatyBeautifulHelpfulWorker/commands/lock.js:21:1)
at Client.<anonymous> (/home/runner/SweatyBeautifulHelpfulWorker/index.js:77:42)
at Client.emit (events.js:327:22)
at Client.EventEmitter.emit (domain.js:483:12)
at MessageCreateAction.handle (/home/runner/SweatyBeautifulHelpfulWorker/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (/home/runner/SweatyBeautifulHelpfulWorker/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
白衣染霜花
桃花长相依
三国纷争
慕无忌1623718
一只斗牛犬
相关分类