ItsPinion
ItsPinion
DIAdiscord.js - Imagine an app
Created by ItsPinion on 3/29/2024 in #djs-questions
Type error in Button Builder
module.exports = {
setup: (client: Client) => {
client.on(Events.InteractionCreate, async (interaction) => {
if (!interaction.isModalSubmit() || interaction.customId !== "storyModal")
return;

await interaction.deferReply();

const serverID = interaction.guild?.id || "DM";
const userID = interaction.user.id;
const storyID = serverID + userID;

const alreadyExist = await getWelcomeInfoByStoryID(storyID);
if (alreadyExist[0]) {
await interaction.editReply({
content: "You already have a running story!",
});

return;
}

const storyTitle = interaction.fields.getTextInputValue("storyTitle");
const story = interaction.fields.getTextInputValue("story");

await createStory(storyID, storyTitle, userID, Date.now());


const Colab = new ButtonBuilder()
.setCustomId("colab")
.setLabel("Add Story")
.setStyle(ButtonStyle.Primary);

const remove = new ButtonBuilder()
.setCustomId("remove")
.setLabel("Remove Story")
.setStyle(ButtonStyle.Danger);

const end = new ButtonBuilder()
.setCustomId("end")
.setLabel("End Story")
.setStyle(ButtonStyle.Success);

const row = new ActionRowBuilder().addComponents(Colab, end, remove);

await interaction.editReply({
content: "Your submission was received successfully!",
components: [row],
}); ^^^
});
},
};
module.exports = {
setup: (client: Client) => {
client.on(Events.InteractionCreate, async (interaction) => {
if (!interaction.isModalSubmit() || interaction.customId !== "storyModal")
return;

await interaction.deferReply();

const serverID = interaction.guild?.id || "DM";
const userID = interaction.user.id;
const storyID = serverID + userID;

const alreadyExist = await getWelcomeInfoByStoryID(storyID);
if (alreadyExist[0]) {
await interaction.editReply({
content: "You already have a running story!",
});

return;
}

const storyTitle = interaction.fields.getTextInputValue("storyTitle");
const story = interaction.fields.getTextInputValue("story");

await createStory(storyID, storyTitle, userID, Date.now());


const Colab = new ButtonBuilder()
.setCustomId("colab")
.setLabel("Add Story")
.setStyle(ButtonStyle.Primary);

const remove = new ButtonBuilder()
.setCustomId("remove")
.setLabel("Remove Story")
.setStyle(ButtonStyle.Danger);

const end = new ButtonBuilder()
.setCustomId("end")
.setLabel("End Story")
.setStyle(ButtonStyle.Success);

const row = new ActionRowBuilder().addComponents(Colab, end, remove);

await interaction.editReply({
content: "Your submission was received successfully!",
components: [row],
}); ^^^
});
},
};
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>'.ts(2322)
index.d.ts(283, 3): 'type' is declared here.
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>'.ts(2322)
index.d.ts(283, 3): 'type' is declared here.
14 replies