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

Discord.js V12 如何鎖定某個角色的所有頻道?

Discord.js V12 How can I lock all channels for a certain role?(Discord.js V12 如何鎖定某個角色的所有頻道?)
本文介紹了Discord.js V12 如何鎖定某個角色的所有頻道?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我想將服務(wù)器中的所有頻道鎖定為某個角色(發(fā)送消息:false)這是我當(dāng)前的代碼,我得到的錯誤是 TypeError [INVALID_TYPE]: Supplied overwrites is not an Array or Collection of Permission Overwrites.代碼:

I want to lock all channels in the server to a certain role (Send messages: false) This is my current code, the error I get is TypeError [INVALID_TYPE]: Supplied overwrites is not an Array or Collection of Permission Overwrites. Code:

client.on('message', async message => {
    if(message.content.startsWith(prefix + "modrek")) {
        let muteRole = message.guild.roles.cache.find(role => role.name == "Mute")
        const channels = message.guild.channels.cache.filter(ch => ch.type !== "category")
        
        message.guild.channels.forEach(ch => 
            {
            if(ch.type == "text")
              ch.overwritePermissions([
              {
                 id: muteRole.id,
                 deny: ['SEND_MESSAGES'],
              },
            ], 'Needed to change permissions');
            }) 
    
    }

})

如果有人可以幫助我,請告訴我:D

Let me know if someone can help me out :D

推薦答案

overwritePermissions 將替換頻道中的權(quán)限覆蓋,這意味著如果頻道之前有權(quán)限覆蓋,它將全部替換.

overwritePermissions will replace the permission overwrites in the channel that means if the channel had previous permission overwrites it will replace them all.

在那種情況下->

In that case ->

message.channel.overwritePermissions([
  {
     id: muteRole.id,
     deny: ['SEND_MESSAGES'],
  },
], 'Needed to change permissions');

createOverwrite 將覆蓋權(quán)限對于此頻道中的用戶或角色.(如果存在則替換)

createOverwrite will Overwrite the permissions for a user or role in this channel. (replaces if existent)

在那個->

message.channel.createOverwrite(muteRole, {
            SEND_MESSAGES: false
    })
    }

修改所有頻道的權(quán)限 ->

Modify permissions for all channels ->

message.guild.channels.cache.forEach(ch => 
{
if(ch.type == "text")
  ch.overwritePermissions([
  {
     id: muteRole.id,
     deny: ['SEND_MESSAGES'],
  },
], 'Needed to change permissions');
}) 

這篇關(guān)于Discord.js V12 如何鎖定某個角色的所有頻道?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

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(如何讓我的機器人提及發(fā)出該機器人命令的人)
How to fix Must use import to load ES Module discord.js(如何修復(fù)必須使用導(dǎo)入來加載 ES 模塊 discord.js)
How to list all members from a specific server?(如何列出來自特定服務(wù)器的所有成員?)
Discord bot: Fix ‘FFMPEG not found’(Discord bot:修復(fù)“找不到 FFMPEG)
Welcome message when joining discord Server using discord.js(使用 discord.js 加入 discord 服務(wù)器時的歡迎消息)
主站蜘蛛池模板: 久久精品国产一区二区电影 | 精品成人69xx.xyz | 亚洲人va欧美va人人爽 | 亚洲精品精品 | 中文字幕在线观看 | 欧美13videosex性极品 | 亚洲精品9999 | 精品在线观看一区 | 欧美色成人 | 欧美video| 亚洲国产一| 国产在线1区| 2018中文字幕第一页 | 91资源在线 | 欧美性区 | jav成人av免费播放 | 日本午夜在线视频 | 亚洲综合一区二区三区 | 日韩精品一区二 | 黄色一级视频免费 | 国产精品自产拍 | 综合久久久久久久 | 久久精品久久久久久 | 91精品国产一区二区三区 | 日韩视频免费 | 日韩欧美在线视频一区 | 韩日在线| 久久久久久国产一区二区三区 | 亚洲精品一区二区三区蜜桃久 | 国产精品1区 | 伊人色综合久久天天五月婷 | 久久一起草 | 在线观看日本高清二区 | 综合色在线 | 天天综合永久 | 逼逼网 | 国产精品一区在线播放 | 在线中文字幕第一页 | 鸳鸯谱在线观看高清 | 欧美精品欧美精品系列 | 一区二区三区国产在线观看 |