Removed duplicate check

This commit is contained in:
dbroqua 2020-01-07 09:57:58 +01:00
parent a885a3208c
commit f140943545

View file

@ -8,7 +8,6 @@ const When = require('./libs/When')
const Statistics = require('./libs/Statistics') const Statistics = require('./libs/Statistics')
const List = require('./libs/List') const List = require('./libs/List')
const Preferences = require('./libs/Preferences') const Preferences = require('./libs/Preferences')
const allowedCommands = ['!artist', '!song', '!stats', '!when', '!help', '!notifications', '!list']
// Init des librairies // Init des librairies
const artistSong = new ArtistSong(models) const artistSong = new ArtistSong(models)
@ -171,36 +170,32 @@ const actions = (where, message, from) => {
// Le message publié est pour le bot // Le message publié est pour le bot
if (exploded[0].indexOf(process.env.IRC_NICKNAME) === 0) { if (exploded[0].indexOf(process.env.IRC_NICKNAME) === 0) {
// Le message contient une commande switch (exploded[1]) {
if (allowedCommands.indexOf(exploded[1]) !== -1) { case '!artist':
switch (exploded[1]) { case '!song':
case '!artist': artistSong.action(exploded[1].replace('!', ''), botSay, from, currentSong, exploded)
case '!song': break
artistSong.action(exploded[1].replace('!', ''), botSay, from, currentSong, exploded) case '!help':
break Help.show(botSay, where, exploded)
case '!help': break
Help.show(botSay, where, exploded) case '!when':
break when.action(botSay, where, exploded)
case '!when': break
when.action(botSay, where, exploded) case '!stats':
break stats.action(botSay, where, exploded)
case '!stats': break
stats.action(botSay, where, exploded) case '!list':
break list.action(botSay, where, exploded)
case '!list': break
list.action(botSay, where, exploded) case '!notifications':
break preferences.notifications(botSay, where, from, exploded)
case '!notifications': break
preferences.notifications(botSay, where, from, exploded) case '!stream':
break botSay(where, `${process.env.RADIO_ALIAS} : ${process.env.PUBLIC_RADIO_STREAM}`)
case '!stream': break
botSay(where, `${process.env.RADIO_ALIAS} : ${process.env.PUBLIC_RADIO_STREAM}`) default:
break botSay(where, 'Commande inconnue, tape !help si tu es perdu')
default: break
break
}
} else {
botSay(where, 'Commande inconnue, tape !help si tu es perdu')
} }
} }
} }