diff --git a/src/main/java/net/thauvin/erik/mobibot/modules/CurrencyConverter.java b/src/main/java/net/thauvin/erik/mobibot/modules/CurrencyConverter.java index bd5664f..73e26ad 100644 --- a/src/main/java/net/thauvin/erik/mobibot/modules/CurrencyConverter.java +++ b/src/main/java/net/thauvin/erik/mobibot/modules/CurrencyConverter.java @@ -60,20 +60,14 @@ import java.util.TreeMap; * @since 1.0 */ public final class CurrencyConverter extends AbstractModule { - /** - * The rates keyword. - */ + // The rates keyword. static final String CURRENCY_RATES_KEYWORD = "rates"; - // The currency command. private static final String CURRENCY_CMD = "currency"; - // The exchange rates. private static final Map EXCHANGE_RATES = new TreeMap<>(); - // The exchange rates table URL. private static final String EXCHANGE_TABLE_URL = "https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml"; - // The last exchange rates table publication date. private static String pubDate = ""; @@ -203,7 +197,7 @@ public final class CurrencyConverter extends AbstractModule { try { final Message msg = convertCurrency(query); if (msg.isError()) { - helpResponse(bot, sender, CURRENCY_CMD + ' ' + query, true); + helpResponse(bot, sender, CURRENCY_CMD + ' ' + query, false); } bot.send(msg.isNotice() ? sender : bot.getChannel(), msg.getMessage()); } catch (ModuleException e) { diff --git a/src/main/java/net/thauvin/erik/mobibot/modules/Joke.java b/src/main/java/net/thauvin/erik/mobibot/modules/Joke.java index 7157814..074369b 100644 --- a/src/main/java/net/thauvin/erik/mobibot/modules/Joke.java +++ b/src/main/java/net/thauvin/erik/mobibot/modules/Joke.java @@ -32,9 +32,9 @@ package net.thauvin.erik.mobibot.modules; import net.thauvin.erik.mobibot.Mobibot; +import net.thauvin.erik.mobibot.Utils; import net.thauvin.erik.mobibot.msg.Message; import net.thauvin.erik.mobibot.msg.PublicMessage; -import org.jibble.pircbot.Colors; import org.json.JSONObject; import java.io.BufferedReader; @@ -51,14 +51,11 @@ import java.nio.charset.StandardCharsets; * @since 1.0 */ public final class Joke extends AbstractModule { - /** - * The joke command. - */ - public static final String JOKE_CMD = "joke"; - // The ICNDB URL. private static final String JOKE_URL = "http://api.icndb.com/jokes/random?escape=javascript&exclude=[explicit]&limitTo=[nerdy]"; + // The joke command. + private static final String JOKE_CMD = "joke"; /** * Creates a new {@link Joke} instance. @@ -87,6 +84,7 @@ public final class Joke extends AbstractModule { final JSONObject json = new JSONObject(sb.toString()); + //noinspection RegExpRedundantEscape return new PublicMessage( json.getJSONObject("value").get("joke").toString().replaceAll("\\'", "'") .replaceAll("\\\"", "\"")); @@ -118,7 +116,7 @@ public final class Joke extends AbstractModule { */ private void run(final Mobibot bot, final String sender) { try { - bot.send(bot.getChannel(), Colors.CYAN + randomJoke().getMessage() + Colors.NORMAL); + bot.send(bot.getChannel(), Utils.cyan(randomJoke().getMessage())); } catch (ModuleException e) { bot.getLogger().warn(e.getDebugMessage(), e); bot.send(sender, e.getMessage()); diff --git a/src/main/java/net/thauvin/erik/mobibot/modules/Twitter.java b/src/main/java/net/thauvin/erik/mobibot/modules/Twitter.java index 6a1dd9f..14d508a 100644 --- a/src/main/java/net/thauvin/erik/mobibot/modules/Twitter.java +++ b/src/main/java/net/thauvin/erik/mobibot/modules/Twitter.java @@ -44,16 +44,13 @@ import twitter4j.conf.ConfigurationBuilder; * @since 1.0 */ public final class Twitter extends ThreadedModule { - /** - * The twitter command. - */ - public static final String TWITTER_CMD = "twitter"; - // The property keys. private static final String CONSUMER_KEY_PROP = "twitter-consumerKey"; private static final String CONSUMER_SECRET_PROP = "twitter-consumerSecret"; private static final String TOKEN_PROP = "twitter-token"; private static final String TOKEN_SECRET_PROP = "twitter-tokenSecret"; + // The twitter command. + private static final String TWITTER_CMD = "twitter"; /** * Creates a new {@link Twitter} instance.