Fixed else caught. Improved isValid.

This commit is contained in:
Christian P. MOMON 2017-12-26 02:16:40 +01:00
parent f983bc3f74
commit 2ca03e358d
4 changed files with 22 additions and 13 deletions

View File

@ -242,6 +242,7 @@ public class Hebdobot extends PircBot
{ {
String date = ISODateTimeFormat.basicDate().print(new DateTime()); String date = ISODateTimeFormat.basicDate().print(new DateTime());
String textReview = this.review.toString(); String textReview = this.review.toString();
if (this.pastebinSettings.isValid()) if (this.pastebinSettings.isValid())
{ {
logger.info("Pastebin the review."); logger.info("Pastebin the review.");
@ -394,15 +395,7 @@ public class Hebdobot extends PircBot
{ {
logger.info("% caught."); logger.info("% caught.");
// Topic message. // Ignore.
if (this.review == null)
{
sendMessage("Pas de revue en cours.");
}
else
{
this.review.add(new Message(sender, text));
}
} }
else if (text.startsWith("!")) else if (text.startsWith("!"))
{ {
@ -415,12 +408,27 @@ public class Hebdobot extends PircBot
{ {
logger.info("Else caught."); logger.info("Else caught.");
// Topic message.
if (this.review == null)
{
sendMessage("Pas de revue en cours.");
}
else
{
this.review.add(new Message(sender, text));
}
}
/*
else
{
logger.info("Else caught.");
// All the other. // All the other.
if (this.review != null) if (this.review != null)
{ {
this.review.addRaw(new Message(sender, text)); this.review.addRaw(new Message(sender, text));
} }
} }*/
} }
} }

View File

@ -60,7 +60,7 @@ public class PastebinSettings
{ {
boolean result; boolean result;
if (StringUtils.isBlank(this.apiKey)) if ((StringUtils.isBlank(this.apiKey)) || (StringUtils.containsOnly(this.apiKey, 'X')))
{ {
result = false; result = false;
} }

View File

@ -184,7 +184,7 @@ public class Review
{ {
String result; String result;
final StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
addLine(buffer, '='); addLine(buffer, '=');
addCenter(buffer, "Revue de la semaine en cours"); addCenter(buffer, "Revue de la semaine en cours");
addEmpty(buffer); addEmpty(buffer);

View File

@ -73,7 +73,8 @@ public class TwitterSettings
{ {
boolean result; boolean result;
if ((StringUtils.isBlank(this.consumerKey)) || (StringUtils.isBlank(this.consumerSecret))) if ((StringUtils.isBlank(this.consumerKey)) || (StringUtils.isBlank(this.consumerSecret)) || (StringUtils.containsOnly(this.consumerKey, 'X'))
|| (StringUtils.containsOnly(this.consumerSecret, 'X')))
{ {
result = false; result = false;
} }