1 |
module.exports = class Shield { |
2 |
verify(msg, cm) { |
3 |
if (app.config.props[msg.guild.id].global_commands.indexOf(cm.commandName) !== -1) { |
4 |
return true; |
5 |
} |
6 |
|
7 |
if (!msg.member.roles.cache.has(app.config.props[msg.guild.id].mod_role)) { |
8 |
//console.log('mod-role not found: ' + msg.author.tag); |
9 |
return false; |
10 |
} |
11 |
|
12 |
const roles = app.config.props[msg.guild.id].role_commands; |
13 |
|
14 |
for (let roleID in roles) { |
15 |
// console.log(roleID + ' search'); |
16 |
if (msg.member.roles.cache.has(roleID)) { |
17 |
if (roles[roleID].indexOf(cm.commandName) === -1) { |
18 |
return true; |
19 |
} |
20 |
else { |
21 |
return false; |
22 |
} |
23 |
} |
24 |
} |
25 |
|
26 |
return false; |
27 |
} |
28 |
}; |