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

Using args functionality on another message

Hello, I want to use the Args.pickResult() function on another message. Is there any way I can do this? For example, making an args object for that message?

Unknown interaction with paginated message custom actions

Hi there, I'm using sapphire's paginated messages from @sapphire/discord.js-utilities. Before adding custom actions, a stop button worked fine. I recently set custom actions to: ```ts...

Interaction and Message Function Preconditions

Hey! Is it possible to create function preconditions for both interactions and messages under the same exported decorator? Or do I have create different exports for each of them? Alternatively, would I be able to create such function precondition that accepts both messages and interactions?...
Solution:
Sure, just make sure your function takes an argument that can be both types and determine which it is by using an instanceof check

preconditions don't run

I have a precondition (src/preconditions/Setup.ts) being used in a subcommand command (src/commands/setup.ts) and neither the command nor precondition run. I've added debug console.log's to both, and neither output whenever I use the command. I can provide a project .zip in DMs upon request....

Deleting Buttons

Hello, I have a chat input command which sends a confirmation embed (this contains a confirm and deny button), which this is part of the ChatInputCommandInteraction I have the confirm button handler in my "interaction-handlers" directory which handles the button click. On the button click, I want to delete the action row from the ChatInputCommandInteraction, however, I only have access to the ButtonInteraction within the button handler which is a separate interaction....

error

anyone know why im getting this
No description

Paginated Message Replies Only to Interactions?

When I use a paginated message from @sapphire/discord.js-utilities with an interaction and call the run method it replies to the original interaction. However when I follow the same process with a message object it does not reply to the original message. I was wondering if this is perhaps an intents issue or the like but having given the bot all intents and scoured the docs I still can't find a solution. Any help would be much appreciated.

Easy way to add per command permissions/restrictions

Is there an easy way to add a restriction for any command so that it can only be ran by a member with a specific role or in a specific channel. i know you have to integrate it into your database but what the easiest way to set this up. ive been trying to set this up with a precondition for all commands where it checks the command name and checks the database to see if there are any restrictions in place

changing directories

Hey, I'd like to change the directories where routes and interaction handlers are stored, as the default names don't suit my codebase. I've tried changing them in .sapphirerc.json but with no success. Anything else I could try or there is no way of changing them?

editable commands

Is there anyway i can make it so that when someone edits the command it edits the original response and not send a new message everytime?

Message Context Menu Command Not Registering

I am attempting to create a command that shows up when selecting a message. The command code (in src/commands) is: ```ts import { Command } from '@sapphire/framework';...

Remove application commands

How can I remove application commands? I don't see them in the chat with / but I still see them in integrations.

How to declare the BulkOverwrite property in JavaScript?

I've been having trouble trying to find out how to declare the BulkOverwrite option for Sapphire, searched around but couldn't find anything for my use case.

Shapeshift: Type instantiation is excessively deep and possibly infinite

```ts s.object({ filteredWords: s.string .lengthLessThanOrEqual(32) .array.lengthLessThanOrEqual(50),...
No description

Can't run sapphire using bun

using templates from official repo

Augmenting Container Failed

```ts declare module '@sapphire/pieces' { interface Container { db: PrismaClient;...
Solution:
Run yarn dedupe

TypeError: Cannot read properties of undefined (reading 'channels')

I am trying to automate the welcome messages through the use of a bot and have a functioning listener for the guildMemberAdd event but when trying to get the id of the channel I want to send the message to I get this error. My code is the following ``` import { Listener } from "@sapphire/framework"; import { Client, TextChannel } from "discord.js"; ...

GuildMemberAdd Event LIstener

I am trying to create an event listener using sapphire ts and discord js. I am trying to find a way to test the event without having to create and ban accounts repeatedly. I tried using the node.js event emitter like so
const emitter = new EventEmitter();
emitter.emit("GUILD_MEMBER_ADD, GuildMember)
const emitter = new EventEmitter();
emitter.emit("GUILD_MEMBER_ADD, GuildMember)
...
Solution:
Worked in my eval command. Make sure it's actually the Client instance you're trying to use emit() on. Inside a command file if you're extending the Command class, it would be ```ts this.container.client.emit()...

arguments

how to make arguments throw error when smh is not filled for ex !prefix set - but the prefix is required...
Solution:
found it, i was using wrong event. correct event: subcommand error