diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml
index 217e5c5..9a55c2d 100644
--- a/.idea/kotlinc.xml
+++ b/.idea/kotlinc.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index d35a393..ff50536 100644
--- a/build.gradle
+++ b/build.gradle
@@ -3,15 +3,15 @@ import io.gitlab.arturbosch.detekt.DetektCreateBaselineTask
plugins {
id 'application'
- id 'com.github.ben-manes.versions' version '0.46.0'
+ id 'com.github.ben-manes.versions' version '0.47.0'
id 'idea'
- id 'io.gitlab.arturbosch.detekt' version '1.22.0'
+ id 'io.gitlab.arturbosch.detekt' version '1.23.0'
id 'java'
id 'net.thauvin.erik.gradle.semver' version '1.0.4'
- id 'org.jetbrains.kotlin.jvm' version '1.8.21'
- id 'org.jetbrains.kotlin.kapt' version '1.8.21'
- id 'org.jetbrains.kotlinx.kover' version '0.7.0'
- id 'org.sonarqube' version '4.0.0.2929'
+ id 'org.jetbrains.kotlin.jvm' version '1.8.22'
+ id 'org.jetbrains.kotlin.kapt' version '1.8.22'
+ id 'org.jetbrains.kotlinx.kover' version '0.7.1'
+ id 'org.sonarqube' version '4.2.1.3168'
id 'pmd'
}
@@ -59,11 +59,11 @@ dependencies {
// Google
implementation 'com.google.code.gson:gson:2.10.1'
- implementation 'com.google.guava:guava:31.1-jre'
+ implementation 'com.google.guava:guava:32.0.1-jre'
// Kotlin
implementation platform('org.jetbrains.kotlin:kotlin-bom')
- implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
+ implementation 'org.jetbrains.kotlin:kotlin-stdlib'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1'
implementation 'org.jetbrains.kotlinx:kotlinx-cli:0.3.5'
diff --git a/config/detekt/baseline.xml b/config/detekt/baseline.xml
index db7e772..356067c 100644
--- a/config/detekt/baseline.xml
+++ b/config/detekt/baseline.xml
@@ -27,6 +27,7 @@
MagicNumber:Mastodon.kt$Mastodon.Companion$200
MagicNumber:Mobibot.kt$Mobibot$8
MagicNumber:Modules.kt$Modules$7
+ MagicNumber:Seen.kt$Seen$8
MagicNumber:SocialManager.kt$SocialManager$1000L
MagicNumber:SocialManager.kt$SocialManager$60L
MagicNumber:StockQuote.kt$StockQuote.Companion$10
@@ -69,6 +70,7 @@
ReturnCount:Addons.kt$Addons$fun exec(channel: String, cmd: String, args: String, event: GenericMessageEvent): Boolean
ReturnCount:Addons.kt$Addons$fun help(channel: String, topic: String, event: GenericMessageEvent): Boolean
ReturnCount:ExceptionSanitizer.kt$ExceptionSanitizer$fun ModuleException.sanitize(vararg sanitize: String): ModuleException
+ ReturnCount:Seen.kt$Seen$override fun commandResponse(channel: String, args: String, event: GenericMessageEvent)
SwallowedException:GoogleSearchTest.kt$GoogleSearchTest$e: ModuleException
SwallowedException:StockQuoteTest.kt$StockQuoteTest$e: ModuleException
SwallowedException:WolframAlphaTest.kt$WolframAlphaTest$e: ModuleException
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 4a45598..fca143a 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
@@ -32,10 +32,14 @@
package net.thauvin.erik.mobibot.commands.seen
import com.google.common.collect.ImmutableSortedSet
+import net.thauvin.erik.mobibot.Utils
+import net.thauvin.erik.mobibot.Utils.bold
import net.thauvin.erik.mobibot.Utils.bot
import net.thauvin.erik.mobibot.Utils.helpFormat
+import net.thauvin.erik.mobibot.Utils.isChannelOp
import net.thauvin.erik.mobibot.Utils.loadSerialData
import net.thauvin.erik.mobibot.Utils.saveSerialData
+import net.thauvin.erik.mobibot.Utils.sendList
import net.thauvin.erik.mobibot.Utils.sendMessage
import net.thauvin.erik.mobibot.commands.AbstractCommand
import net.thauvin.erik.mobibot.commands.Info.Companion.toUptime
@@ -43,15 +47,19 @@ import org.pircbotx.User
import org.pircbotx.hooks.types.GenericMessageEvent
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import java.util.TreeMap
+import java.util.*
class Seen(private val serialObject: String) : AbstractCommand() {
private val logger: Logger = LoggerFactory.getLogger(Seen::class.java)
+ private val allKeyword = "all"
val seenNicks = TreeMap(NickComparator())
override val name = "seen"
override val help = listOf("To view when a nickname was last seen:", helpFormat("%c $name "))
+ private val helpOp = help.plus(
+ arrayOf("To view all ${"seen".bold()} nicks:", helpFormat("%c $name $allKeyword"))
+ )
override val isOpOnly = false
override val isPublic = true
override val isVisible = true
@@ -61,6 +69,11 @@ class Seen(private val serialObject: String) : AbstractCommand() {
if (isEnabled()) {
if (args.isNotBlank() && !args.contains(' ')) {
val ch = event.bot().userChannelDao.getChannel(channel)
+ if (args.equals(allKeyword) && ch.isOp(event.user) && seenNicks.isNotEmpty()) {
+ event.sendMessage("The ${"seen".bold()} nicks are:")
+ event.sendList(seenNicks.keys.toList(), 8, separator = ", ", isIndent = true)
+ return
+ }
ch.users.forEach {
if (args.equals(it.nick, true)) {
event.sendMessage("${it.nick} is on ${channel}.")
@@ -102,6 +115,17 @@ class Seen(private val serialObject: String) : AbstractCommand() {
fun count(): Int = seenNicks.size
+ override fun helpResponse(channel: String, topic: String, event: GenericMessageEvent): Boolean {
+ return if (event.isChannelOp(channel)) {
+ for (h in helpOp) {
+ event.sendMessage(Utils.helpCmdSyntax(h, event.bot().nick, true))
+ }
+ true
+ } else {
+ super.helpResponse(channel, topic, event)
+ }
+ }
+
fun load() {
if (isEnabled()) {
@Suppress("UNCHECKED_CAST")
diff --git a/src/main/kotlin/net/thauvin/erik/mobibot/entries/EntryComment.kt b/src/main/kotlin/net/thauvin/erik/mobibot/entries/EntryComment.kt
index bc64191..8de54e4 100644
--- a/src/main/kotlin/net/thauvin/erik/mobibot/entries/EntryComment.kt
+++ b/src/main/kotlin/net/thauvin/erik/mobibot/entries/EntryComment.kt
@@ -46,6 +46,6 @@ data class EntryComment(var comment: String, var nick: String) : Serializable {
companion object {
// Serial version UID
- const val serialVersionUID = 1L
+ private const val serialVersionUID: Long = 1L
}
}
diff --git a/src/main/kotlin/net/thauvin/erik/mobibot/entries/EntryLink.kt b/src/main/kotlin/net/thauvin/erik/mobibot/entries/EntryLink.kt
index 7bf003d..fc61d18 100644
--- a/src/main/kotlin/net/thauvin/erik/mobibot/entries/EntryLink.kt
+++ b/src/main/kotlin/net/thauvin/erik/mobibot/entries/EntryLink.kt
@@ -208,6 +208,6 @@ class EntryLink(
companion object {
// Serial version UID
- const val serialVersionUID = 1L
+ private const val serialVersionUID: Long = 1L
}
}
diff --git a/version.properties b/version.properties
index 4ce7fe9..9cd983c 100644
--- a/version.properties
+++ b/version.properties
@@ -1,9 +1,9 @@
#Generated by the Semver Plugin for Gradle
-#Tue May 23 08:26:47 PDT 2023
-version.buildmeta=1087
+#Sat Jun 17 21:28:53 PDT 2023
+version.buildmeta=1098
version.major=0
version.minor=8
version.patch=0
version.prerelease=rc
version.project=mobibot
-version.semver=0.8.0-rc+1087
+version.semver=0.8.0-rc+1098