irc-radio-bot/libs/Help.js
2019-12-25 13:47:42 +01:00

125 lines
4.1 KiB
JavaScript

class Help {
/**
* Fonction affichant l'aide générale
* @param {Function} say
* @param {String} where
* @param {Array} args
*/
static show (say, where, args) {
if (args.length > 2) {
switch (args[2]) {
case '!artist':
case '!song':
Help.showArtistSong(say, where, args)
break
case '!stats':
Help.showStats(say, where)
break
case '!when':
Help.showWhen(say, where)
break
case '!list':
Help.showList(say, where)
break
case '!notifications':
Help.showNotifications(say, where)
break
default:
break
}
} else {
say(where, 'IRC Radio Bot :: Help')
say(where, '!artist <add/del> {nom à sauvegarder si différent du morceau en cours}')
say(where, '!song <add/del> {nom à sauvegarder si différent du morceau en cours}')
say(where, '!stats <period> <artist/song>')
say(where, '!when <period> <artist/song>')
say(where, '!list <period> <artist/song>')
say(where, '!help {command}')
say(where, '!notifications <on/off/state>')
}
say(where, '__ END __')
}
/**
* Fonction affichant l'aide sur les commandes !artist et !song
* @param {Function} say
* @param {String} where
* @param {Array} args
*/
static showArtistSong (say, where, args) {
say(where, 'IRC Radio Bot :: Artist/Song')
say(where, `${args[2]} add {[facultatif] nom} < Permet de rajouter une notification sur ${args[2] === '!artist' ? 'cet artiste' : 'ce morceau'}`)
say(where, `${args[2]} del {[facultatif] nom} < Permet de supprimer une notification sur ${args[2] === '!artist' ? 'cet artiste' : 'ce morceau'}`)
}
/**
* Fonction affichant l'aide sur la commande !stats
* @param {Function} say
* @param {String} where
*/
static showStats (say, where) {
say(where, 'IRC Radio Bot :: Stats')
say(where, 'Permet d\'afficher le nombre de passage à l\'antenne d\'un artiste/morceau sur une période donnée')
say(where, '!stats day <title>')
say(where, '!stats week <title>')
say(where, '!stats month <title>')
say(where, '!stats year <title>')
say(where, '!stats lastday <title>')
say(where, '!stats lastweek <title>')
say(where, '!stats lastmonth <title>')
say(where, '!stats lastyear <title>')
}
/**
* Fonction affichant l'aide sur la commande !when
* @param {Function} say
* @param {String} where
*/
static showWhen (say, where) {
say(where, 'IRC Radio Bot :: When')
say(where, 'Permet d\'afficher la dernier passage d\'un artiste/morceau sur une période donnée')
say(where, '!when day <title>')
say(where, '!when week <title>')
say(where, '!when month <title>')
say(where, '!when year <title>')
say(where, '!when lastday <title>')
say(where, '!when lastweek <title>')
say(where, '!when lastmonth <title>')
say(where, '!when lastyear <title>')
}
/**
* Fonction affichant l'aide sur la commande !list
* @param {Function} say
* @param {String} where
*/
static showList (say, where) {
say(where, 'IRC Radio Bot :: List')
say(where, 'Permet d\'afficher la liste des titres joués pour un artiste sr une période donnée')
say(where, '!list day <artist>')
say(where, '!list week <artist>')
say(where, '!list month <artist>')
say(where, '!list year <artist>')
say(where, '!list lastday <artist>')
say(where, '!list lastweek <artist>')
say(where, '!list lastmonth <artist>')
say(where, '!list lastyear <artist>')
}
/**
* Fonction affichant l'aide sur la commande !notifications
* @param {Function} say
* @param {String} where
*/
static showNotifications (say, where) {
say(where, 'IRC Radio Bot :: Notifications')
say(where, 'Permet d\'activer et de désactiver les notifications pour soit')
say(where, '!notifications off')
say(where, '!notifications off')
say(where, '!notifications state < Permet de voir si l\'on a désactivé ou non les notifications')
}
}
module.exports = Help