本文介紹了TypeError [INVALID_TYPE]:提供的覆蓋不是權限覆蓋的數組或集合.不和諧 v12的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
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 命令阻止每個人的消息,但是當我使用該命令時,機器人會發送嵌入消息:
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)
但它不會阻塞消息,并在終端發送此錯誤:
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
});
其實是Channel的格式.updateOverwrite()
.對于 Channel.overwritePermissions()
,改用這個:
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'],
},
]);
這篇關于TypeError [INVALID_TYPE]:提供的覆蓋不是權限覆蓋的數組或集合.不和諧 v12的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!