@2 - Gestion des commandes actives

This commit is contained in:
Damien Broqua 2020-01-10 20:55:53 +01:00
parent ab7530024e
commit deb5762956
2 changed files with 129 additions and 38 deletions

View file

@ -9,46 +9,83 @@ class Help {
* @param {Function} say
* @param {String} where
* @param {Array} args
* @param {Array} allowedCmds
*/
static show (say, where, args) {
static show (say, where, args, allowedCmds) {
if (args.length > 2) {
switch (args[2]) {
case '!artist':
if (allowedCmds[0] === 'ALL' || allowedCmds.indexOf('!artist') !== -1) {
Help.showArtistSong(say, where, args)
}
break
case '!song':
Help.showArtistSong(say, where, args)
if (allowedCmds[0] === 'ALL' || allowedCmds.indexOf('!song') !== -1) {
Help.showArtistSong(say, where, args)
}
break
case '!stats':
Help.showStats(say, where)
if (allowedCmds[0] === 'ALL' || allowedCmds.indexOf('!stats') !== -1) {
Help.showStats(say, where)
}
break
case '!when':
Help.showWhen(say, where)
if (allowedCmds[0] === 'ALL' || allowedCmds.indexOf('!when') !== -1) {
Help.showWhen(say, where)
}
break
case '!list':
Help.showList(say, where)
if (allowedCmds[0] === 'ALL' || allowedCmds.indexOf('!list') !== -1) {
Help.showList(say, where)
}
break
case '!notifications':
Help.showNotifications(say, where)
if (allowedCmds[0] === 'ALL' || allowedCmds.indexOf('!notifications') !== -1) {
Help.showNotifications(say, where)
}
break
case '!stream':
Help.showStream(say, where)
if (allowedCmds[0] === 'ALL' || allowedCmds.indexOf('!stream') !== -1) {
Help.showStream(say, where)
}
break
case '!mute':
Help.showMute(say, where)
if (allowedCmds[0] === 'ALL' || allowedCmds.indexOf('!mute') !== -1) {
Help.showMute(say, where)
}
break
default:
break
}
} else {
this.say(say, where, 'IRC Radio Bot :: Help')
this.say(say, where, '!artist <add/del> {nom à sauvegarder si différent du morceau en cours}')
this.say(say, where, '!song <add/del> {nom à sauvegarder si différent du morceau en cours}')
this.say(say, where, '!stats <period> {artist/song}')
this.say(say, where, '!when <period> <artist/song>')
this.say(say, where, '!list <period> <artist/song>')
this.say(say, where, '!help {command}')
this.say(say, where, '!notifications <on/off/state>')
this.say(say, where, '!stream')
this.say(say, where, '!mute <on/off/state>')
if (allowedCmds[0] === 'ALL' || allowedCmds.indexOf('!artist') !== -1) {
this.say(say, where, '!artist <add/del> {nom à sauvegarder si différent du morceau en cours}')
}
if (allowedCmds[0] === 'ALL' || allowedCmds.indexOf('!song') !== -1) {
this.say(say, where, '!song <add/del> {nom à sauvegarder si différent du morceau en cours}')
}
if (allowedCmds[0] === 'ALL' || allowedCmds.indexOf('!stats') !== -1) {
this.say(say, where, '!stats <period> {artist/song}')
}
if (allowedCmds[0] === 'ALL' || allowedCmds.indexOf('!when') !== -1) {
this.say(say, where, '!when <period> <artist/song>')
}
if (allowedCmds[0] === 'ALL' || allowedCmds.indexOf('!list') !== -1) {
this.say(say, where, '!list <period> <artist/song>')
}
if (allowedCmds[0] === 'ALL' || allowedCmds.indexOf('!help') !== -1) {
this.say(say, where, '!help {command}')
}
if (allowedCmds[0] === 'ALL' || allowedCmds.indexOf('!notifications') !== -1) {
this.say(say, where, '!notifications <on/off/state>')
}
if (allowedCmds[0] === 'ALL' || allowedCmds.indexOf('!stream') !== -1) {
this.say(say, where, '!stream')
}
if (allowedCmds[0] === 'ALL' || allowedCmds.indexOf('!mute') !== -1) {
this.say(say, where, '!mute <on/off/state>')
}
}
this.say(say, where, '__ END __')
}