Resolve "Gestion des commandes actives" #12
1 changed files with 11 additions and 11 deletions
22
index.js
22
index.js
|
@ -183,7 +183,7 @@ const actions = (where, message, from) => {
|
||||||
allowedCmds = process.env[`AVAILABLE_CMD_${where.replace('#', '')}`].split(',')
|
allowedCmds = process.env[`AVAILABLE_CMD_${where.replace('#', '')}`].split(',')
|
||||||
}
|
}
|
||||||
|
|
||||||
const unknowmCmd = () => {
|
const unknownCmd = () => {
|
||||||
if (allowedCmds[0] === 'ALL' || allowedCmds.indexOf('!help') !== -1) {
|
if (allowedCmds[0] === 'ALL' || allowedCmds.indexOf('!help') !== -1) {
|
||||||
botSay(where, 'Commande inconnue, tape !help si tu es perdu', false, true)
|
botSay(where, 'Commande inconnue, tape !help si tu es perdu', false, true)
|
||||||
} else {
|
} else {
|
||||||
|
@ -198,56 +198,56 @@ const actions = (where, message, from) => {
|
||||||
if (allowedCmds[0] === 'ALL' || allowedCmds.indexOf('!artist') !== -1) {
|
if (allowedCmds[0] === 'ALL' || allowedCmds.indexOf('!artist') !== -1) {
|
||||||
artistSong.action(exploded[1].replace('!', ''), botSay, from, currentSong, exploded)
|
artistSong.action(exploded[1].replace('!', ''), botSay, from, currentSong, exploded)
|
||||||
} else {
|
} else {
|
||||||
unknowmCmd()
|
unknownCmd()
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
case '!song':
|
case '!song':
|
||||||
if (allowedCmds[0] === 'ALL' || allowedCmds.indexOf('!song') !== -1) {
|
if (allowedCmds[0] === 'ALL' || allowedCmds.indexOf('!song') !== -1) {
|
||||||
artistSong.action(exploded[1].replace('!', ''), botSay, from, currentSong, exploded)
|
artistSong.action(exploded[1].replace('!', ''), botSay, from, currentSong, exploded)
|
||||||
} else {
|
} else {
|
||||||
unknowmCmd()
|
unknownCmd()
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
case '!help':
|
case '!help':
|
||||||
if (allowedCmds[0] === 'ALL' || allowedCmds.indexOf('!help') !== -1) {
|
if (allowedCmds[0] === 'ALL' || allowedCmds.indexOf('!help') !== -1) {
|
||||||
Help.show(botSay, where, exploded, allowedCmds)
|
Help.show(botSay, where, exploded, allowedCmds)
|
||||||
} else {
|
} else {
|
||||||
unknowmCmd()
|
unknownCmd()
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
case '!when':
|
case '!when':
|
||||||
if (allowedCmds[0] === 'ALL' || allowedCmds.indexOf('!when') !== -1) {
|
if (allowedCmds[0] === 'ALL' || allowedCmds.indexOf('!when') !== -1) {
|
||||||
when.action(botSay, where, exploded)
|
when.action(botSay, where, exploded)
|
||||||
} else {
|
} else {
|
||||||
unknowmCmd()
|
unknownCmd()
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
case '!stats':
|
case '!stats':
|
||||||
if (allowedCmds[0] === 'ALL' || allowedCmds.indexOf('!stats') !== -1) {
|
if (allowedCmds[0] === 'ALL' || allowedCmds.indexOf('!stats') !== -1) {
|
||||||
stats.action(botSay, where, exploded)
|
stats.action(botSay, where, exploded)
|
||||||
} else {
|
} else {
|
||||||
unknowmCmd()
|
unknownCmd()
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
case '!list':
|
case '!list':
|
||||||
if (allowedCmds[0] === 'ALL' || allowedCmds.indexOf('!list') !== -1) {
|
if (allowedCmds[0] === 'ALL' || allowedCmds.indexOf('!list') !== -1) {
|
||||||
list.action(botSay, where, exploded)
|
list.action(botSay, where, exploded)
|
||||||
} else {
|
} else {
|
||||||
unknowmCmd()
|
unknownCmd()
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
case '!notifications':
|
case '!notifications':
|
||||||
if (allowedCmds[0] === 'ALL' || allowedCmds.indexOf('!notifications') !== -1) {
|
if (allowedCmds[0] === 'ALL' || allowedCmds.indexOf('!notifications') !== -1) {
|
||||||
preferences.notifications(botSay, where, from, exploded)
|
preferences.notifications(botSay, where, from, exploded)
|
||||||
} else {
|
} else {
|
||||||
unknowmCmd()
|
unknownCmd()
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
case '!stream':
|
case '!stream':
|
||||||
if (allowedCmds[0] === 'ALL' || allowedCmds.indexOf('!stream') !== -1) {
|
if (allowedCmds[0] === 'ALL' || allowedCmds.indexOf('!stream') !== -1) {
|
||||||
botSay(where, process.env.PUBLIC_RADIO_STREAM)
|
botSay(where, process.env.PUBLIC_RADIO_STREAM)
|
||||||
} else {
|
} else {
|
||||||
unknowmCmd()
|
unknownCmd()
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
case '!mute':
|
case '!mute':
|
||||||
|
@ -269,12 +269,12 @@ const actions = (where, message, from) => {
|
||||||
botSay(where, '!help mute', false, true)
|
botSay(where, '!help mute', false, true)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
unknowmCmd()
|
unknownCmd()
|
||||||
}
|
}
|
||||||
|
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
unknowmCmd()
|
unknownCmd()
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue