From 46ffb25acfbef44d8a5fedb833244acde4f8138f Mon Sep 17 00:00:00 2001 From: dbroqua Date: Tue, 24 Dec 2019 11:30:41 +0100 Subject: [PATCH] Added help library --- libs/Help.js | 102 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 libs/Help.js diff --git a/libs/Help.js b/libs/Help.js new file mode 100644 index 0000000..202df95 --- /dev/null +++ b/libs/Help.js @@ -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 {nom à sauvegarder si différent du morceau en cours}') + say(where, '!song {nom à sauvegarder si différent du morceau en cours}') + say(where, '!stats ') + say(where, '!when ') + say(where, '!help {!artist/!song/!stats/!when}') + say(where, '!notifications ') + } + 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 ') + 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