Removed duplicate check
This commit is contained in:
parent
a885a3208c
commit
f140943545
1 changed files with 26 additions and 31 deletions
57
index.js
57
index.js
|
@ -8,7 +8,6 @@ const When = require('./libs/When')
|
|||
const Statistics = require('./libs/Statistics')
|
||||
const List = require('./libs/List')
|
||||
const Preferences = require('./libs/Preferences')
|
||||
const allowedCommands = ['!artist', '!song', '!stats', '!when', '!help', '!notifications', '!list']
|
||||
|
||||
// Init des librairies
|
||||
const artistSong = new ArtistSong(models)
|
||||
|
@ -171,36 +170,32 @@ const actions = (where, message, from) => {
|
|||
|
||||
// Le message publié est pour le bot
|
||||
if (exploded[0].indexOf(process.env.IRC_NICKNAME) === 0) {
|
||||
// Le message contient une commande
|
||||
if (allowedCommands.indexOf(exploded[1]) !== -1) {
|
||||
switch (exploded[1]) {
|
||||
case '!artist':
|
||||
case '!song':
|
||||
artistSong.action(exploded[1].replace('!', ''), botSay, from, currentSong, exploded)
|
||||
break
|
||||
case '!help':
|
||||
Help.show(botSay, where, exploded)
|
||||
break
|
||||
case '!when':
|
||||
when.action(botSay, where, exploded)
|
||||
break
|
||||
case '!stats':
|
||||
stats.action(botSay, where, exploded)
|
||||
break
|
||||
case '!list':
|
||||
list.action(botSay, where, exploded)
|
||||
break
|
||||
case '!notifications':
|
||||
preferences.notifications(botSay, where, from, exploded)
|
||||
break
|
||||
case '!stream':
|
||||
botSay(where, `${process.env.RADIO_ALIAS} : ${process.env.PUBLIC_RADIO_STREAM}`)
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
} else {
|
||||
botSay(where, 'Commande inconnue, tape !help si tu es perdu')
|
||||
switch (exploded[1]) {
|
||||
case '!artist':
|
||||
case '!song':
|
||||
artistSong.action(exploded[1].replace('!', ''), botSay, from, currentSong, exploded)
|
||||
break
|
||||
case '!help':
|
||||
Help.show(botSay, where, exploded)
|
||||
break
|
||||
case '!when':
|
||||
when.action(botSay, where, exploded)
|
||||
break
|
||||
case '!stats':
|
||||
stats.action(botSay, where, exploded)
|
||||
break
|
||||
case '!list':
|
||||
list.action(botSay, where, exploded)
|
||||
break
|
||||
case '!notifications':
|
||||
preferences.notifications(botSay, where, from, exploded)
|
||||
break
|
||||
case '!stream':
|
||||
botSay(where, `${process.env.RADIO_ALIAS} : ${process.env.PUBLIC_RADIO_STREAM}`)
|
||||
break
|
||||
default:
|
||||
botSay(where, 'Commande inconnue, tape !help si tu es perdu')
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue