Sapphire - Imagine a Framework

SIA

Sapphire - Imagine a Framework

Sapphire is a next-gen object-oriented Discord.js bot framework.

Join

sapphire-support

discordjs-support

old-sapphire-support

old-discordjs-support

old-application-commands-and-interactions

clean/sanitise strings

hey, quick question, is there a function in @sapphire/utilties that cleans strings from stuff likw ZWSs and other stuff?
Solution:
alright thank you

Prisma with Sapphire

Hello, im new to sapphire framework.. but i have question why it does not work? ``` import "dotenv/config"; import { container, SapphireClient } from "@sapphire/framework";...

Best way to learn sapphire

Hello, im comming from another framwork.. that is the best way to learn sapphire are there youtube tutorials or just the docs?
Solution:
docs yeah. there's some vids but they're not official so idk how their quality is

registerApplicationCommands Naming Convention for ContextMenu Command

Hey there, I was just seeing if Sapphire makes the Name of the Command Lower Case when its a User Context Command as even when I put "Report User" in the name of the command it comes through as "report user" When Discord Supports Spaces and Uppercase for User Context Commands ```js...
Solution:
Seems like it was a Discord Caching Issue, just had to remove the bot and re-add it.
No description

@sapphire/type error

```ts Error when loading '...\src\commands\developer\eval.ts': 17 | var publicField = (obj, key, value) => defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); 18 | var getFilename = /* @PURE / __name(() => fileURLToPath(import.meta.url), "getFilename"); 19 | var getDirname = / @PURE / name(() => path.dirname(getFilename()), "getDirname"); 20 | var dirname = / @PURE */ getDirname();...

PreMessageCommandRun help

This is my pre event: ```ts import { config } from '@/config.ts'; import { ApplyOptions } from '@sapphire/decorators'; import { Events, Listener, PreMessageCommandRunPayload, UserError } from '@sapphire/framework';...
Solution:
No description

preconditions

can i use preconditions in interaction handlers?

why does sapphire not load my typescript command files with deno?

I want to use deno but sapphire wont recognise my .ts files in the commands directory. how do i fix this?

Method to Prevent Commands Stores loads subfolders

Hello, is there anyway to prevent a the commands store to load other subfolders like these prefix subfolder?
Solution:
Prefix the files with _
No description

Event from other bot

Hi everyone I have two bots running on SapphireJS. From bot B, I want to emit a custom event to bot A using client.emit(). I saw your documentation here: https://sapphirejs.dev/docs/Guide/listeners/listening-to-events-emitted-by-other-emitters ...

disable sync on every launch

how to disable the sync that happens on every launch?

Slash Command doesn't register or working

so apparently i'm trying sapphire framework for discordjs, i've follow the documentation but this code somehow doesn't register the slash command even message command isn't working, does anyone have solution for it?
Solution:
nevermind, i'd forgot to set the main in package.json to src/main.ts (which like index.ts), thanks for the help tough
No description

Pass data from Precondition to ChatInputCommand

Hi all. I am using Sapphire to handle my commands, and I have a precondition that checks if a guild has config related to it in the DB, and creates it if not, and I was wondering if there was any way for me to hold that data in the interaction/context. I tried to attach it to context ```ts public override async chatInputRun( interaction: CommandInteraction, _command: ChatInputCommand, context: PreconditionContext,)...
Solution:
there is no built in way to pass data, but you can use anything that's in JavaScript by default such as using a keyed map, object, array, database, etc

Context Command function not called, but Discord says bot is unresponsive

Hello! Apologies if I file this in the wrong location, but I'm quite unsure about what's broken within the code. But first, the code https://pastebin.com/QP7165k0. As the image shows, it aint responding, but other, regular slash commands work. I might be tripping, or skill issue but I am now stumped....
Solution:
Preconditions does not work on context commands and will break without sending an error. Make sure to not use a precondition on context commands
No description

i18n applyLocalizedBuilder

Hello, i have some problems with i18n. I am currently trying to localize slash commands, but i can't get it to work. My code is: ```ts registry.registerChatInputCommand((builder) =>...
No description

Can I create or change commands folder location?

Hello I kinda wanted to know if it's possible to change the commands file locations, like instead being in ./src/commands/ping.js, to be in ./src/commands/information/ping.js or ./src/plugins/information/commands/ping.js

interaction handlers with preconditions

Is it anyhow possible to make my own version of preconditions (or just extend sapphire's somehow) and add preconditions to it
Solution:
you'll have to overwrite the core listeners but other than that it's just a matter of adding code

precondition error logging in console

hey, when my precondition errors, its logged to console and i don't understand how to stop it?
Solution:
damn i just realized i had console.log in node_modules when i was testing something
Next