discordjs v14 按钮交互失败

问题描述 投票:0回答:0

我尝试创建一个不和谐的建议命令,但它失败了,点击这里是代码

        // Add event listeners for the collector
        collector.on('collect', async buttonInteraction => {
            if (buttonInteraction.customId === 'upvote_button') {
                upvotes++;
                upvoteButton.setLabel(`👍 ${upvotes}`)
            } else if (buttonInteraction.customId === 'downvote_button') {
                downvotes++;
                downvoteButton.setLabel(`👎 ${downvotes}`)
            }

            // Edit the original message to update the vote counts and disable the button that was clicked
            embed.fields[0].value = `👍 ${upvotes}`;
            embed.fields[1].value = `👎 ${downvotes}`;
            await buttonInteraction.edit({ embeds: [embed], components: [actionRow] });
        });
javascript discord discord.js
© www.soinside.com 2019 - 2024. All rights reserved.