Discord.js 互动不会更新
Discord.js interaction won't update
我有一条包含 3 个按钮的消息,我想在单击它们后禁用所有 3 个按钮。
handle: async function(interaction) {
interaction.deferUpdate();
let components = interaction.message.components[0].components.forEach(c => {
c.setDisabled(true)
})
await interaction.message.edit({embeds: interaction.message.embeds, components: components})
// Do some other stuff
}
I have tried it with
interaction.update()
and multiple other ways but i can't get it to work.
在您使用 .deferReply()
or .deferUpdate()
you need to use .editReply()
推迟回复后
collector.on('collect', async i => {
if (i.customId === 'primary') {
await i.deferUpdate();
await wait(4000);
await i.editReply({ content: 'A button was clicked!', components: [] });
}
});
我有一条包含 3 个按钮的消息,我想在单击它们后禁用所有 3 个按钮。
handle: async function(interaction) {
interaction.deferUpdate();
let components = interaction.message.components[0].components.forEach(c => {
c.setDisabled(true)
})
await interaction.message.edit({embeds: interaction.message.embeds, components: components})
// Do some other stuff
}
I have tried it with
interaction.update()
and multiple other ways but i can't get it to work.
在您使用 .deferReply()
or .deferUpdate()
you need to use .editReply()
collector.on('collect', async i => {
if (i.customId === 'primary') {
await i.deferUpdate();
await wait(4000);
await i.editReply({ content: 'A button was clicked!', components: [] });
}
});