Skip to content

Commit acbea0c

Browse files
authored
updates to admin verify to make it easier (#491)
1 parent 31d97d1 commit acbea0c

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

Parsers/Admin tool - Verify.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,9 @@ if (current.channel == 'GD51HTR46' || current.channel == 'G9LAJG7G8' || current.
1919
messageBody = '!verify-admin must be called with a user tag, followed by an optional parameter and optional description. For example: `!verify-admin @Astrid -unv Is an Impasta`\n\nThe full list of accepted triggers can be found by sending `!verify-admin -help`';
2020
}
2121

22-
if(paramArr.length == 1){
23-
if(paramArr[0] == '-help'){
22+
if(paramArr.length == 1 && paramArr[0] == '-help'){
2423
messageBody = 'Admin Tool - Verify user\nA parser for setting user verification and descriptions. *Note:* This parser can only be triggered from admin channels specified.\n\nUsage: `!verify-admin @username [-v|-unv] [message]`\nExamples:\n`!verify-admin @Astrid -unv Is an Impasta`\n`!verify-admin @Astrid Some Role, Some Company`\n`!verify-admin @Astrid -v`\n\nSupported flags:\n-v: Verify the user\n-unv: Remove verification from user\n-help: Show this message';
25-
} else {
26-
messageBody = '!verify-admin must be called with a user tag, followed by an optional parameter and optional description. For example: `!verify-admin @Astrid -unv Is an Impasta`\n\nThe full list of accepted triggers can be found by sending `!verify-admin -help`';
27-
}
28-
}
24+
}
2925

3026
if(paramArr.length >= 2){
3127
if(/^<@.*?>$/.test(paramArr[0])){
@@ -50,14 +46,12 @@ if (current.channel == 'GD51HTR46' || current.channel == 'G9LAJG7G8' || current.
5046
verificationStatus = true;
5147
}
5248

53-
if(paramArr.indexOf('-unv') > -1){
49+
else if(paramArr.indexOf('-unv') > -1){
5450
verificationStatus = false;
5551
}
5652

57-
if(verificationStatus != null){
58-
paramArr = paramArr.filter(function(val){
59-
return (val != '-v' && val != '-unv');
60-
})
53+
else if(verificationStatus != null){
54+
verificationStatus = true;
6155
}
6256

6357
description = paramArr.join(' ');
@@ -67,9 +61,15 @@ if (current.channel == 'GD51HTR46' || current.channel == 'G9LAJG7G8' || current.
6761
description.length > 0 ? grUser.setValue('user_info',description) : null;
6862
grUser.update();
6963

70-
messageBody = 'Updated <@' + userId + '>\'s verification information. Run `!verify` or `!whois` to verify output.';
64+
messageBody = 'Updated <@' + userId + '>\'s verification information with the following info:\n';
65+
if(verificationStatus != null){
66+
messageBody += 'Verification status: ' + (verificationStatus ? 'Verified' : 'Unverified') + '\n';
67+
}
68+
if(description.length > 0){
69+
messageBody += 'User information: ' + description;
70+
}
7171
} else {
72-
messageBody += 'I\'m afraid I can\'t do that as the user does not exist.';
72+
messageBody += 'I\'m afraid I can\'t do that as the ~limit~ user does not exist.';
7373
}
7474
slacker.send_chat(current, messageBody, true);
7575
}

0 commit comments

Comments
 (0)