Added help library

This commit is contained in:
dbroqua 2019-12-24 11:30:41 +01:00
parent b3cc482d66
commit 46ffb25acf

102
libs/Help.js Normal file
View file

@ -0,0 +1,102 @@
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 '!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 <day/week/lastweek/month/lastmonth/year/lastyear> <artist/song>')
say(where, '!when <day/week/lastweek/month/lastmonth/year/lastyear> <artist/song>')
say(where, '!help {!artist/!song/!stats/!when}')
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 !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