XandoR
XandoR
Explore posts from servers
DTDrizzle Team
Created by XandoR on 1/19/2024 in #help
Difference between query modes
Heyo everyone ! 👋 Is there anyway I can get same result than result1 query using result2 syntax with db.select() ?
const result1 = await db.query.notifications.findMany({
where: eq(notifications.guild_id, interaction.guildId),
with: {
group: true,
},
});

const result2 = await db
.select()
.from(notifications)
.limit(1)
.where(eq(notifications.guild_id, interaction.guildId))
.innerJoin(groups, eq(notifications.group_id, groups._id))
.execute();
const result1 = await db.query.notifications.findMany({
where: eq(notifications.guild_id, interaction.guildId),
with: {
group: true,
},
});

const result2 = await db
.select()
.from(notifications)
.limit(1)
.where(eq(notifications.guild_id, interaction.guildId))
.innerJoin(groups, eq(notifications.group_id, groups._id))
.execute();
Or should I keep using db.query if I want to retrieve notifications with group inside of it ?
4 replies
DIAdiscord.js - Imagine a boo! 👻
Created by XandoR on 11/22/2023 in #djs-questions
Select Menu error with Typescript
const select = new StringSelectMenuBuilder()
.setCustomId("year")
.setPlaceholder("Année scolaire")
.addOptions(
SupportedYears.map((year) =>
new StringSelectMenuOptionBuilder().setLabel(year).setValue(year)
)
);

const actionRow = new ActionRowBuilder().addComponents(select);

await interaction.reply({
content: "Select year",
components: [actionRow],
});
const select = new StringSelectMenuBuilder()
.setCustomId("year")
.setPlaceholder("Année scolaire")
.addOptions(
SupportedYears.map((year) =>
new StringSelectMenuOptionBuilder().setLabel(year).setValue(year)
)
);

const actionRow = new ActionRowBuilder().addComponents(select);

await interaction.reply({
content: "Select year",
components: [actionRow],
});
While trying to add a select menu to my discordjs slash command interaction ( type ChatInputCommandInteraction ), it says that : No overhead corresponds to this call. The 1 of 2 overload, '(options: InteractionReplyOptions & { fetchReply: true; }): Promise<Message<boolean>>', produced the following error. Unable to assign type 'ActionRowBuilder<AnyComponentBuilder>' to type 'APIActionRowComponent<APIMessageActionRowComponent> | JSONEncodable<APIActionRowComponent<APIMessageActionRowComponent>> | ActionRowData<...>'. The 'type' property is absent in the 'ActionRowBuilder<AnyComponentBuilder>' type but required in the 'ActionRowData<MessageActionRowComponentData | MessageActionRowComponentBuilder>'. The 2 of 2 overload, '(options: string | InteractionReplyOptions | MessagePayload): Promise<InteractionResponse<boolean>>', produced the following error. Unable to assign type 'ActionRowBuilder<AnyComponentBuilder>' to type 'APIActionRowComponent<APIMessageActionRowComponent> | JSONEncodable<APIActionRowComponent<APIMessageActionRowComponent>> | ActionRowData<...>'.ts(2769) Any idea why I have this error ?
4 replies