protectiontype alias + resolve for 'roles'
This commit is contained in:
parent
329811a661
commit
536d234c40
@ -8,6 +8,9 @@ class ProtectionSetting extends Setting {
|
|||||||
name: 'protection',
|
name: 'protection',
|
||||||
module: 'administration',
|
module: 'administration',
|
||||||
usage: "<'type'|'add'|'remove'> <'role'|'position'|role..>",
|
usage: "<'type'|'add'|'remove'> <'role'|'position'|role..>",
|
||||||
|
aliases: [
|
||||||
|
'protectiontype'
|
||||||
|
],
|
||||||
examples: [
|
examples: [
|
||||||
'protection type <role|position>',
|
'protection type <role|position>',
|
||||||
'protection add <role..>',
|
'protection add <role..>',
|
||||||
@ -36,15 +39,16 @@ class ProtectionSetting extends Setting {
|
|||||||
|
|
||||||
const langParams = {};
|
const langParams = {};
|
||||||
|
|
||||||
if (method === 'type') {
|
if (method === 'type' || message._caller === 'protectiontype') {
|
||||||
|
|
||||||
if (!params[1]) return {
|
if (!params[1]) return {
|
||||||
error: true,
|
error: true,
|
||||||
msg: message.format('MISSING_ARGS')
|
msg: message.format('MISSING_ARGS')
|
||||||
};
|
};
|
||||||
|
|
||||||
const value = params[1].toLowerCase();
|
let value = params[1].toLowerCase();
|
||||||
if (!['role', 'position'].includes(value)) return { error: true, msg: message.format('S_PROTECTION_INVALID_ARGS') };
|
if (!['role', 'roles', 'position'].includes(value)) return { error: true, msg: message.format('S_PROTECTION_INVALID_ARGS') };
|
||||||
|
if (value === 'roles') value = 'role';
|
||||||
setting.type = value;
|
setting.type = value;
|
||||||
|
|
||||||
index = 'S_PROTECTION_TYPE';
|
index = 'S_PROTECTION_TYPE';
|
||||||
|
Loading…
Reference in New Issue
Block a user