2018-09-21 01:04:12 +02:00
|
|
|
|
/**
|
2021-04-15 00:13:33 +02:00
|
|
|
|
* Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
|
2018-09-21 01:04:12 +02:00
|
|
|
|
*
|
2018-11-07 14:01:29 +01:00
|
|
|
|
* This file is part of (April) Hebdobot.
|
2018-09-21 01:04:12 +02:00
|
|
|
|
*
|
2018-11-07 14:01:29 +01:00
|
|
|
|
* Hebdobot is free software: you can redistribute it and/or modify
|
2018-09-21 01:04:12 +02:00
|
|
|
|
* it under the terms of the GNU Affero General Public License as published by
|
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
2018-11-07 14:01:29 +01:00
|
|
|
|
* Hebdobot is distributed in the hope that it will be useful,
|
2018-09-21 01:04:12 +02:00
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
2018-11-07 14:01:29 +01:00
|
|
|
|
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
|
2018-09-21 01:04:12 +02:00
|
|
|
|
*/
|
|
|
|
|
package org.april.hebdobot.bot.hooks;
|
|
|
|
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.april.hebdobot.bot.Hebdobot;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The Class HelpHook.
|
|
|
|
|
*/
|
|
|
|
|
public class HelpHook extends Hook
|
|
|
|
|
{
|
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(HelpHook.class);
|
|
|
|
|
|
|
|
|
|
/* (non-Javadoc)
|
|
|
|
|
* @see org.april.hebdobot.bot.hooks.Hook#attemptProcess(org.april.hebdobot.bot.Hebdobot, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public boolean attemptProcess(final Hebdobot bot, final String channel, final String sender, final String login, final String hostname,
|
|
|
|
|
final String message)
|
|
|
|
|
{
|
|
|
|
|
boolean result;
|
|
|
|
|
|
|
|
|
|
if (StringUtils.equalsAnyIgnoreCase(message, "!aide", "!help"))
|
|
|
|
|
{
|
|
|
|
|
logger.info("!help caught.");
|
|
|
|
|
|
|
|
|
|
// Help.
|
|
|
|
|
bot.sendMessage(sender, "Bienvenue " + sender);
|
2021-04-15 00:13:33 +02:00
|
|
|
|
bot.sendMessage(sender, "Je suis " + bot.getName() + ", le robot de gestion des revues hebdomadaires de l'April.");
|
2018-09-21 01:04:12 +02:00
|
|
|
|
bot.sendMessage(sender, "Voici les commandes que je comprends :");
|
|
|
|
|
bot.sendMessage(sender, " ");
|
|
|
|
|
bot.sendMessage(sender, " !aide,!help : afficher cette aide");
|
2018-11-07 17:27:43 +01:00
|
|
|
|
bot.sendMessage(sender, " !début : commencer une nouvelle revue");
|
2018-09-21 01:04:12 +02:00
|
|
|
|
bot.sendMessage(sender, " # titre : démarrer un sujet individuel");
|
|
|
|
|
bot.sendMessage(sender, " ## titre : démarrer un sujet collectif");
|
|
|
|
|
bot.sendMessage(sender, " % message : traiter comme un commentaire");
|
|
|
|
|
bot.sendMessage(sender, " !courant : afficher le sujet en cours");
|
|
|
|
|
bot.sendMessage(sender, " !manquants : afficher qui n'a pas participé sur le dernier sujet");
|
|
|
|
|
bot.sendMessage(sender, " !fin : terminer la revue en cours");
|
|
|
|
|
bot.sendMessage(sender, " !stop : abandonner la revue en cours");
|
|
|
|
|
bot.sendMessage(sender, " !licence : afficher la licence du logiciel Hebdobot et le lien vers ses sources");
|
2019-05-02 13:30:39 +02:00
|
|
|
|
bot.sendMessage(sender, " !record : affiche le record de participation à la revue");
|
2018-09-21 01:04:12 +02:00
|
|
|
|
bot.sendMessage(sender, " !stats : statistiques sur les précédentes revues");
|
2019-05-02 13:30:39 +02:00
|
|
|
|
bot.sendMessage(sender, " !version : afficher la version d'Hebdobot");
|
2018-09-21 01:04:12 +02:00
|
|
|
|
bot.sendMessage(sender, " ");
|
|
|
|
|
bot.sendMessage(sender, "Autres commandes de dialogue : !bonjour, !date, !hello, !merci, !salut");
|
|
|
|
|
|
|
|
|
|
result = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
result = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|