Overriding default permission precondition

I'd like to use sapphire's core permission precondition but I want to modify it and add my own logic. By this I mean being able to use requiredUserPermissions in the command options. Reading through the guide/docs It doesn't specify if you can override the core preconditions with your own (like you can with arguments) so I'm asking here for clarification
Solution:
You can override any piece in framework or in any plugin by setting the same name as the piece you're overriding
Jump to solution
5 Replies
Solution
kyra
kyra4mo ago
You can override any piece in framework or in any plugin by setting the same name as the piece you're overriding
dan
danOP4mo ago
I see. So it'd just be a simple "declare module @sapphire/framework..." after I've made my own precondition The naming should be "UserPermissions", correct?
Favna
Favna4mo ago
you only need to declare module if you're exposing new symbols from the class. If you're only modifying the logic you only need runtime changes, and yes that is the name
dan
danOP4mo ago
Alright, thx for clarifying Just bc I'm stupid and idk if this applies to listeners, but can I also override any default listener such as prefixedMessage?
Favna
Favna4mo ago
yes just take note of the name either by checkin the source code (easiest) or logging them from this.container.stores.get('thing-you-want')
Want results from more Discord servers?
Add your server