Merge branch 'master' of /home/erik/projects/github/java/mobibot

This commit is contained in:
Erik C. Thauvin 2016-07-03 20:06:44 -07:00
commit 3f0c9102cd
5 changed files with 35 additions and 8 deletions

View file

@ -13,8 +13,8 @@ import java.util.Date;
* Annotation Processor</a>
*/
public final class ReleaseInfo {
private final static String buildmeta = "002";
private final static Date date = new Date(1467518031071L);
private final static String buildmeta = "004";
private final static Date date = new Date(1467595869139L);
private final static int major = 0;
private final static int minor = 7;
private final static int patch = 0;

View file

@ -1116,9 +1116,16 @@ public class Mobibot extends PircBot
private void infoResponse(final String sender, final boolean isPrivate)
{
for (final String info : INFO_STRS)
{
if (info.startsWith("http://"))
{
send(sender, Utils.green(info), isPrivate);
}
else
{
send(sender, info, isPrivate);
}
}
long timeInSeconds = (System.currentTimeMillis() - START_TIME) / 1000L;
@ -1131,7 +1138,8 @@ public class Mobibot extends PircBot
final long minutes = timeInSeconds / 60L;
send(sender,
"Uptime: " + days + " day(s) " + hours + " hour(s) " + minutes + " minute(s) [Entries: " + entries.size()
"Uptime: " + days + Utils.plural(days, " day ", " days ") + hours + Utils.plural(hours, " hour ", " hours ")
+ minutes + Utils.plural(minutes, " minute ", " minutes ") + "[Entries: " + entries.size()
+ (tell.isEnabled() && isOp(sender) ? ", Messages: " + tell.size() : "") + ']',
isPrivate);
}

View file

@ -216,7 +216,7 @@ public class Tell
bot.send(sender,
bot.helpIndent(bot.getNick() + ": " + TELL_CMD + ' ' + TELL_DEL_KEYWORD + " <id|"
+ TELL_ALL_KEYWORD + '>'));
bot.send(sender, "Messages are kept for " + Utils.bold(maxDays) + " days.");
bot.send(sender, "Messages are kept for " + Utils.bold(maxDays) + Utils.plural(maxDays, " day.", " days."));
}
}
}
@ -336,7 +336,7 @@ public class Tell
bot.send(sender, "To view queued and sent messages:");
bot.send(sender, bot.helpIndent(bot.getNick() + ": " + TELL_CMD + ' ' + Commands.VIEW_CMD));
bot.send(sender, "Messages are kept for " + Utils.bold(maxDays) + " days.");
bot.send(sender, "Messages are kept for " + Utils.bold(maxDays) + Utils.plural(maxDays, " day.", " days."));
}
/**

View file

@ -309,6 +309,25 @@ final public class Utils
return false;
}
/**
* Returns the plural form of a word, if count &gt; 1.
*
* @param count The count.
* @param word The word.
* @param plural The plural word.
*/
public static String plural(final long count, final String word, final String plural)
{
if (count > 1)
{
return plural;
}
else
{
return word;
}
}
/**
* Makes the given string reverse color.
*

View file

@ -5,4 +5,4 @@ version.major=0
version.minor=7
version.patch=0
version.prerelease=beta
version.buildmeta=002
version.buildmeta=004