我在我的index.js
中写了这个,当一个按钮被按下时回复,然后禁用它。
client.on("interactionCreate", async (interaction) => {
if (interaction.isButton()) {
if (interaction.customId === "yes") {
const owner_role = await db.get(`Owner-${interaction.guild.id}`);
if (!owner_role) {
return interaction.reply({ content: `:no: The server's owner haven't set up the bot yet. Please contact them.`, ephemeral: true })
};
if (!interaction.member.roles.cache.has(owner_role)) {
return interaction.reply({ content: ":no: You don't have permission to use this command.", ephemeral: true })
};
interaction.reply(`This suggestion has been approved by ${interaction.user}.`)
// Disable the button
}
我唯一不知道的是,我如何禁用按钮。
有人能帮帮忙吗?
1条答案
按热度按时间j13ufse21#
您可以使用新的
MessageButton
创建新的MessageActionRow
,并使用setDisabled(true)
禁用它