aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/commands/utility
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--server/src/commands/utility/UAC/_info.js18
1 files changed, 17 insertions, 1 deletions
diff --git a/server/src/commands/utility/UAC/_info.js b/server/src/commands/utility/UAC/_info.js
index 6da85d5..c5010a6 100644
--- a/server/src/commands/utility/UAC/_info.js
+++ b/server/src/commands/utility/UAC/_info.js
@@ -1,6 +1,6 @@
/**
* User Account Control information containing level constants
- * and simple helper functions used to verify permissions
+ * and simple helper functions related to users
* @property {Object} levels - Defines labels for default permission ranges
* @author MinusGix ( https://github.com/MinusGix )
* @version v1.0.0
@@ -33,6 +33,7 @@ export const levels = {
/**
* Returns true if target level is equal or greater than the global admin level
* @public
+ * @param {number} level Level to verify
* @return {boolean}
*/
export function isAdmin(level) {
@@ -42,6 +43,7 @@ export function isAdmin(level) {
/**
* Returns true if target level is equal or greater than the global moderator level
* @public
+ * @param {number} level Level to verify
* @return {boolean}
*/
export function isModerator(level) {
@@ -51,6 +53,7 @@ export function isModerator(level) {
/**
* Returns true if target level is equal or greater than the channel owner level
* @public
+ * @param {number} level Level to verify
* @return {boolean}
*/
export function isChannelOwner(level) {
@@ -60,6 +63,7 @@ export function isChannelOwner(level) {
/**
* Returns true if target level is equal or greater than the channel moderator level
* @public
+ * @param {number} level Level to verify
* @return {boolean}
*/
export function isChannelModerator(level) {
@@ -69,6 +73,7 @@ export function isChannelModerator(level) {
/**
* Returns true if target level is equal or greater than the channel trust level
* @public
+ * @param {number} level Level to verify
* @return {boolean}
*/
export function isChannelTrusted(level) {
@@ -78,8 +83,19 @@ export function isChannelTrusted(level) {
/**
* Returns true if target level is equal or greater than a trusted user
* @public
+ * @param {number} level Level to verify
* @return {boolean}
*/
export function isTrustedUser(level) {
return level >= levels.trustedUser;
}
+
+/**
+ * Returns true if the nickname is valid
+ * @public
+ * @param {string} nick Nickname to verify
+ * @return {boolean}
+ */
+export function verifyNickname(nick) {
+ return /^[a-zA-Z0-9_]{1,24}$/.test(nick);
+}