@4-gestion-des-admins
This commit is contained in:
parent
b88a776071
commit
7cd51aaf94
1 changed files with 20 additions and 15 deletions
5
index.js
5
index.js
|
@ -174,6 +174,7 @@ const botSay = (where, what, dontDisplayRadio, forceSend) => {
|
||||||
*/
|
*/
|
||||||
const actions = (where, message, from) => {
|
const actions = (where, message, from) => {
|
||||||
const exploded = message.split(' ')
|
const exploded = message.split(' ')
|
||||||
|
const admins = (process.env.ADMINISTRATORS || 'ALL').toLowerCase().split(',')
|
||||||
|
|
||||||
let allowedCmds = ['ALL']
|
let allowedCmds = ['ALL']
|
||||||
if (process.env.AVAILABLE_CMD) {
|
if (process.env.AVAILABLE_CMD) {
|
||||||
|
@ -251,6 +252,7 @@ const actions = (where, message, from) => {
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
case '!mute':
|
case '!mute':
|
||||||
|
if (admins[0] === 'ALL' || allowedCmds.indexOf(from.toLowerCase()) !== -1) {
|
||||||
if (allowedCmds[0] === 'ALL' || allowedCmds.indexOf('!mute') !== -1) {
|
if (allowedCmds[0] === 'ALL' || allowedCmds.indexOf('!mute') !== -1) {
|
||||||
if (exploded[2] && ['on', 'off', 'state'].indexOf(exploded[2]) !== -1) {
|
if (exploded[2] && ['on', 'off', 'state'].indexOf(exploded[2]) !== -1) {
|
||||||
switch (exploded[2]) {
|
switch (exploded[2]) {
|
||||||
|
@ -271,6 +273,9 @@ const actions = (where, message, from) => {
|
||||||
} else {
|
} else {
|
||||||
unknownCmd()
|
unknownCmd()
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
botSay(where, 'Bien tenté mais...')
|
||||||
|
}
|
||||||
|
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue