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 sameGitHub
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.
Solution:Jump to 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...
10 Replies
@kyra 🩵🩷🤍🩷🩵 @vladdy
your name is wrong
as in the name in the loadPiece call
UserCommand.name
is the name of the class, 'UserCommand'
.see I don't have enough knowhow of virtual pieces to spot that yeah looks like you have to give string values to those lines
Is there a dynamic way to get it?
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 💀
just..dont use virtual pieces
Otherwise no,you need to either rename the classes or... yeah..set the name manually
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
I'm going by the variable route, i.e.
And putting it wherever needed
you could also just rename the classes
so you'd have BanCommand, HelpCommand, etc
that'd work too
oh....
too late now