sapphire-support
discordjs-support
old-sapphire-support
old-discordjs-support
old-application-commands-and-interactions
Working with Emoji's on SelectMenu Options
.setEmoji to set an emoji
https://discord.js.org/docs/packages/builders/1.7.0/StringSelectMenuOptionBuilder:Class#setEmoji...
Sapphire with TypeScript & Bun
Cant get bot to work when put bot related files to another folder in src
main to dist/index.js in package.json OR override the automatically resolved folder by setting baseUserDirectory in the client options
Nested Router with @sapphire/plugin-api
routes/servers/server.ts with a route option in the constructor of servers/:serverId
routes/servers/server/config.ts with a route option in the constructor of servers/:serverId/config
example: https://github.com/skyra-project/skyra/blob/main/src/routes/guilds...Extending Listener base class
run handler is invoked. Ideally I'd like to shim it somehow so existing listeners still just implement run so removing or adding more shims like this is easily possible without renaming methods implemented in the listener itself.What's the point of having a "container" object exported which consists of client and other stuff?
container which consists of client, stores, etc. But how is that better than just exporting client and stores directly? For example, instead of using this.container.client in command classes, why is not better to just use this.client?this.container (or container for that matter) is an object that can be extended by plugins and bots. In base @sapphire/pieces it's an object with only the PieceStore, but @sapphire/framework augments it by adding client: SapphireClient in the same way as plugin register their augmentations.
For example, if you use @sapphire/plugin-api, you'd have access to container.api. In fact, some plugins do not require discord.js or even Sapphire due to this system, which allows some projects to be library and/or framework agnostic. Another advantage to this approach is that we do not pollute the discord.js Client class with a lot of properties.
For example in my bot, I have a lot of properties:...Listeners and Index.js
Stricter type checking for string command choices
value choices in addChoices have the PresenceStatusData type in case the string values are changed in a future API....WIll this work?
``ts
public override registerApplicationCommands(registry: Command.Registry) {
registry.registerChatInputCommand(command => command.setName("ping").setDescription("Pong!"), {
idHints: [${this.container.client.id}`],
});...Accessing data in subcommands
Issue with inviteCreate event
inviteCreate event where it won't fire unless the invite created has some sort of uses limit. is this intended?Should i acquire every command or only once
no error event on subcommand precondition
apply precondition to only one Subcommand?
Ready event does not run
Listeners folderError when clicking button
Prevent commands from being ran on DMs and prevent bots from using commands by default
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);
interaction-handlers: https://sapphirejs.dev/docs/Guide/interaction-handlers/what-are-theyInteractionOptionResolver pleasing TypeScript
@discordjs/core/http-only. Currently, I have my own class for resolving application command options, however I'd like to use the one provided by @sapphire/discord-utilities. The only setback I'm having is passing the interaction to a new instance of InteractionOptionResolver. Its constructor is typed as
constructor(interaction: APIApplicationCommandInteraction | APIApplicationCommandAutocompleteInteraction | APIModalSubmitInteraction)
constructor(interaction: APIApplicationCommandInteraction | APIApplicationCommandAutocompleteInteraction | APIModalSubmitInteraction)
APIApplicationCommandInteraction which I thought would work given its type definition includes it, I get a nasty error of it missing a target_id, which I know stems from context menu command-related stuff. I get similar missing property errors with APIContextMenuInteraction or APIChatInputApplicationCommandInteraction - yada yada missing users property or just not assignable at all. My question is, before I go casting or @ts-ignoreing or whatnot, is there any realistic way to resolve these errors so I can use this utility class in TypeScript? Am I missing some simple step? Is this just TypeScript limitations?
Node: v18.17.0...
Javascript