Added seen count to info

This commit is contained in:
Erik C. Thauvin 2022-10-02 07:46:50 -07:00
parent c0f5a8bad3
commit ed971a4e7a
6 changed files with 12 additions and 6 deletions

View file

@ -30,7 +30,7 @@ mainClassName = packageName + '.Mobibot'
ext.versions = [ ext.versions = [
log4j: '2.19.0', log4j: '2.19.0',
pmd : '6.49.0', pmd : '6.50.0',
] ]
repositories { repositories {

View file

@ -436,7 +436,7 @@ class Mobibot(nickname: String, val channel: String, logsDirPath: String, p: Pro
addons.add(CurrencyConverter()) addons.add(CurrencyConverter())
addons.add(Dice()) addons.add(Dice())
addons.add(GoogleSearch()) addons.add(GoogleSearch())
addons.add(Info(tell)) addons.add(Info(tell, seen))
addons.add(Joke()) addons.add(Joke())
addons.add(Lookup()) addons.add(Lookup())
addons.add(Ping()) addons.add(Ping())

View file

@ -40,13 +40,14 @@ import net.thauvin.erik.mobibot.Utils.plural
import net.thauvin.erik.mobibot.Utils.sendList import net.thauvin.erik.mobibot.Utils.sendList
import net.thauvin.erik.mobibot.Utils.sendMessage import net.thauvin.erik.mobibot.Utils.sendMessage
import net.thauvin.erik.mobibot.commands.links.LinksMgr 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 net.thauvin.erik.mobibot.commands.tell.Tell
import org.pircbotx.hooks.types.GenericMessageEvent import org.pircbotx.hooks.types.GenericMessageEvent
import java.lang.management.ManagementFactory import java.lang.management.ManagementFactory
import kotlin.time.DurationUnit import kotlin.time.DurationUnit
import kotlin.time.toDuration 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( private val allVersions = listOf(
"${ReleaseInfo.PROJECT.capitalise()} ${ReleaseInfo.VERSION} (${ReleaseInfo.WEBSITE.green()})", "${ReleaseInfo.PROJECT.capitalise()} ${ReleaseInfo.VERSION} (${ReleaseInfo.WEBSITE.green()})",
"Written by ${ReleaseInfo.AUTHOR} (${ReleaseInfo.AUTHOR_URL.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(ManagementFactory.getRuntimeMXBean().uptime.toUptime())
.append(" [Entries: ") .append(" [Entries: ")
.append(LinksMgr.entries.links.size) .append(LinksMgr.entries.links.size)
if (seen.isEnabled()) {
info.append(", Seen: ").append(seen.count())
}
if (isChannelOp(channel, event)) { if (isChannelOp(channel, event)) {
if (tell.isEnabled()) { if (tell.isEnabled()) {
info.append(", Messages: ").append(tell.size()) info.append(", Messages: ").append(tell.size())

View file

@ -101,6 +101,8 @@ class Seen(private val serialObject: String) : AbstractCommand() {
seenNicks.clear() seenNicks.clear()
} }
fun count(): Int = seenNicks.size
fun load() { fun load() {
if (isEnabled()) { if (isEnabled()) {
@Suppress("UNCHECKED_CAST") @Suppress("UNCHECKED_CAST")

View file

@ -1,9 +1,9 @@
#Generated by the Semver Plugin for Gradle #Generated by the Semver Plugin for Gradle
#Thu Sep 29 21:38:12 PDT 2022 #Sun Oct 02 07:45:05 PDT 2022
version.buildmeta=685 version.buildmeta=689
version.major=0 version.major=0
version.minor=8 version.minor=8
version.patch=0 version.patch=0
version.prerelease=rc version.prerelease=rc
version.project=mobibot version.project=mobibot
version.semver=0.8.0-rc+685 version.semver=0.8.0-rc+689