Closed Fredi100 closed 4 years ago
So I implemented the @Guard
(and the Prefix function) decorator !
The documentation is here! :)
Thank's for your work!
That @Guard
decorator looks good. Definitely a cleaner way of implementing this functionality.
Gonna close the PR as it is no longer needed.
I have implemented the possibility to further specify the
@On()
decorator with a restrictor. In addition to the event it takes a function likeString.prototype.startsWith
and an appropriate argument. When a new message gets sent it gets compared to the given argument with the specified function. Example:With only one command this is not really necessary but as soon as there are multiple commands, having seperate functions instead of one with a lot of if's and else's is greatly improving readability of the code.
Currently this is only supported with
"message"
events as it requires a text content which can be compared.