如何覆盖频道权限?

时间:2020-07-12 21:20:22

标签: discord discord.js

我想覆盖频道权限。但是我不知道怎么 我试图通过反应来提供支持。我还想覆盖所有人,用户和称为“ Anastic | Staff”的Staff角色的channelpermissinos

这是我的代码:

    bot.on("messageReactionAdd", async (reaction, user) => {
    if(user.bot) return;

    if (reaction.message.partial) await reaction.message.fetch(); 
    if (reaction.partial) await reaction.fetch();
    
    if (user.bot) return; 
    if (!reaction.message.guild) return; 
    if (reaction.message.guild.id !== "601109434197868574") return; 

    if (reaction.emoji.name === "?") {
      let channel = await reaction.message.guild.channels.create(
          `ticket-${user.username}-#${user.discriminator}`
      )
      reaction.message.guild.channels.cache.find('name', `ticket-${user.username}-#${user.discriminator}`)
      .overwritePermissions(user, {
        VIEW_CHANNEL: true,
        SEND_MESSAGES: true,
        READ_MESSAGE_HISTORY: true,
        ATTACH_FILES: false
      });
      channel = await channel.setParent('731947024932667432');
      

    }

0 个答案:

没有答案