Sapphire - Imagine a framework

SIA

Sapphire - Imagine a framework

Welcome to the Sapphire Discord server! The next-gen object-oriented Discord.js bot framework can be found here.

Join

sapphire-support

discordjs-support

old-sapphire-support

old-discordjs-support

old-application-commands-and-interactions

error TS5109: Option 'moduleResolution' must be set to 'Node16'

I come accross this framework and wanted to try out, found out i cant :D Thats aside, here are some info: After i added that to tsconfig.json, it cant compile with error: error TS1287: A top-level 'export' modifier cannot be used on value declarations in a CommonJS module when 'verbatimModuleSyntax' is enabled....

Broken TypeScript command (from lack of knowledge of TS)

I'm attempting to create a command following the Sapphire wiki, but it seems that I can't get the command to work at all. Note: I am very new to Typescript, I am not familiar with the syntax or the proper form to do stuff, please be gentle ```ts...
Solution:
My advice Baylem, use @sapphire/cli to generate a bot

@sapphire/discord.js-utilities - isPrivateThreadChannel

Could I query about the return type from the isPrivateThreadChannel. Shouldn't that type-guard instead of being ThreadChannel be PrivateThreadChannel ```typescript import { container } from '@sapphire/framework' import type { PrivateThreadChannel, Snowflake } from 'discord.js'...

Custom Error Event

So I know, I can use UserError to throw an error if the user did something wrong. But what to throw if something unexpected happend, like a 500 to my own api. I thought maybe the normal Error but it isn't handled by the ChatInputCommandError Event. I want the user to get a error message in chat, so I need to use the interaction....

"There are no more arguments." using args.pick('integer')

In this particular case I am trying to check if there is any argument after the command (while my method does work) I get an error saying "there are no more arguments" on value ```js let value = await args.pick('integer').catch((err) => console.log('Volume ::', err.message)); ...

Blacklist Command

I made a command where it adds the user id of the provided user to a db, I wanted to know if there is a feature in Sapphire where it will prevent users from running commands if a certain condition is met so I can implement something like this, I first thought of adding a check in every precondition but im guessing there is a way better way to do this

Precondition issue

. I have this code, but for some reason it deletes the message even if the member has any of the roles in the array...

messageCreate issue

```js const { Listener } = require("@sapphire/framework"); class messageCreateListener extends Listener { constructor(context, options) {...

Listeners question

Will listeners work even if I put them inside of a folder inside the listener folder so it's more organized?

"Maximum number of application commands reached" but hitting the API returns an empty array?

I realized I was setting up global commands when developing my bot and have recently switched to using guild commands instead. However, when I run my bot locally I get an error message along these lines: Failed to overwrite global application commands DiscordAPIError[30032]: Maximum number of application commands reached (5). So I went through the process of deleting all the global application commands by hitting /applications/{application.id}/commands and copying down the ids of each command, then hitting /applications/{application.id}/commands/{command.id}. However, I'm still seeing the "Failed to overwrite global application commands" message when starting my bot. I double-checked /applications/{application.id}/commands and it's returning an empty array so I don't have any global application commands according to the API, and I know that I don't have 5 context menu commands (I counted them, it's 3 actually) so I'm not sure what exactly it's complaining about? I've attached guildIds options to each of my commands so I feel like that can't be the issue? I feel like I'm missing something but I'm not sure what it could be....

Post examples

Hi, sorry if this isn't the correct place to ask this question but I am getting zero results (that I can understand) to answer my query. Is there a library somewhere with other peoples posts that we can copy and use ourselves?

Loader Error

Just why i am getting this ?
No description

How do I check if the user ID is actually equals to the user ID in interaction-handlers

Is there a way to check if the user ID that clicked the button is equals to the user that ran the command? For example: if (interaction.user.id !== <command_user>.user.id)

Button handler is not calling parse method

I have a button, it was working but it stopped for some reason on @sapphire/[email protected] Code ```ts @ApplyOptions<InteractionHandler.Options>({...

Did the latest @sapphire/[email protected] update break things?

Super preliminary stuff because I haven't bothered to debug it thoroughly; It seems like the plugin doesn't import in my logs after running pnpm update. The typings for the i18n entry in SapphireClient also disappeared. Reverting to 5.0.4 seems to fix the issue. Has anyone else encountered this?...

Spaced options with @sapphire/lexure

How do I get options that contains space? I tried add the options with quotes, but it doesn't work. Detailed code: https://runkit.com/zenshibata/sapphire-lexure-test

subcommand name

is there a way to get the name of the subcommand ran?
Solution:
Should be the same? As long as you have access to the interaction object

Registries behaviour

Can I override registries behaviour and register commands only in one guild? im moving from custom handler and don't want get guildId in every command

Async Preconditions

Helloo! It seems that I am unable to create a precondition that is async, whenever I try to write one with async. I get The inferred type of 'chatInputRun' cannot be named without a reference to '.pnpm/@[email protected]/node_modules/@sapphire/result'. This is likely not portable. A type annotation is necessary. Here is the code in question: ```ts public override async chatInputRun(interaction: Interaction) {...