Hey guys,
I tried myself on writing a custom store
import { Piece, Store } from '@sapphire/framework';
export class InfrastructureDiscordServiceStore extends Store<Piece, 'infrastructure-discord-services'> {
public constructor() {
super(Piece, { name: 'infrastructure-discord-services' });
}
}
I try to register it in my client with this code piece
const root = getRootData().root;
this.stores.register(new InfrastructureDiscordServiceStore()).registerPath(join(root, 'infrastructure', 'discord', 'service'));
Log output:
2025-05-26 10:39:14 - INFO - └─ Loaded 0 infrastructure-discord-services.
Path should be correct. But at the end no store will be registered. My stores are all built like this
export class RoleService extends Piece {
public constructor(context: Piece.LoaderContext, options: Piece.Options) {
super(context, { ...options, name: 'role-service' });
}
}
In the end it's not working. Funny thing is that when I try to register the store manually with
void this.stores.loadPiece({
store: 'infrastructure-discord-services',
name: 'role-service',
piece: RoleService
});
the Service is registered in the store.
Log output:
2025-05-26 10:39:14 - INFO - └─ Loaded 6 infrastructure-discord-services.
What am I doing wrong?
I am thankful for all help 🥲
