Hello everyone,
@Handler()
@IsDiscordTeam()
async onAskQuestionImage(@InteractionEvent() interaction: CommandInteraction, @IA(SlashCommandPipe) options: QuestionImageDto): Promise<InteractionResponse<boolean>> {
try {
const channel = this.client.channels.cache.get(options.channel) as TextChannel;
const embed = new EmbedBuilder().setTitle("New Image Question").setDescription(options.text).setImage(options.image);
const confirm = new ButtonBuilder().setCustomId("confirm").setLabel("Confirm Ban").setStyle(ButtonStyle.Danger);
const cancel = new ButtonBuilder().setCustomId("cancel").setLabel("Cancel").setStyle(ButtonStyle.Secondary);
const row = new ActionRowBuilder().addComponents(cancel, confirm);
await channel.send({
embeds: [embed.toJSON()],
components: [row],
});
return interaction.reply({ content: "Question with buttons has been posted! ✅", ephemeral: true });
} catch (err) {
console.error("Error", err);
return interaction.reply({ content: "An error has occurred. ⚠️", ephemeral: true });
}
}
}
Error
src/discord-bot/commands/questions-image.ts:34:22 - error TS2322: Type 'ActionRowBuilder<AnyComponentBuilder>' is not assignable to type 'APIActionRowComponent<APIMessageActionRowComponent> | JSONEncodable<APIActionRowComponent<APIMessageActionRowComponent>> | ActionRowData<...>'.
Property 'type' is missing in type 'ActionRowBuilder<AnyComponentBuilder>' but required in type 'ActionRowData<MessageActionRowComponentBuilder | MessageActionRowComponentData>'.
34 components: [row],
~~~
../../node_modules/discord.js/typings/index.d.ts:268:3
268 type: ComponentType;
~~~~
'type' is declared here.
[09:37:00] Found 1 error. Watching for file changes.
I am unable to send the buttons.
Cna anyone help out? please