diff --git a/src/main/java/net/thauvin/erik/mobibot/Mobibot.kt b/src/main/java/net/thauvin/erik/mobibot/Mobibot.kt index 1900992..7028c22 100644 --- a/src/main/java/net/thauvin/erik/mobibot/Mobibot.kt +++ b/src/main/java/net/thauvin/erik/mobibot/Mobibot.kt @@ -258,10 +258,10 @@ class Mobibot(nickname: String, channel: String, logsDirPath: String, p: Propert isPrivate ) send(sender, "The commands are:", isPrivate) - sendList(sender, addons.names, 8, isPrivate, true) + sendList(sender, addons.names, 8, isPrivate, isBold = true, isIndent = true) if (isOp) { send(sender, "The op commands are:", isPrivate) - sendList(sender, addons.ops, 8, isPrivate, true) + sendList(sender, addons.ops, 8, isPrivate, isBold = true, isIndent = true) } } @@ -462,10 +462,8 @@ class Mobibot(nickname: String, channel: String, logsDirPath: String, p: Propert list: List, maxPerLine: Int, isPrivate: Boolean, - isBold: Boolean - ) { - var i = 0 - while (i < list.size) { + isBold: Boolean = false, + isIndent: Boolean = false while (i < list.size) { send( nick, helpFormat( diff --git a/src/main/java/net/thauvin/erik/mobibot/commands/AbstractCommand.kt b/src/main/java/net/thauvin/erik/mobibot/commands/AbstractCommand.kt index 3168dde..862ca6a 100644 --- a/src/main/java/net/thauvin/erik/mobibot/commands/AbstractCommand.kt +++ b/src/main/java/net/thauvin/erik/mobibot/commands/AbstractCommand.kt @@ -56,7 +56,7 @@ abstract class AbstractCommand(val bot: Mobibot) { open fun helpResponse(command: String, sender: String, isOp: Boolean, isPrivate: Boolean): Boolean { if (!this.isOp || this.isOp == isOp) { for (h in help) { - bot.send(sender, Utils.helpFormat(h, bot.nick, isPrivate), isPrivate) + bot.send(sender, Utils.buildCmdSyntax(h, bot.nick, isPrivate), isPrivate) } return true } diff --git a/src/main/java/net/thauvin/erik/mobibot/commands/AddLog.kt b/src/main/java/net/thauvin/erik/mobibot/commands/AddLog.kt index 2848369..7f7f567 100644 --- a/src/main/java/net/thauvin/erik/mobibot/commands/AddLog.kt +++ b/src/main/java/net/thauvin/erik/mobibot/commands/AddLog.kt @@ -63,7 +63,7 @@ class AddLog(bot: Mobibot) : AbstractCommand(bot) { return } } - bot.sendList(sender, history, 4, isPrivate, false) + bot.sendList(sender, history, 4, isPrivate, isIndent = true) } } } diff --git a/src/main/java/net/thauvin/erik/mobibot/commands/Ignore.kt b/src/main/java/net/thauvin/erik/mobibot/commands/Ignore.kt index 10f8fe6..91ea685 100644 --- a/src/main/java/net/thauvin/erik/mobibot/commands/Ignore.kt +++ b/src/main/java/net/thauvin/erik/mobibot/commands/Ignore.kt @@ -141,7 +141,7 @@ class Ignore(bot: Mobibot) : AbstractCommand(bot) { if (ignored.size > 0) { bot.send(sender, "The following nicks are ignored:", isPrivate) - bot.sendList(sender, ignored.toList(), 8, isPrivate, true) + bot.sendList(sender, ignored.sorted(), 8, isPrivate, isIndent = true) } else { bot.send(sender, "No one is currently ${Utils.bold("ignored")}.", isPrivate) } diff --git a/src/main/java/net/thauvin/erik/mobibot/commands/Info.java b/src/main/java/net/thauvin/erik/mobibot/commands/Info.java index d16bd92..a9bf07b 100644 --- a/src/main/java/net/thauvin/erik/mobibot/commands/Info.java +++ b/src/main/java/net/thauvin/erik/mobibot/commands/Info.java @@ -85,9 +85,7 @@ public class Info extends AbstractCommand { @NotNull final String args, final boolean isOp, final boolean isPrivate) { - for (final String v : version) { - getBot().send(sender, v, isPrivate); - } + getBot().sendList(sender, allVersions, 1, isPrivate, false, false); final StringBuilder info = new StringBuilder("Uptime: "); diff --git a/src/main/java/net/thauvin/erik/mobibot/commands/Modules.kt b/src/main/java/net/thauvin/erik/mobibot/commands/Modules.kt index f3f3960..a9493fa 100644 --- a/src/main/java/net/thauvin/erik/mobibot/commands/Modules.kt +++ b/src/main/java/net/thauvin/erik/mobibot/commands/Modules.kt @@ -58,7 +58,7 @@ class Modules(bot: Mobibot) : AbstractCommand(bot) { send(sender, "There are no enabled modules.", isPrivate) } else { send(sender, "The enabled modules are: ", isPrivate) - sendList(sender, modulesNames, 7, isPrivate, false) + sendList(sender, modulesNames, 7, isPrivate, isIndent = true) } } else { helpDefault(sender, isOp, isPrivate) diff --git a/src/main/java/net/thauvin/erik/mobibot/commands/Users.kt b/src/main/java/net/thauvin/erik/mobibot/commands/Users.kt index 5afdf5a..e3a868a 100644 --- a/src/main/java/net/thauvin/erik/mobibot/commands/Users.kt +++ b/src/main/java/net/thauvin/erik/mobibot/commands/Users.kt @@ -64,6 +64,6 @@ class Users(bot: Mobibot) : AbstractCommand(bot) { } } - bot.sendList(sender, nicks.sorted(), 8, isPrivate, false) + bot.sendList(sender, nicks.sorted(), 8, isPrivate, isIndent = true) } } diff --git a/src/main/java/net/thauvin/erik/mobibot/commands/Versions.java b/src/main/java/net/thauvin/erik/mobibot/commands/Versions.java index 8a2f168..662d073 100644 --- a/src/main/java/net/thauvin/erik/mobibot/commands/Versions.java +++ b/src/main/java/net/thauvin/erik/mobibot/commands/Versions.java @@ -40,7 +40,7 @@ import org.jetbrains.annotations.NotNull; import java.util.List; public class Versions extends AbstractCommand { - private final List verList = + private final List allVersions = List.of("Version: " + ReleaseInfo.VERSION + " (" + Utils.isoLocalDate(ReleaseInfo.BUILDDATE) + ')', "Platform: " + System.getProperty("os.name") + ' ' + System.getProperty("os.version") + " (" + System.getProperty("os.arch") + ')', @@ -86,9 +86,7 @@ public class Versions extends AbstractCommand { final boolean isOp, final boolean isPrivate) { if (isOp) { - for (final String v : verList) { - getBot().send(sender, v, isPrivate); - } + getBot().sendList(sender, allVersions, 1, isPrivate, false, false); } else { getBot().helpDefault(sender, false, isPrivate); } diff --git a/src/main/java/net/thauvin/erik/mobibot/modules/AbstractModule.kt b/src/main/java/net/thauvin/erik/mobibot/modules/AbstractModule.kt index eb97e4f..695549d 100644 --- a/src/main/java/net/thauvin/erik/mobibot/modules/AbstractModule.kt +++ b/src/main/java/net/thauvin/erik/mobibot/modules/AbstractModule.kt @@ -76,7 +76,7 @@ abstract class AbstractModule(val bot: Mobibot) { */ open fun helpResponse(sender: String, isPrivate: Boolean) { for (h in help) { - bot.send(sender, Utils.helpFormat(h, bot.nick, isPrivateMsgEnabled && isPrivate), isPrivate) + bot.send(sender, Utils.buildCmdSyntax(h, bot.nick, isPrivateMsgEnabled && isPrivate), isPrivate) } } diff --git a/src/main/java/net/thauvin/erik/mobibot/modules/CurrencyConverter.kt b/src/main/java/net/thauvin/erik/mobibot/modules/CurrencyConverter.kt index ded4a6b..279f748 100644 --- a/src/main/java/net/thauvin/erik/mobibot/modules/CurrencyConverter.kt +++ b/src/main/java/net/thauvin/erik/mobibot/modules/CurrencyConverter.kt @@ -86,7 +86,7 @@ class CurrencyConverter(bot: Mobibot) : ThreadedModule(bot) { } } else if (args.contains(CURRENCY_RATES_KEYWORD)) { send(sender, "The currency rates for ${Utils.bold(pubDate)} are:", isPrivate) - sendList(sender, currencyRates(), 3, isPrivate, false) + sendList(sender, currencyRates(), 3, isPrivate, isIndent = true) } else { helpResponse(sender, isPrivate) } @@ -122,7 +122,7 @@ class CurrencyConverter(bot: Mobibot) : ThreadedModule(bot) { isPrivate ) send(sender, "The supported currencies are: ", isPrivate) - sendList(sender, ArrayList(EXCHANGE_RATES.keys), 11, isPrivate, false) + sendList(sender, ArrayList(EXCHANGE_RATES.keys), 11, isPrivate, isIndent = true) } } } diff --git a/src/main/java/net/thauvin/erik/mobibot/modules/WorldTime.kt b/src/main/java/net/thauvin/erik/mobibot/modules/WorldTime.kt index 7695b0b..ed7ad74 100644 --- a/src/main/java/net/thauvin/erik/mobibot/modules/WorldTime.kt +++ b/src/main/java/net/thauvin/erik/mobibot/modules/WorldTime.kt @@ -191,7 +191,7 @@ class WorldTime(bot: Mobibot) : AbstractModule(bot) { with(bot) { if (args.isEmpty()) { send(sender, "The supported countries/zones are: ", isPrivate) - sendList(sender, ArrayList(COUNTRIES_MAP.keys), 17, isPrivate = false, isBold = false) + sendList(sender, ArrayList(COUNTRIES_MAP.keys), 17, isPrivate = false) } else { val msg = worldTime(args) if (isPrivate) {