Introduced private message management.
This commit is contained in:
parent
030398dde7
commit
1d21c44dab
1 changed files with 47 additions and 25 deletions
|
@ -240,30 +240,6 @@ public class Hebdobot extends PircBot
|
|||
sendMessage(sender, " !aide : afficher cette aide");
|
||||
sendMessage(sender, " !licence,!license : affiche la licence du logiciel Hebdobot et le lien vers ses sources");
|
||||
sendMessage(sender, " !stop : abandonner la revue en cours");
|
||||
sendMessage(sender, " !vaten : faire partir le bot");
|
||||
}
|
||||
else if (StringUtils.equalsIgnoreCase(text, "!vaten"))
|
||||
{
|
||||
logger.info("!die caught.");
|
||||
|
||||
// Die.
|
||||
if (this.review == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
sendMessage(sender + ", ok bye.");
|
||||
Thread.sleep(1000);
|
||||
System.exit(0);
|
||||
}
|
||||
catch (InterruptedException exception)
|
||||
{
|
||||
logger.warn("Pause abort: " + exception.getMessage());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sendMessage("% Une revue est en cours, abandon impossible.");
|
||||
}
|
||||
}
|
||||
else if (StringUtils.equalsIgnoreCase(text, "!stop"))
|
||||
{
|
||||
|
@ -554,6 +530,52 @@ public class Hebdobot extends PircBot
|
|||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.jibble.pircbot.PircBot#onPrivateMessage(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
protected void onPrivateMessage(final String sender, final String login, final String hostname, final String message)
|
||||
{
|
||||
logger.debug("Private message received - sender : {}, message : {}", sender, message);
|
||||
|
||||
String text = message.trim();
|
||||
|
||||
if (StringUtils.equalsIgnoreCase(text, "!vaten"))
|
||||
{
|
||||
logger.info("!die caught.");
|
||||
|
||||
// Die.
|
||||
if (this.review == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
sendMessage(sender + ", ok bye.");
|
||||
Thread.sleep(1000);
|
||||
System.exit(0);
|
||||
}
|
||||
catch (InterruptedException exception)
|
||||
{
|
||||
logger.warn("Pause abort: " + exception.getMessage());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sendMessage("% Une revue est en cours, abandon impossible.");
|
||||
}
|
||||
}
|
||||
else if (text.startsWith("!"))
|
||||
{
|
||||
logger.info("!??? caught.");
|
||||
|
||||
// Command unknown.
|
||||
sendMessage(sender + ", command unknown: " + text);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Nothing to say.
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Inits the.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue