sapphire-support
discordjs-support
old-sapphire-support
old-discordjs-support
old-application-commands-and-interactions
create a command that has spaces as one arg
!command <argwithspaces1> <argwithspaces2>
, or even using seperators like |
i just dont know where to start or if its even possible at all ( i tried using args.repeat and args.nextMaybe but that didnt work at all )...Share sapphire stuff with multiple bots & possible monorepo setup
Splitting Subcommand functions to multiple files
messageRun
chatInputRun
entries so I could split the Subcommands into their own files/classes as the main command file is roughly 2.5k lines at the moment.
I know I could just have each method inside of the class then call the other classes/files inside of it (which is what I'm currently doing), just wanted to see if there was a cleaner way.
Is this possible?...Commands and listeners
Create a catch-all command to respond to any message?
@mention
the bot with a query: @bot translate x to y
. The Command class from what I gather will only trigger based on the name and the aliases? Makes sense, just wondering if there is a way to maybe fall-back if the bot is pinged and does not match a command, could there be a "default" command?
edit:...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...![No description](https://cdn.answeroverflow.com/1226257553701343252/image.png)
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![No description](https://cdn.answeroverflow.com/1225879057950838955/image.png)
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
folder