oriel beck
oriel beck
SIASapphire - Imagine a framework
Created by oriel beck on 5/20/2024 in #sapphire-support
Validation error
What can cause this error on button click? It's this specific button (dailyneko-modal), nothing else causes this. dailyneko-cancel works. Components creator:
const components = [
new ActionRowBuilder<ButtonBuilder>()
.addComponents(
new ButtonBuilder()
.setCustomId("dailyneko-modal")
.setLabel("Open Modal")
.setStyle(ButtonStyle.Primary),
new ButtonBuilder()
.setCustomId("dailyneko-done")
.setLabel("Done")
.setStyle(allDone ? ButtonStyle.Success : ButtonStyle.Secondary)
.setDisabled(!allDone),
new ButtonBuilder()
.setCustomId("dailyneko-cancel")
.setLabel("Cancel")
.setStyle(ButtonStyle.Danger)
)
]
const components = [
new ActionRowBuilder<ButtonBuilder>()
.addComponents(
new ButtonBuilder()
.setCustomId("dailyneko-modal")
.setLabel("Open Modal")
.setStyle(ButtonStyle.Primary),
new ButtonBuilder()
.setCustomId("dailyneko-done")
.setLabel("Done")
.setStyle(allDone ? ButtonStyle.Success : ButtonStyle.Secondary)
.setDisabled(!allDone),
new ButtonBuilder()
.setCustomId("dailyneko-cancel")
.setLabel("Cancel")
.setStyle(ButtonStyle.Danger)
)
]
Button handler:
@ApplyOptions<InteractionHandler.Options>({
interactionHandlerType: InteractionHandlerTypes.Button
})
export class DailyNekoButtonsHandler extends InteractionHandler {
public parse(interaction: ButtonInteraction): Option<void> {
return interaction.customId.startsWith("dailyneko") ? this.some() : this.none();
}

public async run(interaction: ButtonInteraction) {
const task = interaction.customId.split("-").at(1)!;

const data = interaction.message.embeds[0].data;
let artist_name = data.fields![0].value!;
artist_name = artist_name === "N/A" ? "" : artist_name;

let artist_url = data.fields![1].value!;
artist_url = artist_url === "N/A" ? "" : artist_url;

let source_url = data.fields![2].value!;
source_url = source_url === "N/A" ? "" : source_url;

let neko_url = data.fields![3].value!;
neko_url = neko_url === "N/A" ? "" : neko_url;

switch (task) {
case "modal":
interaction.showModal(dailyNekoModal(artist_name, artist_url, source_url, neko_url));
break
case "done":
await interaction.deferReply();
const channel = interaction.guild?.channels.cache.get(this.container.config.config.channels.daily_neko) as TextBasedChannel;
await sendDailyneko(webhook, channel, artist_name, artist_url, source_url, neko_url);
interaction.message.edit({
components: [],
content: "Sent daily neko."
});
break;
case "cancel":
interaction.update({
components: [],
content: "Cancelled."
})
break;
}
}
}
@ApplyOptions<InteractionHandler.Options>({
interactionHandlerType: InteractionHandlerTypes.Button
})
export class DailyNekoButtonsHandler extends InteractionHandler {
public parse(interaction: ButtonInteraction): Option<void> {
return interaction.customId.startsWith("dailyneko") ? this.some() : this.none();
}

public async run(interaction: ButtonInteraction) {
const task = interaction.customId.split("-").at(1)!;

const data = interaction.message.embeds[0].data;
let artist_name = data.fields![0].value!;
artist_name = artist_name === "N/A" ? "" : artist_name;

let artist_url = data.fields![1].value!;
artist_url = artist_url === "N/A" ? "" : artist_url;

let source_url = data.fields![2].value!;
source_url = source_url === "N/A" ? "" : source_url;

let neko_url = data.fields![3].value!;
neko_url = neko_url === "N/A" ? "" : neko_url;

switch (task) {
case "modal":
interaction.showModal(dailyNekoModal(artist_name, artist_url, source_url, neko_url));
break
case "done":
await interaction.deferReply();
const channel = interaction.guild?.channels.cache.get(this.container.config.config.channels.daily_neko) as TextBasedChannel;
await sendDailyneko(webhook, channel, artist_name, artist_url, source_url, neko_url);
interaction.message.edit({
components: [],
content: "Sent daily neko."
});
break;
case "cancel":
interaction.update({
components: [],
content: "Cancelled."
})
break;
}
}
}
7 replies
SIASapphire - Imagine a framework
Created by oriel beck on 7/19/2023 in #sapphire-support
Running commands manually
Is there a way to run commands manually, without a message/interaction making Sapphire do it?
12 replies
SIASapphire - Imagine a framework
Created by oriel beck on 7/3/2023 in #sapphire-support
Error listeners
38 replies
SIASapphire - Imagine a framework
Created by oriel beck on 5/11/2023 in #sapphire-support
Select menu interaction handler not working
I have a select menu interaction handler which never actually get the interaction, I added a console log in the parse function and it wasn't triggered either, ideas? File: https://github.com/oriel-beck/application-bot/blob/v4/src/interaction-handlers/apply/select.ts
4 replies
SIASapphire - Imagine a framework
Created by oriel beck on 5/1/2023 in #sapphire-support
Bot does not respond
40 replies
SIASapphire - Imagine a framework
Created by oriel beck on 4/19/2023 in #sapphire-support
Errors when extending @sapphire/ts-config
13 replies