本文介紹了TypeError [INVALID_TYPE]:提供的覆蓋不是權(quán)限覆蓋的數(shù)組或集合.不和諧 v12的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!
問題描述
module.exports = {
config: {
name: 'lock',
aliases: ['lk'],
description: "",
category: "Admin"
},
run: async (client, message, args) => {
const Discord = require('discord.js')
if(!message.member.hasPermission("MANAGE_MESSAGES", "MANAGE_CHANNELS")) {
return message.reply(`<@${message.author.id}>, You do not have the permissions`);
} else if(!message.guild.me.permissions.has("MANAGE_MESSAGES", "MANAGE_CHANNELS")) {
return message.reply("I don't have Permissions")
} else {
message.channel.overwritePermissions(message.guild.everyone, {
SEND_MESSAGES: false,
ADD_REACTIONS: false
});
const embedLock = new Discord.MessageEmbed()
.setTitle(`Channel successfully blocked! Use !ynlock to Unlock the channel`)
.setColor("RED")
const msg = await message.channel.send(embedLock)
}
}
}
我正在嘗試讓 !lock 命令阻止每個(gè)人的消息,但是當(dāng)我使用該命令時(shí),機(jī)器人會(huì)發(fā)送嵌入消息:
I'm trying to make the !lock command block everyone's messages, but when I use the command, the bot sends the embed message:
const embedLock = new Discord.MessageEmbed()
.setTitle(`Channel successfully blocked! Use !ynlock to Unlock the channel`)
.setColor("RED")
const msg = await message.channel.send(embedLock)
但它不會(huì)阻塞消息,并在終端發(fā)送此錯(cuò)誤:
But it does not block messages, and sends this error in the terminal:
TypeError [INVALID_TYPE]: Supplied overwrites is not an Array or Collection of Permission Overwrites
推薦答案
message.channel.overwritePermissions(message.guild.everyone,
{
SEND_MESSAGES: false,
ADD_REACTIONS: false
});
其實(shí)是Channel的格式.updateOverwrite()
.對(duì)于 Channel.overwritePermissions()
,改用這個(gè):
Is actually the format for Channel.updateOverwrite()
. For Channel.overwritePermissions()
, use this instead:
message.channel.overwritePermissions([
{
id: message.author.id,
deny: ['SEND_MESSAGES', 'ADD_REACTIONS'],
},
]);
這篇關(guān)于TypeError [INVALID_TYPE]:提供的覆蓋不是權(quán)限覆蓋的數(shù)組或集合.不和諧 v12的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!
【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!