Upgraded strings library. Added !statut command. Extended salute

command.
This commit is contained in:
Christian P. MOMON 2017-12-28 05:12:19 +01:00
parent 81cd7d8673
commit faa3c14ddd
5 changed files with 48 additions and 3 deletions

View File

@ -46,7 +46,7 @@
<classpathentry kind="lib" path="lib/joda-time-2.8.1.jar"/>
<classpathentry kind="lib" path="lib/pircbot-1.5.0.jar"/>
<classpathentry kind="lib" path="lib/scribe-1.3.7.jar"/>
<classpathentry kind="lib" path="lib/devinsy-strings-0.4.2.jar" sourcepath="lib/devinsy-strings-0.4.2-sources.zip"/>
<classpathentry kind="lib" path="lib/quartz-2.2.3.jar" sourcepath="lib/quartz-2.2.3-source.zip"/>
<classpathentry kind="lib" path="lib/devinsy-strings-0.4.4.jar" sourcepath="lib/devinsy-strings-0.4.4-sources.zip"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@ -19,6 +19,8 @@
*/
package org.april.hebdobot.identica;
import org.apache.commons.lang3.StringUtils;
/**
* The Class IdenticaSettings.
*/
@ -37,6 +39,29 @@ public class IdenticaSettings
return this.apiSecret;
}
/**
* Checks if is valid.
*
* @return true, if is valid
*/
public boolean isValid()
{
boolean result;
if ((StringUtils.isBlank(this.apiKey)) || (StringUtils.isBlank(this.apiSecret)) || (StringUtils.containsOnly(this.apiKey, 'X'))
|| (StringUtils.containsOnly(this.apiSecret, 'X')))
{
result = false;
}
else
{
result = true;
}
//
return result;
}
public void setApiKey(final String apiKey)
{
this.apiKey = apiKey;

View File

@ -207,7 +207,7 @@ public class Hebdobot extends PircBot
}
catch (InterruptedException exception)
{
logger.warn("Pause abord: " + exception.getMessage());
logger.warn("Pause abort: " + exception.getMessage());
}
}
else
@ -419,6 +419,26 @@ public class Hebdobot extends PircBot
}
}
}
else if (StringUtils.equalsIgnoreCase(text, "!statut"))
{
logger.info("!status caught.");
sendMessage(sender, sender + ", voici l'état d'Hebdobot :");
sendMessage(sender, " revue en cours : " + (this.review == null));
if (this.review == null)
{
sendMessage(sender, " animateur revue : none");
}
else
{
sendMessage(sender, " animateur revue : " + this.review.getOwner());
}
sendMessage(sender, " Alias settings : " + (this.aliases.size()));
sendMessage(sender, " Identica settings : " + (this.identicaSettings.isValid()));
sendMessage(sender, " Pastebin settings : " + (this.pastebinSettings.isValid()));
sendMessage(sender, " Twitter settings : " + (this.twitterSettings.isValid()));
sendMessage(sender, " Cron settings : " + (this.cronSettings.size()));
}
else if (text.startsWith("%"))
{
logger.info("% caught.");
@ -439,7 +459,7 @@ public class Hebdobot extends PircBot
// Topic message.
if (this.review == null)
{
if ((StringUtils.containsIgnoreCase(text, "bonjour")) && (StringUtils.containsIgnoreCase(text, "hebdobot")))
if ((StringsUtils.containsAnyIgnoreCase(text, "bonjour", "salut", "hello")) && (StringUtils.containsIgnoreCase(text, "hebdobot")))
{
sendMessage(sender + ", bonjour \\o/");
}