There are many useful functions that can be used in many places to avoid duplicating code, you can see a list here :
- argError : Send an argument error.
- codeError : Send an internal error.
- permissionsError : Send a permission error.
- getThing : Get easily arguments of a given type.
- saveJSON : Saves a JSON safely, returning a boolean meaning if it worked.
- readJSON : Reads a JSON, prefer using
import
orrequire
.
- isOwner : Returns
true
if the given ID is included in the owners set inCommandHandler.create
. - isPermission : Returns
true
if the given string is a valid permission. It's also a type guard forPermissionString
type for TypeScript users.
- cutIfTooLong : Cut a text at a given length (if too long).
- getKeyByValue : Get a key from a value in an object.
- random : Returns a random value from an array.