Is it possible to add some sort of custom property to commands that can be checked in a precondition

I'm trying to make a precondition that will check for a role on the user, I was wondering if there is some way to add a property to a command, where I can check if it exists in a precondition, for example requiredRoles: ['ADMIN','MODERATOR']?
Solution:
GitHub
skyra/src/lib/structures/commands/SkyraCommand.ts at main · skyra-p...
A multipurpose Discord Bot designed to carry out most of your server's needs with great performance and stability. - skyra-project/skyra
GitHub
skyra/src/preconditions/Administrator.ts at main · skyra-project/sk...
A multipurpose Discord Bot designed to carry out most of your server's needs with great performance and stability. - skyra-project/skyra
Jump to solution
4 Replies
gitty
gittyOP2w ago
(point of this is that i dont have to make like 10 different preconditions all doing the same thing in practice, just 1 string is changed..)
Solution
Favna
Favna2w ago
GitHub
skyra/src/lib/structures/commands/SkyraCommand.ts at main · skyra-p...
A multipurpose Discord Bot designed to carry out most of your server's needs with great performance and stability. - skyra-project/skyra
GitHub
skyra/src/preconditions/Administrator.ts at main · skyra-project/sk...
A multipurpose Discord Bot designed to carry out most of your server's needs with great performance and stability. - skyra-project/skyra
Favna
Favna2w ago
GitHub
bloombot/src/lib/extensions/BloomComand.ts at main · favware/bloombot
A private discord bot for the Nightbloom FC Discord server - favware/bloombot
gitty
gittyOP2w ago
big thanks

Did you find this page helpful?