最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

删除有反应的频道

运维笔记admin10浏览0评论

删除有反应的频道

删除有反应的频道

我需要帮助,我正在寻找一种方法来删除机器人通过“自动”创建的频道

我在下面提供我的代码。

如果您有任何机会知道如何使用discord.js删除语音频道。

先感谢您!诚挚

ticket.js

close.js

const discord = require("discord.js");
const botconfig = require("../botconfig.json");

module.exports.run = async (bot, message, args) => {

    // Id van category van tickets.
    const categoryId = botconfig.ticketcategory;

    // Als bericht in ticket kanaal is dan verwijder kanaal ander zend bericht
    if (message.channel.parentID == categoryId) {

        message.channel.delete();

    } else {

        message.channel.send("Please do this command in a ticket channel.");

    }

    var embedCloseTicket = new discord.RichEmbed()
        .setTitle("Hello, " + message.channel.name)
        .setDescription("Your ticket is marked as **complete**. Do you want to make a new one then do !ticket")
        .setFooter("Ticket closed!");

    message.author.send(embedCloseTicket);

}

module.exports.help = {
    name: "close",
    aliases: ["ticketclose", "ticketsupportclose"]
}
回答如下:

您需要创建一个反应收集器。

//your code...
message.author.send(embedCloseTicket).then((msg) => {
msg.react("the emoji")
}).then(r => {
const filter = (reaction, user) => reaction.emoji.name === "emoji" && 
user.id === message.author.id;
//create the collector
const collectorForU = msg.createReactionCollector(filter, {time: 1000/*time 
in ms*/});
collectorForU.on("collect", r => {
msg.channel.delete()      
})
})

我没有尝试这个代码,但我认为它必须有效。

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论