sapphire-support
discordjs-support
old-sapphire-support
old-discordjs-support
old-application-commands-and-interactions
Export Commands and Parameters
This is only loosely related to Sapphire, but I was wondering if there is an easy way to export a CSV or something that has the commands and parameters in it for documentation purposes. I have roughly a hundred commands and have never gotten around to doing any documentation, but I’m finding the need to write docs for them now. Is there an easy way to do this or does anyone have any ideas on how to best do it?
Solution:
Use
this.container.stores.get('commands')
to get a Map<string, Command>
which can be turned into a Command[]
then use a JSON to CSV converter library (or parse it out yourself)Error
node:internal/modules/cjs/loader:1148
throw err;
^
Error: Cannot find module './lib/arrayStrictEquals.mjs'...
Cannot find how I can use buttons
I want to create a message with some buttons for people to click on and recieve some messages something like what it is in the attached image.
What I cannot figure out is how do I use it. I tried to read the documentation and I'm pretty sure im missing a big gotcha
https://sapphirejs.dev/docs/Guide/interaction-handlers/buttons...
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:...main bot spawn child bot?
Hey guys,
I want my discord bot to spawn another discord bot via a listener “child process”, does sapphire support anything like this or maybe even djs itself? Thanks so much 🙏...
I want my discord bot to spawn another discord bot via a listener “child process”, does sapphire support anything like this or maybe even djs itself? Thanks so much 🙏...
Solution:
Sapphire is just a framework on top of discord.js so no, what you're trying to do requires some extra steps which neither sapphire or discord.js do for you. You have to write the logic for spawning the child bot yourself.
baseUserDirectory with tsx
How do I use
baseUserDirectory
with tsx? Seems that it doesn't load the ts files relatives to main ts source codeslashcommand wont appear
Tried to implement slash command but it wont show up. The bot is invited with the bot and application.commands scope and it still wont work.
ping.js
```javascript
const { Command } = require('@sapphire/framework');...
Command Modules
does sapphire have a command modules feature where commands can be grouped into modules that can be disabled or enabled on a per-guild basis?
Can I create a simple get endpoint along with my sapphire app that's hosted wherever?
If yes, how can I do so?
help needed
ializing...
[ERROR] Encountered error while handling the command application command registry for command "ban" at path "/home/runner/bot/commands/ban.js" TypeError: Cannot read properties of undefined (reading 'FLAGS')
at /home/runner/bot/commands/ban.js:27:46
at Object.normalizeChatInputCommand (/home/runner/bot/node_modules/@sapphire/framework/dist/cjs/lib/utils/application-commands/normalizeInputs.cjs:30:5)
at _ApplicationCommandRegistry.registerChatInputCommand (/home/runner/bot/node_modules/@sapphire/framework/dist/cjs/lib/utils/application-commands/ApplicationCommandRegistry.cjs:65:43)...
Solution:
alright
How to use preconditions properly?
Hi, im a new at sapphire and didn't know much about it, also i was reading the Docs that how to use Preconditions and how to handle failure on it.
The question is, i was following the same thing at the docs but there is nothing show when i console.log it, im using ESM JavaScript not TypeScript. also, can someone explain how does Preconditions work? and what make it triggered on Listener event?...
Problem with extended SapphireClient
Hi there I'm trying to extend the
SapphireClient
to add some custom property. Here's all what I got already:
```ts
import { SapphireClient } from "@sapphire/framework";
import { container } from "@sapphire/pieces";
import type { ClientOptions } from "discord.js";...Solution:
Welp fixed, it seems that the options were overrided by the public keyword
Sapphire stops working when deployed to Heroku
The client still logs in but none of the commands are registered. I'm not familiar enough with sapphire to debug this myself, could someone suggest how I can debug the problem?
Custom slash commands registration
Infos: https://discord.com/channels/737141877803057244/737142209639350343/1240606406290178078µ
Hey, so im doing this to create some custom slash commands.
So the question is, does sapphire, have kind of collection or something i can add the command to it? so it don't get removed...
Solution:
Only if you use bulk overwrite

Sapphire "no such file or directory" error
I know I like to only have weird bugs, but this is a new level even for me. Updating
@sentry/node
from ^7.114.0
to ^8.0.0
causes the following error in Sapphire on startup (not just for messageUpdate, for loads of other files as well):
```bash
Error when loading '/app/dist/listeners/messageUpdate.js': [Error: ENOENT: no such file or directory, open '/app/node_modules/@sapphire/framework/dist/esm/@sapphire/result'] {
errno: -2,
code: 'ENOENT',...trouble importing @sapphire/type
Hi, I'm trying to make an eval command and I'm importing @sapphire/type. There are no errors in the code, but when I run my bot I'm getting this error:
...
Error when loading '/Users/gww/bot/src/commands/Owner/eval.ts': error: Cannot find module "/Users/gww/bot/node_modules/@sapphire/type/prebuild/type-node-v115-darwin-arm64-unknown-unknown/type.node" from "/Users/gww/bot/node_modules/@sapphire/type/dist/esm/index.mjs"
Error when loading '/Users/gww/bot/src/commands/Owner/eval.ts': error: Cannot find module "/Users/gww/bot/node_modules/@sapphire/type/prebuild/type-node-v115-darwin-arm64-unknown-unknown/type.node" from "/Users/gww/bot/node_modules/@sapphire/type/dist/esm/index.mjs"
Autocomplete - option.match is not a function
Trying to use auto complete. Getting a weird error:
```2024-05-15 03:28:54 - ERROR - Encountered error on event listener "CorePossibleAutocompleteInteraction" for event "possibleAutocompleteInteraction" at path "::virtual::" TypeError: option.match is not a function
2024-05-15 03:28:54 - ERROR - at Object.ok (/home/phil/foc-bot/node_modules/@sapphire/framework/dist/cjs/lib/structures/InteractionHandlerStore.cjs:26:18)
2024-05-15 03:28:54 - ERROR - at _ResultOk.match (/home/phil/foc-bot/node_modules/@sapphire/result/dist/cjs/index.cjs:151:21)...
Solution:
Instead of returning filtered.map, wrap that in this.some just like how you return this.none
Sapphire Scheduled Tasks | When do they launch after bot restarts?
I have a task that disables all message components. But this fails to run after bot restarts and trying to run it
Logs:
```
2024-05-15 02:54:54 - INFO - @yume/sapphire-utilities registered successfully! // preInit...
Solution:
No. I mean don't call /register of the plugin and make a file similar to this and call it instead. You're already halfway there with your postLogin code. https://github.com/sapphiredev/plugins/blob/main/packages/scheduled-tasks/src/register.ts