Merge branch '4-gestion-des-admins' into 'develop'
Resolve "Gestion des admins" Closes #4 See merge request dbroqua/irc-radio-bot!4
This commit is contained in:
commit
b6beab9a71
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