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