Problem loading virtual pieces

If I go by file system mode, all commands & listeners get loaded. But if I go by virtual piece route, only 1 command gets loaded. Here is my repo - https://github.com/MRDGH2821/Discord-Ban-Utils-Bot/tree/rewrite-sapphire (rewrite-sapphire branch) I have cross checked & ensured that loadPiece is being called in each command & listener which are then imported in _load.ts (which is imported by lib/setup.ts, which is ultimately imported by index.ts). I even checked by directly importing _load.ts into index.ts but still same
GitHub
GitHub - MRDGH2821/Discord-Ban-Utils-Bot at rewrite-sapphire
Discord Ban Utilities for Mutual Servers! Contribute to MRDGH2821/Discord-Ban-Utils-Bot development by creating an account on GitHub.
No description
Solution:
Solution: 1. Explicitly put piece name, there's no way to set it dynamically (unless you set it in a variable & assign it wherever needed) 2. Don't use virtual pieces...
Jump to solution
10 Replies
Favna
Favna10mo ago
@kyra 🩵🩷🤍🩷🩵 @vladdy
vladdy
vladdy10mo ago
your name is wrong as in the name in the loadPiece call
kyra
kyra10mo ago
UserCommand.name is the name of the class, 'UserCommand'.
Favna
Favna10mo ago
see I don't have enough knowhow of virtual pieces to spot that kekw yeah looks like you have to give string values to those lines
MRDGH2821
MRDGH282110mo ago
Is there a dynamic way to get it? dead Its gonna be a pain to update at multiple places (imagine if I rename a command) I can definitely set a variable & assign it everywhere, but still its a pain 💀
vladdy
vladdy10mo ago
just..dont use virtual pieces Otherwise no,you need to either rename the classes or... yeah..set the name manually
Solution
MRDGH2821
MRDGH282110mo ago
Solution: 1. Explicitly put piece name, there's no way to set it dynamically (unless you set it in a variable & assign it wherever needed) 2. Don't use virtual pieces
MRDGH2821
MRDGH282110mo ago
I'm going by the variable route, i.e.
const PIECE_NAME = 'help';
const PIECE_NAME = 'help';
And putting it wherever needed
vladdy
vladdy10mo ago
you could also just rename the classes so you'd have BanCommand, HelpCommand, etc that'd work too
MRDGH2821
MRDGH282110mo ago
oh.... too late now
Want results from more Discord servers?
Add your server