@4-gestion-des-admins
This commit is contained in:
parent
b88a776071
commit
7cd51aaf94
1 changed files with 20 additions and 15 deletions
35
index.js
35
index.js
|
@ -174,6 +174,7 @@ const botSay = (where, what, dontDisplayRadio, forceSend) => {
|
|||
*/
|
||||
const actions = (where, message, from) => {
|
||||
const exploded = message.split(' ')
|
||||
const admins = (process.env.ADMINISTRATORS || 'ALL').toLowerCase().split(',')
|
||||
|
||||
let allowedCmds = ['ALL']
|
||||
if (process.env.AVAILABLE_CMD) {
|
||||
|
@ -251,25 +252,29 @@ const actions = (where, message, from) => {
|
|||
}
|
||||
break
|
||||
case '!mute':
|
||||
if (allowedCmds[0] === 'ALL' || allowedCmds.indexOf('!mute') !== -1) {
|
||||
if (exploded[2] && ['on', 'off', 'state'].indexOf(exploded[2]) !== -1) {
|
||||
switch (exploded[2]) {
|
||||
case 'on':
|
||||
isMute = true
|
||||
botSay(where, "Pff ! c'est toujours pareil ici :'(", false, true)
|
||||
break
|
||||
case 'off':
|
||||
isMute = false
|
||||
botSay(where, "Merci ! j'avais tellement de chose à te dire...", false, true)
|
||||
break
|
||||
default:
|
||||
botSay(where, isMute ? 'Je ne dirais rien !' : "T'inquiète ! tu vas l'avoir ta notif !", false, true)
|
||||
if (admins[0] === 'ALL' || allowedCmds.indexOf(from.toLowerCase()) !== -1) {
|
||||
if (allowedCmds[0] === 'ALL' || allowedCmds.indexOf('!mute') !== -1) {
|
||||
if (exploded[2] && ['on', 'off', 'state'].indexOf(exploded[2]) !== -1) {
|
||||
switch (exploded[2]) {
|
||||
case 'on':
|
||||
isMute = true
|
||||
botSay(where, "Pff ! c'est toujours pareil ici :'(", false, true)
|
||||
break
|
||||
case 'off':
|
||||
isMute = false
|
||||
botSay(where, "Merci ! j'avais tellement de chose à te dire...", false, true)
|
||||
break
|
||||
default:
|
||||
botSay(where, isMute ? 'Je ne dirais rien !' : "T'inquiète ! tu vas l'avoir ta notif !", false, true)
|
||||
}
|
||||
} else {
|
||||
botSay(where, '!help mute', false, true)
|
||||
}
|
||||
} else {
|
||||
botSay(where, '!help mute', false, true)
|
||||
unknownCmd()
|
||||
}
|
||||
} else {
|
||||
unknownCmd()
|
||||
botSay(where, 'Bien tenté mais...')
|
||||
}
|
||||
|
||||
break
|
||||
|
|
Loading…
Reference in a new issue