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

javascript - Discord.js | Buttons doesn't work after bot restarts - Stack Overflow

programmeradmin0浏览0评论

The buttons work after doing the mand but after restarting the bot and pressing the button, it says interaction failed Here's my ticket.js

const { MessageButton } = require('discord-buttons');

module.exports = {
    name: 'ticket-setup',
    aliases: ['close'],
    category: 'Miscellaneous',
    description: 'Makes a ticket embed',
    async execute(message, args, cmd, client, Discord){

        if(!message.member.permissions.has("MANAGE_CHANNELS")) return message.reply("Normies can't do this mand")

        if (cmd == 'close') {
            if (!message.channel.name.includes('ticket-')) return message.channel.send('You cannot use that here!');
            message.channel.delete();
           }
       
        let title;
        let desc;
        let ticketMsg;

        const filter = msg => msg.author.id == message.author.id;
        let options = {
            max: 1
        };
    
        message.channel.send("What will the ticket title be?\nSay cancel to cancel")
        let col = await message.channel.awaitMessages(filter, options)
        if(col.first().content == 'cancel') return message.channel.send("Cancelled");
        title = col.first().content
    
        message.channel.send('What will the description be?\nSay cancel to cancel')
        let col2 = await message.channel.awaitMessages(filter, options)
        if(col2.first().content == 'cancel') return message.channel.send("Cancelled");
        desc = col2.first().content
        
        message.channel.send('What is the message that the user will see when they make a ticket?\nSay cancel to cancel')
        let col3 = await message.channel.awaitMessages(filter, options)
        if(col3.first().content == 'cancel') return message.channel.send("Cancelled");
        ticketMsg = col3.first().content

        const setupEmbed =  new Discord.MessageEmbed()
        .setTitle(title)
        .setDescription(desc)
        .setFooter(message.guild.name, message.guild.iconURL({ dynamic: true }))
        .setColor('00f8ff')

        const hiEmbed = new Discord.MessageEmbed()
        .addField(ticketMsg, "\n\nDo a.close or press the button to close the ticket")
        .setColor("RANDOM")
        .setTimestamp()
        
        const createTicketButton = new MessageButton()
        .setID("ticketCreate")
        .setStyle("blurple")
        .setLabel("
发布评论

评论列表(0)

  1. 暂无评论