Ahmad A.
Explore posts from serversSIASapphire - Imagine a framework
•Created by Ahmad A. on 4/1/2024 in #sapphire-support
WIll this work?
public override registerApplicationCommands(registry: Command.Registry) {
registry.registerChatInputCommand(command => command.setName("ping").setDescription("Pong!"), {
idHints: [`${this.container.client.id}`],
});
}
public override registerApplicationCommands(registry: Command.Registry) {
registry.registerChatInputCommand(command => command.setName("ping").setDescription("Pong!"), {
idHints: [`${this.container.client.id}`],
});
}
3 replies
SIASapphire - Imagine a framework
•Created by Ahmad A. on 3/29/2024 in #sapphire-support
Button doing nothing
const button = new ButtonBuilder()
.setCustomId("COB")
.setLabel("Custom Options")
.setEmoji("⚙️")
.setStyle(ButtonStyle.Secondary);
const button = new ButtonBuilder()
.setCustomId("COB")
.setLabel("Custom Options")
.setEmoji("⚙️")
.setStyle(ButtonStyle.Secondary);
import { InteractionHandler, InteractionHandlerTypes } from "@sapphire/framework";
import type { ButtonInteraction } from "discord.js";
export class ButtonHandler extends InteractionHandler {
public constructor(ctx: InteractionHandler.LoaderContext, options: InteractionHandler.Options) {
super(ctx, {
...options,
interactionHandlerType: InteractionHandlerTypes.Button,
});
}
public override parse(interaction: ButtonInteraction) {
if (interaction.customId !== "COB") return this.none();
return this.some();
}
public async run(interaction: ButtonInteraction) {
await interaction.reply({
content: "Hello from a button interaction handler!",
ephemeral: true,
});
await interaction.channel?.send("Hi");
}
}
import { InteractionHandler, InteractionHandlerTypes } from "@sapphire/framework";
import type { ButtonInteraction } from "discord.js";
export class ButtonHandler extends InteractionHandler {
public constructor(ctx: InteractionHandler.LoaderContext, options: InteractionHandler.Options) {
super(ctx, {
...options,
interactionHandlerType: InteractionHandlerTypes.Button,
});
}
public override parse(interaction: ButtonInteraction) {
if (interaction.customId !== "COB") return this.none();
return this.some();
}
public async run(interaction: ButtonInteraction) {
await interaction.reply({
content: "Hello from a button interaction handler!",
ephemeral: true,
});
await interaction.channel?.send("Hi");
}
}
13 replies