js 13 discord按钮点击了一个

js 13 discord buttons clicked one

我正在给系统写工单。报告来到一个特殊的渠道。有一个“接受”按钮,它可以工作,但是当有多个报告到达时,如果您点击“接受”按钮,那么所有报告都会被接受

2 reports IMAGE

i clicked one IMAGE

client.on('interactionCreate', async interaction => {
                    if(interaction.isButton()) {
                        if (interaction.customId.includes(`acceptB`)) {
                             myacceptB.edit({embeds:[editEmbRep]})
                            interaction
                            let channelx =   interaction.guild.channels.cache.get(myreportChannel)
                            if(channelx){

                                  channelx.permissionOverwrites.edit(interaction.user.id,{ VIEW_CHANNEL: true,SEND_MESSAGES: true,ATTACH_FILES: true,READ_MESSAGE_HISTORY:true })}

可能每次都需要使用唯一的 idButton,但我不知道如何检查

此代码应仅编辑所点击按钮所附加的消息。编辑附加交互的消息时,无需为每个按钮提供唯一 ID。

client.on('interactionCreate', async interaction => {
    if(interaction.isButton()) {
        if (interaction.customId === `acceptB`) {
   
            const editEmbRep = new MessageEmbed()
                .setTitle('New Embed')
   
            interaction.message.edit({
                content: 'updated text', // to change the text
                embeds: [editEmbRep], // to change the embed
                components: [] // if you want to remove the button
            })
   
// Not sure what you are trying to do with this part so I didn’t do anything with it. 

            let channelx = interaction.guild.channels.cache.get(myreportChannel)
            if (channelx) {
                channelx.permissionOverwrites.edit(
                    interaction.user.id,
                    {
                        VIEW_CHANNEL: true,
                        SEND_MESSAGES: true,
                        ATTACH_FILES: true,
                        READ_MESSAGE_HISTORY:true
                    }
                )
            }
        }
    }
})