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

@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

client.application has a bunch of null values

Hi there, I'm very new to Sapphire so I've been going through the documentation/guide and am at the step to configure your own preconditions. Going off the example in the documentation where the bot owner id is grabbed from a configuration file. I'm trying to access mine through this.container.client.application.owner.id, however this.container.client.application has a bunch of null values. When I throw it all to my console, these are the results: ...
Solution:
Sounds like either your printing it before the bot fully connected to discord or your connection isn't working at all. Either way, this is a discordjs matter, not a sapphire matter.

default contexts and integrations

is there a way to set the default integration Types and contexts for ALL commands? all my commands are GuildInstall and Guild integration and contexts respectively and having to restate this in every command file is a bit annoying.

plugin usage

can we use sapphire plugins such as plugin-i18n without actually using sapphire?
Solution:
No

Commands don't trigger with newline starts

If a message is sent with a newline immediately after the command's name it won't be triggered. For example: ``` !say...
Solution:
No... I don't think this is gonna work. It goes pretty much against how we parse messages and commands. Might I recommend using Slash commands instead and showing the user a TextInput modal component which allows for multiline string input that way?...