@sylvanar/utils
v0.0.5
Published
Utils for Sylvanar.
Downloads
2
Readme
Utils for @sylvanar
functions
hasPermissions
Checks whether a guild member has the specified permissions.
Example
import { hasPermissions } from "@sylvanar/utils";
if (!hasPermissions(member, permission)) {
console.log("No permission");
} else {
// Execute code if member has permissions
...
}
Parameters
member
(GuildMember
): The guild member whose permissions will be checked.permission
(PermissionResolvable[]
): An array of permission flags to check against.
Returns
Boolean
:true
if the member has all the specified permissions,false
otherwise.
hexToRgb
converter hex to rgb color
Example
import { hexToRgb } from "@sylvanar/utils";
console.log(hexToRgb("#ffffff")) // white color -> (255, 255, 255) -> output 16777215
Parameters
hex
(string
): The color in hex string (#xxxxxx).
Returns
number
: return number