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:Jump to solution
You can override any piece in framework or in any plugin by setting the same name as the piece you're overriding
5 Replies
Solution
You can override any piece in framework or in any plugin by setting the same name as the piece you're overriding
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?
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
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?
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')