From ed971a4e7a889c927d364d52b5fb044c94ddba16 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Sun, 2 Oct 2022 07:46:50 -0700 Subject: [PATCH] Added seen count to info --- build.gradle | 2 +- release.sh => deploy.sh | 0 src/main/kotlin/net/thauvin/erik/mobibot/Mobibot.kt | 2 +- src/main/kotlin/net/thauvin/erik/mobibot/commands/Info.kt | 6 +++++- .../kotlin/net/thauvin/erik/mobibot/commands/seen/Seen.kt | 2 ++ version.properties | 6 +++--- 6 files changed, 12 insertions(+), 6 deletions(-) rename release.sh => deploy.sh (100%) diff --git a/build.gradle b/build.gradle index f2a2531..731a3f9 100644 --- a/build.gradle +++ b/build.gradle @@ -30,7 +30,7 @@ mainClassName = packageName + '.Mobibot' ext.versions = [ log4j: '2.19.0', - pmd : '6.49.0', + pmd : '6.50.0', ] repositories { diff --git a/release.sh b/deploy.sh similarity index 100% rename from release.sh rename to deploy.sh diff --git a/src/main/kotlin/net/thauvin/erik/mobibot/Mobibot.kt b/src/main/kotlin/net/thauvin/erik/mobibot/Mobibot.kt index f19b95a..6dbe080 100644 --- a/src/main/kotlin/net/thauvin/erik/mobibot/Mobibot.kt +++ b/src/main/kotlin/net/thauvin/erik/mobibot/Mobibot.kt @@ -436,7 +436,7 @@ class Mobibot(nickname: String, val channel: String, logsDirPath: String, p: Pro addons.add(CurrencyConverter()) addons.add(Dice()) addons.add(GoogleSearch()) - addons.add(Info(tell)) + addons.add(Info(tell, seen)) addons.add(Joke()) addons.add(Lookup()) addons.add(Ping()) diff --git a/src/main/kotlin/net/thauvin/erik/mobibot/commands/Info.kt b/src/main/kotlin/net/thauvin/erik/mobibot/commands/Info.kt index a8d2dbf..98aaba9 100644 --- a/src/main/kotlin/net/thauvin/erik/mobibot/commands/Info.kt +++ b/src/main/kotlin/net/thauvin/erik/mobibot/commands/Info.kt @@ -40,13 +40,14 @@ import net.thauvin.erik.mobibot.Utils.plural import net.thauvin.erik.mobibot.Utils.sendList import net.thauvin.erik.mobibot.Utils.sendMessage import net.thauvin.erik.mobibot.commands.links.LinksMgr +import net.thauvin.erik.mobibot.commands.seen.Seen import net.thauvin.erik.mobibot.commands.tell.Tell import org.pircbotx.hooks.types.GenericMessageEvent import java.lang.management.ManagementFactory import kotlin.time.DurationUnit import kotlin.time.toDuration -class Info(private val tell: Tell) : AbstractCommand() { +class Info(private val tell: Tell, private val seen: Seen) : AbstractCommand() { private val allVersions = listOf( "${ReleaseInfo.PROJECT.capitalise()} ${ReleaseInfo.VERSION} (${ReleaseInfo.WEBSITE.green()})", "Written by ${ReleaseInfo.AUTHOR} (${ReleaseInfo.AUTHOR_URL.green()})" @@ -107,6 +108,9 @@ class Info(private val tell: Tell) : AbstractCommand() { .append(ManagementFactory.getRuntimeMXBean().uptime.toUptime()) .append(" [Entries: ") .append(LinksMgr.entries.links.size) + if (seen.isEnabled()) { + info.append(", Seen: ").append(seen.count()) + } if (isChannelOp(channel, event)) { if (tell.isEnabled()) { info.append(", Messages: ").append(tell.size()) diff --git a/src/main/kotlin/net/thauvin/erik/mobibot/commands/seen/Seen.kt b/src/main/kotlin/net/thauvin/erik/mobibot/commands/seen/Seen.kt index de7f70b..66a3259 100644 --- a/src/main/kotlin/net/thauvin/erik/mobibot/commands/seen/Seen.kt +++ b/src/main/kotlin/net/thauvin/erik/mobibot/commands/seen/Seen.kt @@ -101,6 +101,8 @@ class Seen(private val serialObject: String) : AbstractCommand() { seenNicks.clear() } + fun count(): Int = seenNicks.size + fun load() { if (isEnabled()) { @Suppress("UNCHECKED_CAST") diff --git a/version.properties b/version.properties index 719e92a..10429b8 100644 --- a/version.properties +++ b/version.properties @@ -1,9 +1,9 @@ #Generated by the Semver Plugin for Gradle -#Thu Sep 29 21:38:12 PDT 2022 -version.buildmeta=685 +#Sun Oct 02 07:45:05 PDT 2022 +version.buildmeta=689 version.major=0 version.minor=8 version.patch=0 version.prerelease=rc version.project=mobibot -version.semver=0.8.0-rc+685 +version.semver=0.8.0-rc+689