Resolve "Gestion des admins" #14

Merged
dbroqua merged 1 commit from 4-gestion-des-admins into develop 2020-01-13 14:46:00 +01:00

View file

@ -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: