Mathias
Mathias
Explore posts from servers
SIASapphire - Imagine a framework
Created by Mathias on 4/27/2024 in #sapphire-support
Error [UNLOADED_PIECE]: The piece 'ready' does not exist.
Hello ! On this code :
import { Listener } from "@sapphire/framework";

export class ReadyListeners extends Listener {
constructor(context, options) {
super(context, {
...options,
once: true,
});
}

async run(client) {
console.log("Are you readyy ?");
}
}
import { Listener } from "@sapphire/framework";

export class ReadyListeners extends Listener {
constructor(context, options) {
super(context, {
...options,
once: true,
});
}

async run(client) {
console.log("Are you readyy ?");
}
}
I have this error:
1|common | Error [UNLOADED_PIECE]: The piece 'ready' does not exist.
1|common | at _ListenerStore.resolve (file:///home/mathie/node_modules/@sapphire/pieces/dist/esm/lib/structures/Store.mjs:207:15)
1|common | at _ListenerStore.unload (file:///home/mathie/node_modules/@sapphire/pieces/dist/esm/lib/structures/Store.mjs:148:24)
1|common | at ReadyListeners.unload (file:///home/mathie/node_modules/@sapphire/pieces/dist/esm/lib/structures/Piece.mjs:58:22)
1|common | at ReadyListeners._runOnce (file:///home/mathie/node_modules/@sapphire/framework/dist/esm/lib/structures/Listener.mjs:29:16) {
1|common | type: 'UNLOADED_PIECE'
1|common | }
1|common | Error [UNLOADED_PIECE]: The piece 'ready' does not exist.
1|common | at _ListenerStore.resolve (file:///home/mathie/node_modules/@sapphire/pieces/dist/esm/lib/structures/Store.mjs:207:15)
1|common | at _ListenerStore.unload (file:///home/mathie/node_modules/@sapphire/pieces/dist/esm/lib/structures/Store.mjs:148:24)
1|common | at ReadyListeners.unload (file:///home/mathie/node_modules/@sapphire/pieces/dist/esm/lib/structures/Piece.mjs:58:22)
1|common | at ReadyListeners._runOnce (file:///home/mathie/node_modules/@sapphire/framework/dist/esm/lib/structures/Listener.mjs:29:16) {
1|common | type: 'UNLOADED_PIECE'
1|common | }
When I remove once, it's working Why? Thanks!
17 replies
SIASapphire - Imagine a framework
Created by Mathias on 12/27/2023 in #sapphire-support
Create WebServer with Plugin API
Hello ! I read the doc for install a webserver in my bot. Here my code:
const client = new SapphireClient({
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildMembers, GatewayIntentBits.GuildVoiceStates],
prefix: '',
origin: '*',
listenOptions: {
port: 8080
}
});
const client = new SapphireClient({
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildMembers, GatewayIntentBits.GuildVoiceStates],
prefix: '',
origin: '*',
listenOptions: {
port: 8080
}
});
These lines should open a web server on 8080 port, no ?
14 replies
SIASapphire - Imagine a framework
Created by Mathias on 12/25/2023 in #sapphire-support
Any tips for store data in the interaction ?
Hello What is the best way to store data through interactions? Today, I put everything in the customId of the interaction, but it is limited to 100 characters... Do you have tips? Thanks!
13 replies
SIASapphire - Imagine a framework
Created by Mathias on 12/24/2023 in #sapphire-support
Error handling
Hello ! Is there anything native to Sapphire that allows error handling? I want to capture all the bot's unhandled errors and to be able to act on them. Thanks!
8 replies
SIASapphire - Imagine a framework
Created by Mathias on 12/23/2023 in #sapphire-support
Error when loading events
Hello ! I'm creating a Discord bot with Sapphire and when I create an event, I have this error : Error when loading '/home/desk/bot-sapphire/common/src/ticket/listeners/ready.js': Error: Dynamic require of "/home/desk/bot-sapphire/common/src/ticket/listeners/ready.js" is not supported I'm using ESM! Thanks
14 replies
SIASapphire - Imagine a framework
Created by Mathias on 12/10/2023 in #sapphire-support
How to config baseUserDirectory
Hello I have a bot and I want to sort my bot module in differents folders : For example :
Ticket/Commands
Common/Commands
Youtube/Commands
Moderation/Commands
index.js
Ticket/Commands
Common/Commands
Youtube/Commands
Moderation/Commands
index.js
How do I need to setup my baseUserDirectory for check commands on all folders ? Thanks!
5 replies
SIASapphire - Imagine a framework
Created by Mathias on 11/4/2023 in #sapphire-support
Setup 3 bots with Sapphire
Hello ! I'd like to set up 3 bots with Sapphire. But I'd like to have everything in the same code to share certain components. What I'm doing for the moment is creating 3 instances of SapphireClient, in which I define a path to retrieve commands, listeners, etc ... My problem: I'd like to add access to my database in container but I can't see how to do it. Is it possible to define a property in container as soon as SapphireClient is initialised? Thanks! (this is my first experience with SapphireClient)
21 replies