Upgraded to Koltin 1.9.0

This commit is contained in:
Erik C. Thauvin 2023-07-06 10:23:04 -07:00
parent 5834a23b7e
commit 2313d36584
76 changed files with 549 additions and 645 deletions

View file

@ -1,6 +1,5 @@
<component name="ProjectCodeStyleConfiguration"> <component name="ProjectCodeStyleConfiguration">
<state> <state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" /> <option name="PREFERRED_PROJECT_CODE_STYLE" value="Erik's Code Style" />
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
</state> </state>
</component> </component>

2
.idea/kotlinc.xml generated
View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="KotlinJpsPluginSettings"> <component name="KotlinJpsPluginSettings">
<option name="version" value="1.8.22" /> <option name="version" value="1.9.0" />
</component> </component>
</project> </project>

View file

@ -1,7 +1,7 @@
# mobibot # mobibot
[![License (3-Clause BSD)](https://img.shields.io/badge/license-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause) [![License (3-Clause BSD)](https://img.shields.io/badge/license-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)
[![Kotlin](https://img.shields.io/badge/kotlin-1.8.22-7f52ff.svg)](https://kotlinlang.org) [![Kotlin](https://img.shields.io/badge/kotlin-1.9.0-7f52ff.svg)](https://kotlinlang.org)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=ethauvin_mobibot&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=ethauvin_mobibot) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=ethauvin_mobibot&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=ethauvin_mobibot)
[![GitHub CI](https://github.com/ethauvin/mobibot/actions/workflows/gradle.yml/badge.svg)](https://github.com/ethauvin/mobibot/actions/workflows/gradle.yml) [![GitHub CI](https://github.com/ethauvin/mobibot/actions/workflows/gradle.yml/badge.svg)](https://github.com/ethauvin/mobibot/actions/workflows/gradle.yml)
[![CircleCI](https://circleci.com/gh/ethauvin/mobibot/tree/master.svg?style=shield)](https://circleci.com/gh/ethauvin/mobibot/tree/master) [![CircleCI](https://circleci.com/gh/ethauvin/mobibot/tree/master.svg?style=shield)](https://circleci.com/gh/ethauvin/mobibot/tree/master)

View file

@ -10,8 +10,8 @@ plugins {
id 'io.gitlab.arturbosch.detekt' version '1.23.0' id 'io.gitlab.arturbosch.detekt' version '1.23.0'
id 'java' id 'java'
id 'net.thauvin.erik.gradle.semver' version '1.0.4' id 'net.thauvin.erik.gradle.semver' version '1.0.4'
id 'org.jetbrains.kotlin.jvm' version '1.8.22' id 'org.jetbrains.kotlin.jvm' version '1.9.0'
id 'org.jetbrains.kotlin.kapt' version '1.8.22' id 'org.jetbrains.kotlin.kapt' version '1.9.0'
id 'org.jetbrains.kotlinx.kover' version '0.7.2' id 'org.jetbrains.kotlinx.kover' version '0.7.2'
id 'org.sonarqube' version '4.2.1.3168' id 'org.sonarqube' version '4.2.1.3168'
id 'pmd' id 'pmd'

View file

@ -46,6 +46,15 @@
<ID>MagicNumber:WorldTime.kt$WorldTime.Companion$3600</ID> <ID>MagicNumber:WorldTime.kt$WorldTime.Companion$3600</ID>
<ID>MagicNumber:WorldTime.kt$WorldTime.Companion$60</ID> <ID>MagicNumber:WorldTime.kt$WorldTime.Companion$60</ID>
<ID>MagicNumber:WorldTime.kt$WorldTime.Companion$86.4</ID> <ID>MagicNumber:WorldTime.kt$WorldTime.Companion$86.4</ID>
<ID>MaxLineLength:DiceTest.kt$DiceTest$.</ID>
<ID>MaxLineLength:Lookup.kt$Lookup$("(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)")</ID>
<ID>MaxLineLength:Mastodon.kt$Mastodon.Companion$mapOf("status" to "${handle?.prefixIfMissing('@')} $message", "visibility" to "direct")</ID>
<ID>MaxLineLength:Mobibot.kt$Mobibot$helpCmdSyntax("%c ${Constants.HELP_CMD} &lt;command&gt;", event.bot().nick, event is PrivateMessageEvent)</ID>
<ID>MaxLineLength:PinboardTest.kt$PinboardTest$URL("https://api.pinboard.in/v1/posts/get?auth_token=${apiToken}&amp;tag=test&amp;" + url.encodeUrl()).reader().body</ID>
<ID>MaxLineLength:StockQuote.kt$StockQuote.Companion$+</ID>
<ID>MaxLineLength:Utils.kt$Utils$list.subList(i, list.size.coerceAtMost(i + maxPerLine)).joinToString(separator, truncated = "")</ID>
<ID>MaxLineLength:View.kt$View$helpCmdSyntax("%c $name ${index + 1} $query", event.bot().nick, event is PrivateMessageEvent)</ID>
<ID>MaxLineLength:Weather2.kt$Weather2.Companion$country.name.replace('_', ' ').capitalizeWords()</ID>
<ID>NestedBlockDepth:Addons.kt$Addons$fun add(command: AbstractCommand): Boolean</ID> <ID>NestedBlockDepth:Addons.kt$Addons$fun add(command: AbstractCommand): Boolean</ID>
<ID>NestedBlockDepth:Addons.kt$Addons$fun add(module: AbstractModule): Boolean</ID> <ID>NestedBlockDepth:Addons.kt$Addons$fun add(module: AbstractModule): Boolean</ID>
<ID>NestedBlockDepth:ChatGpt.kt$ChatGpt.Companion$@JvmStatic @Throws(ModuleException::class) fun chat(query: String, apiKey: String?, maxTokens: Int): String</ID> <ID>NestedBlockDepth:ChatGpt.kt$ChatGpt.Companion$@JvmStatic @Throws(ModuleException::class) fun chat(query: String, apiKey: String?, maxTokens: Int): String</ID>
@ -87,6 +96,23 @@
<ID>TooManyFunctions:EntryLink.kt$EntryLink : Serializable</ID> <ID>TooManyFunctions:EntryLink.kt$EntryLink : Serializable</ID>
<ID>TooManyFunctions:Mobibot.kt$Mobibot : ListenerAdapter</ID> <ID>TooManyFunctions:Mobibot.kt$Mobibot : ListenerAdapter</ID>
<ID>TooManyFunctions:Tell.kt$Tell : AbstractCommand</ID> <ID>TooManyFunctions:Tell.kt$Tell : AbstractCommand</ID>
<ID>WildcardImport:AddonsTest.kt$import net.thauvin.erik.mobibot.modules.*</ID>
<ID>WildcardImport:EntryLinkTest.kt$import assertk.assertions.*</ID>
<ID>WildcardImport:FeedMgrTest.kt$import assertk.assertions.*</ID>
<ID>WildcardImport:FeedReaderTest.kt$import assertk.assertions.*</ID> <ID>WildcardImport:FeedReaderTest.kt$import assertk.assertions.*</ID>
<ID>WildcardImport:FeedsManager.kt$import com.rometools.rome.feed.synd.*</ID>
<ID>WildcardImport:GoogleSearchTest.kt$import assertk.assertions.*</ID>
<ID>WildcardImport:JokeTest.kt$import assertk.assertions.*</ID>
<ID>WildcardImport:Mobibot.kt$import java.io.*</ID>
<ID>WildcardImport:Mobibot.kt$import net.thauvin.erik.mobibot.commands.*</ID>
<ID>WildcardImport:Mobibot.kt$import net.thauvin.erik.mobibot.commands.links.*</ID>
<ID>WildcardImport:Mobibot.kt$import net.thauvin.erik.mobibot.modules.*</ID>
<ID>WildcardImport:Mobibot.kt$import org.pircbotx.hooks.events.*</ID>
<ID>WildcardImport:ModuleExceptionTest.kt$import assertk.assertions.*</ID>
<ID>WildcardImport:SeenTest.kt$import assertk.assertions.*</ID>
<ID>WildcardImport:StockQuoteTest.kt$import assertk.assertions.*</ID>
<ID>WildcardImport:TellMessagesMgrTest.kt$import assertk.assertions.*</ID>
<ID>WildcardImport:Utils.kt$import java.io.*</ID>
<ID>WildcardImport:Weather2Test.kt$import assertk.assertions.*</ID>
</CurrentIssues> </CurrentIssues>
</SmellBaseline> </SmellBaseline>

View file

@ -72,6 +72,12 @@ public final class War extends AbstractModule {
help.add(Utils.helpFormat("%c " + WAR_CMD)); help.add(Utils.helpFormat("%c " + WAR_CMD));
} }
@NotNull
@Override
public String getName() {
return "War";
}
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@ -99,10 +105,4 @@ public final class War extends AbstractModule {
} while (i == y); } while (i == y);
} }
@NotNull
@Override
public String getName() {
return "War";
}
} }

View file

@ -38,7 +38,7 @@ import org.pircbotx.hooks.events.PrivateMessageEvent
import org.pircbotx.hooks.types.GenericMessageEvent import org.pircbotx.hooks.types.GenericMessageEvent
import org.slf4j.Logger import org.slf4j.Logger
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
import java.util.Properties import java.util.*
/** /**
* Modules and Commands addons. * Modules and Commands addons.

View file

@ -45,67 +45,24 @@ import net.thauvin.erik.mobibot.Utils.lastOrEmpty
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.Utils.toIsoLocalDate import net.thauvin.erik.mobibot.Utils.toIsoLocalDate
import net.thauvin.erik.mobibot.commands.ChannelFeed import net.thauvin.erik.mobibot.commands.*
import net.thauvin.erik.mobibot.commands.Cycle
import net.thauvin.erik.mobibot.commands.Die
import net.thauvin.erik.mobibot.commands.Ignore
import net.thauvin.erik.mobibot.commands.Info
import net.thauvin.erik.mobibot.commands.Me
import net.thauvin.erik.mobibot.commands.Modules
import net.thauvin.erik.mobibot.commands.Msg
import net.thauvin.erik.mobibot.commands.Nick
import net.thauvin.erik.mobibot.commands.Recap
import net.thauvin.erik.mobibot.commands.Recap.Companion.storeRecap import net.thauvin.erik.mobibot.commands.Recap.Companion.storeRecap
import net.thauvin.erik.mobibot.commands.Say import net.thauvin.erik.mobibot.commands.links.*
import net.thauvin.erik.mobibot.commands.Users
import net.thauvin.erik.mobibot.commands.Versions
import net.thauvin.erik.mobibot.commands.links.Comment
import net.thauvin.erik.mobibot.commands.links.LinksManager
import net.thauvin.erik.mobibot.commands.links.Posting
import net.thauvin.erik.mobibot.commands.links.Tags
import net.thauvin.erik.mobibot.commands.links.View
import net.thauvin.erik.mobibot.commands.seen.Seen 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 net.thauvin.erik.mobibot.modules.Calc import net.thauvin.erik.mobibot.modules.*
import net.thauvin.erik.mobibot.modules.ChatGpt
import net.thauvin.erik.mobibot.modules.CryptoPrices
import net.thauvin.erik.mobibot.modules.CurrencyConverter
import net.thauvin.erik.mobibot.modules.Dice
import net.thauvin.erik.mobibot.modules.GoogleSearch
import net.thauvin.erik.mobibot.modules.Joke
import net.thauvin.erik.mobibot.modules.Lookup
import net.thauvin.erik.mobibot.modules.Mastodon
import net.thauvin.erik.mobibot.modules.Ping
import net.thauvin.erik.mobibot.modules.RockPaperScissors
import net.thauvin.erik.mobibot.modules.StockQuote
import net.thauvin.erik.mobibot.modules.War
import net.thauvin.erik.mobibot.modules.Weather2
import net.thauvin.erik.mobibot.modules.WolframAlpha
import net.thauvin.erik.mobibot.modules.WorldTime
import net.thauvin.erik.semver.Version import net.thauvin.erik.semver.Version
import org.pircbotx.Configuration import org.pircbotx.Configuration
import org.pircbotx.PircBotX import org.pircbotx.PircBotX
import org.pircbotx.hooks.ListenerAdapter import org.pircbotx.hooks.ListenerAdapter
import org.pircbotx.hooks.events.ActionEvent import org.pircbotx.hooks.events.*
import org.pircbotx.hooks.events.DisconnectEvent
import org.pircbotx.hooks.events.JoinEvent
import org.pircbotx.hooks.events.MessageEvent
import org.pircbotx.hooks.events.NickChangeEvent
import org.pircbotx.hooks.events.PartEvent
import org.pircbotx.hooks.events.PrivateMessageEvent
import org.pircbotx.hooks.events.QuitEvent
import org.pircbotx.hooks.types.GenericMessageEvent import org.pircbotx.hooks.types.GenericMessageEvent
import org.slf4j.Logger import org.slf4j.Logger
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
import java.io.BufferedOutputStream import java.io.*
import java.io.File
import java.io.FileNotFoundException
import java.io.FileOutputStream
import java.io.IOException
import java.io.PrintStream
import java.nio.file.Files import java.nio.file.Files
import java.nio.file.Paths import java.nio.file.Paths
import java.util.Properties import java.util.*
import java.util.regex.Pattern import java.util.regex.Pattern
import kotlin.system.exitProcess import kotlin.system.exitProcess

View file

@ -37,7 +37,7 @@ import java.time.ZoneId
import java.time.ZonedDateTime import java.time.ZonedDateTime
import java.time.format.DateTimeFormatter import java.time.format.DateTimeFormatter
import java.time.temporal.ChronoUnit import java.time.temporal.ChronoUnit
import java.util.Date import java.util.*
/** /**
* Handles posts to pinboard.in. * Handles posts to pinboard.in.

View file

@ -39,11 +39,7 @@ import org.pircbotx.PircBotX
import org.pircbotx.hooks.events.PrivateMessageEvent import org.pircbotx.hooks.events.PrivateMessageEvent
import org.pircbotx.hooks.types.GenericMessageEvent import org.pircbotx.hooks.types.GenericMessageEvent
import org.slf4j.Logger import org.slf4j.Logger
import java.io.BufferedInputStream import java.io.*
import java.io.BufferedOutputStream
import java.io.IOException
import java.io.ObjectInputStream
import java.io.ObjectOutputStream
import java.net.HttpURLConnection import java.net.HttpURLConnection
import java.net.URL import java.net.URL
import java.nio.file.Files import java.nio.file.Files
@ -51,8 +47,7 @@ import java.nio.file.Paths
import java.time.LocalDateTime import java.time.LocalDateTime
import java.time.ZoneId import java.time.ZoneId
import java.time.format.DateTimeFormatter import java.time.format.DateTimeFormatter
import java.util.Date import java.util.*
import java.util.Properties
import kotlin.io.path.exists import kotlin.io.path.exists
import kotlin.io.path.fileSize import kotlin.io.path.fileSize

View file

@ -34,8 +34,7 @@ import com.rometools.rome.feed.synd.SyndCategory
import com.rometools.rome.feed.synd.SyndCategoryImpl import com.rometools.rome.feed.synd.SyndCategoryImpl
import net.thauvin.erik.mobibot.commands.links.LinksManager import net.thauvin.erik.mobibot.commands.links.LinksManager
import java.io.Serializable import java.io.Serializable
import java.util.Calendar import java.util.*
import java.util.Date
/** /**
* The class used to store link entries. * The class used to store link entries.

View file

@ -30,11 +30,7 @@
*/ */
package net.thauvin.erik.mobibot.entries package net.thauvin.erik.mobibot.entries
import com.rometools.rome.feed.synd.SyndContentImpl import com.rometools.rome.feed.synd.*
import com.rometools.rome.feed.synd.SyndEntry
import com.rometools.rome.feed.synd.SyndEntryImpl
import com.rometools.rome.feed.synd.SyndFeed
import com.rometools.rome.feed.synd.SyndFeedImpl
import com.rometools.rome.io.FeedException import com.rometools.rome.io.FeedException
import com.rometools.rome.io.SyndFeedInput import com.rometools.rome.io.SyndFeedInput
import com.rometools.rome.io.SyndFeedOutput import com.rometools.rome.io.SyndFeedOutput
@ -48,7 +44,7 @@ import java.io.OutputStreamWriter
import java.nio.charset.StandardCharsets import java.nio.charset.StandardCharsets
import java.nio.file.Files import java.nio.file.Files
import java.nio.file.Paths import java.nio.file.Paths
import java.util.Calendar import java.util.*
import kotlin.io.path.exists import kotlin.io.path.exists
/** /**

View file

@ -55,8 +55,10 @@ class ChatGpt : AbstractModule() {
override fun commandResponse(channel: String, cmd: String, args: String, event: GenericMessageEvent) { override fun commandResponse(channel: String, cmd: String, args: String, event: GenericMessageEvent) {
if (args.isNotBlank()) { if (args.isNotBlank()) {
try { try {
val answer = chat(args.trim(), properties[API_KEY_PROP], val answer = chat(
properties.getOrDefault(MAX_TOKENS_PROP, "1024").toInt()) args.trim(), properties[API_KEY_PROP],
properties.getOrDefault(MAX_TOKENS_PROP, "1024").toInt()
)
if (answer.isNotBlank()) { if (answer.isNotBlank()) {
event.sendMessage(WordUtils.wrap(answer, 400)) event.sendMessage(WordUtils.wrap(answer, 400))
} else { } else {

View file

@ -45,7 +45,7 @@ import org.slf4j.Logger
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
import java.io.IOException import java.io.IOException
import java.net.URL import java.net.URL
import java.util.TreeMap import java.util.*
/** /**

View file

@ -96,7 +96,7 @@ class RockPaperScissors : AbstractModule() {
override fun commandResponse(channel: String, cmd: String, args: String, event: GenericMessageEvent) { override fun commandResponse(channel: String, cmd: String, args: String, event: GenericMessageEvent) {
val hand = Hands.valueOf(cmd.uppercase()) val hand = Hands.valueOf(cmd.uppercase())
val botHand = Hands.values()[(0..Hands.values().size).random()] val botHand = Hands.entries[(0..Hands.entries.size).random()]
when { when {
hand == botHand -> { hand == botHand -> {
event.respond("${hand.name} vs. ${botHand.name} » You ${"tie".bold()}.") event.respond("${hand.name} vs. ${botHand.name} » You ${"tie".bold()}.")

View file

@ -104,7 +104,7 @@ class Weather2 : AbstractModule() {
* Returns a country based on its country code. Defaults to [Country.UNITED_STATES] if not found. * Returns a country based on its country code. Defaults to [Country.UNITED_STATES] if not found.
*/ */
fun getCountry(countryCode: String): Country { fun getCountry(countryCode: String): Country {
for (c in Country.values()) { for (c in Country.entries) {
if (c.value.equals(countryCode, ignoreCase = true)) { if (c.value.equals(countryCode, ignoreCase = true)) {
return c return c
} }

View file

@ -33,6 +33,5 @@ package net.thauvin.erik.mobibot.msg
/** /**
* The `PrivateMessage` class. * The `PrivateMessage` class.
*/ */
@Suppress("unused")
class PrivateMessage @JvmOverloads constructor(msg: String, color: String = DEFAULT_COLOR) : class PrivateMessage @JvmOverloads constructor(msg: String, color: String = DEFAULT_COLOR) :
Message(msg, color, isPrivate = true) Message(msg, color, isPrivate = true)

View file

@ -36,7 +36,7 @@ import net.thauvin.erik.mobibot.Constants
import net.thauvin.erik.mobibot.entries.EntriesUtils.toLinkLabel import net.thauvin.erik.mobibot.entries.EntriesUtils.toLinkLabel
import org.slf4j.Logger import org.slf4j.Logger
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
import java.util.Timer import java.util.*
/** /**
* Social Manager. * Social Manager.

View file

@ -31,7 +31,7 @@
package net.thauvin.erik.mobibot.social package net.thauvin.erik.mobibot.social
import java.util.TimerTask import java.util.*
class SocialTimer(private var socialManager: SocialManager, private var index: Int) : TimerTask() { class SocialTimer(private var socialManager: SocialManager, private var index: Int) : TimerTask() {
override fun run() { override fun run() {

View file

@ -41,13 +41,9 @@ import net.thauvin.erik.mobibot.commands.Die
import net.thauvin.erik.mobibot.commands.Ignore import net.thauvin.erik.mobibot.commands.Ignore
import net.thauvin.erik.mobibot.commands.links.Comment import net.thauvin.erik.mobibot.commands.links.Comment
import net.thauvin.erik.mobibot.commands.links.View import net.thauvin.erik.mobibot.commands.links.View
import net.thauvin.erik.mobibot.modules.Dice import net.thauvin.erik.mobibot.modules.*
import net.thauvin.erik.mobibot.modules.Joke
import net.thauvin.erik.mobibot.modules.Lookup
import net.thauvin.erik.mobibot.modules.RockPaperScissors
import net.thauvin.erik.mobibot.modules.War
import org.testng.annotations.Test import org.testng.annotations.Test
import java.util.Properties import java.util.*
class AddonsTest { class AddonsTest {
private val p = Properties().apply { private val p = Properties().apply {

View file

@ -36,7 +36,7 @@ import java.net.InetAddress
import java.net.UnknownHostException import java.net.UnknownHostException
import java.nio.file.Files import java.nio.file.Files
import java.nio.file.Paths import java.nio.file.Paths
import java.util.Properties import java.util.*
/** /**
* Access to `local.properties`. * Access to `local.properties`.

View file

@ -66,8 +66,7 @@ import java.io.File
import java.io.IOException import java.io.IOException
import java.net.URL import java.net.URL
import java.time.LocalDateTime import java.time.LocalDateTime
import java.util.Calendar import java.util.*
import java.util.Properties
/** /**
* The `Utils Test` class. * The `Utils Test` class.

View file

@ -33,14 +33,7 @@ package net.thauvin.erik.mobibot.commands.seen
import assertk.all import assertk.all
import assertk.assertThat import assertk.assertThat
import assertk.assertions.isEmpty import assertk.assertions.*
import assertk.assertions.isEqualTo
import assertk.assertions.isGreaterThan
import assertk.assertions.isNotEqualTo
import assertk.assertions.isNotNull
import assertk.assertions.key
import assertk.assertions.prop
import assertk.assertions.size
import org.testng.annotations.AfterClass import org.testng.annotations.AfterClass
import org.testng.annotations.BeforeClass import org.testng.annotations.BeforeClass
import org.testng.annotations.Test import org.testng.annotations.Test

View file

@ -33,13 +33,7 @@ package net.thauvin.erik.mobibot.commands.tell
import assertk.all import assertk.all
import assertk.assertThat import assertk.assertThat
import assertk.assertions.index import assertk.assertions.*
import assertk.assertions.isEqualTo
import assertk.assertions.isFalse
import assertk.assertions.isGreaterThan
import assertk.assertions.isTrue
import assertk.assertions.prop
import assertk.assertions.size
import org.testng.annotations.AfterClass import org.testng.annotations.AfterClass
import org.testng.annotations.BeforeClass import org.testng.annotations.BeforeClass
import org.testng.annotations.Test import org.testng.annotations.Test

View file

@ -32,18 +32,12 @@ package net.thauvin.erik.mobibot.entries
import assertk.all import assertk.all
import assertk.assertThat import assertk.assertThat
import assertk.assertions.index import assertk.assertions.*
import assertk.assertions.isEmpty
import assertk.assertions.isEqualTo
import assertk.assertions.isFalse
import assertk.assertions.isTrue
import assertk.assertions.prop
import assertk.assertions.size
import com.rometools.rome.feed.synd.SyndCategory import com.rometools.rome.feed.synd.SyndCategory
import com.rometools.rome.feed.synd.SyndCategoryImpl import com.rometools.rome.feed.synd.SyndCategoryImpl
import org.testng.annotations.Test import org.testng.annotations.Test
import java.security.SecureRandom import java.security.SecureRandom
import java.util.Date import java.util.*
/** /**
* The `EntryUtilsTest` class. * The `EntryUtilsTest` class.

View file

@ -33,18 +33,12 @@ package net.thauvin.erik.mobibot.entries
import assertk.all import assertk.all
import assertk.assertThat import assertk.assertThat
import assertk.assertions.endsWith import assertk.assertions.*
import assertk.assertions.exists
import assertk.assertions.index
import assertk.assertions.isEqualTo
import assertk.assertions.isTrue
import assertk.assertions.prop
import assertk.assertions.size
import net.thauvin.erik.mobibot.Utils.today import net.thauvin.erik.mobibot.Utils.today
import org.testng.annotations.BeforeSuite import org.testng.annotations.BeforeSuite
import org.testng.annotations.Test import org.testng.annotations.Test
import java.nio.file.Paths import java.nio.file.Paths
import java.util.Date import java.util.*
import kotlin.io.path.deleteIfExists import kotlin.io.path.deleteIfExists
import kotlin.io.path.fileSize import kotlin.io.path.fileSize
import kotlin.io.path.name import kotlin.io.path.name

View file

@ -33,7 +33,6 @@ package net.thauvin.erik.mobibot.modules
import assertk.assertFailure import assertk.assertFailure
import assertk.assertThat import assertk.assertThat
import assertk.assertions.isEqualTo import assertk.assertions.isEqualTo
import assertk.assertions.isFailure
import assertk.assertions.isInstanceOf import assertk.assertions.isInstanceOf
import net.objecthunter.exp4j.tokenizer.UnknownFunctionOrVariableException import net.objecthunter.exp4j.tokenizer.UnknownFunctionOrVariableException
import net.thauvin.erik.mobibot.Utils.bold import net.thauvin.erik.mobibot.Utils.bold

View file

@ -34,7 +34,6 @@ import assertk.assertFailure
import assertk.assertThat import assertk.assertThat
import assertk.assertions.contains import assertk.assertions.contains
import assertk.assertions.hasNoCause import assertk.assertions.hasNoCause
import assertk.assertions.isFailure
import assertk.assertions.isInstanceOf import assertk.assertions.isInstanceOf
import net.thauvin.erik.mobibot.LocalProperties import net.thauvin.erik.mobibot.LocalProperties
import org.testng.annotations.Test import org.testng.annotations.Test

View file

@ -33,15 +33,7 @@ package net.thauvin.erik.mobibot.modules
import assertk.all import assertk.all
import assertk.assertFailure import assertk.assertFailure
import assertk.assertThat import assertk.assertThat
import assertk.assertions.contains import assertk.assertions.*
import assertk.assertions.hasMessage
import assertk.assertions.hasNoCause
import assertk.assertions.index
import assertk.assertions.isEqualTo
import assertk.assertions.isFailure
import assertk.assertions.isInstanceOf
import assertk.assertions.isNotEmpty
import assertk.assertions.prop
import net.thauvin.erik.mobibot.ExceptionSanitizer.sanitize import net.thauvin.erik.mobibot.ExceptionSanitizer.sanitize
import net.thauvin.erik.mobibot.LocalProperties import net.thauvin.erik.mobibot.LocalProperties
import net.thauvin.erik.mobibot.modules.GoogleSearch.Companion.searchGoogle import net.thauvin.erik.mobibot.modules.GoogleSearch.Companion.searchGoogle

View file

@ -32,12 +32,7 @@ package net.thauvin.erik.mobibot.modules
import assertk.all import assertk.all
import assertk.assertThat import assertk.assertThat
import assertk.assertions.doesNotContain import assertk.assertions.*
import assertk.assertions.each
import assertk.assertions.isGreaterThan
import assertk.assertions.isInstanceOf
import assertk.assertions.prop
import assertk.assertions.size
import net.thauvin.erik.mobibot.modules.Joke.Companion.randomJoke import net.thauvin.erik.mobibot.modules.Joke.Companion.randomJoke
import net.thauvin.erik.mobibot.msg.Message import net.thauvin.erik.mobibot.msg.Message
import net.thauvin.erik.mobibot.msg.PublicMessage import net.thauvin.erik.mobibot.msg.PublicMessage

View file

@ -32,13 +32,7 @@ package net.thauvin.erik.mobibot.modules
import assertk.all import assertk.all
import assertk.assertThat import assertk.assertThat
import assertk.assertions.contains import assertk.assertions.*
import assertk.assertions.doesNotContain
import assertk.assertions.endsWith
import assertk.assertions.hasMessage
import assertk.assertions.isEqualTo
import assertk.assertions.isNotNull
import assertk.assertions.isNull
import net.thauvin.erik.mobibot.ExceptionSanitizer.sanitize import net.thauvin.erik.mobibot.ExceptionSanitizer.sanitize
import org.testng.annotations.DataProvider import org.testng.annotations.DataProvider
import org.testng.annotations.Test import org.testng.annotations.Test

View file

@ -33,14 +33,7 @@ package net.thauvin.erik.mobibot.modules
import assertk.all import assertk.all
import assertk.assertFailure import assertk.assertFailure
import assertk.assertThat import assertk.assertThat
import assertk.assertions.hasNoCause import assertk.assertions.*
import assertk.assertions.index
import assertk.assertions.isEqualTo
import assertk.assertions.isFailure
import assertk.assertions.isInstanceOf
import assertk.assertions.isNotEmpty
import assertk.assertions.matches
import assertk.assertions.prop
import net.thauvin.erik.mobibot.ExceptionSanitizer.sanitize import net.thauvin.erik.mobibot.ExceptionSanitizer.sanitize
import net.thauvin.erik.mobibot.LocalProperties import net.thauvin.erik.mobibot.LocalProperties
import net.thauvin.erik.mobibot.modules.StockQuote.Companion.getQuote import net.thauvin.erik.mobibot.modules.StockQuote.Companion.getQuote

View file

@ -33,16 +33,7 @@ package net.thauvin.erik.mobibot.modules
import assertk.all import assertk.all
import assertk.assertFailure import assertk.assertFailure
import assertk.assertThat import assertk.assertThat
import assertk.assertions.contains import assertk.assertions.*
import assertk.assertions.endsWith
import assertk.assertions.hasNoCause
import assertk.assertions.index
import assertk.assertions.isEqualTo
import assertk.assertions.isFailure
import assertk.assertions.isInstanceOf
import assertk.assertions.isNotNull
import assertk.assertions.isTrue
import assertk.assertions.prop
import net.aksingh.owmjapis.api.APIException import net.aksingh.owmjapis.api.APIException
import net.aksingh.owmjapis.core.OWM import net.aksingh.owmjapis.core.OWM
import net.thauvin.erik.mobibot.LocalProperties import net.thauvin.erik.mobibot.LocalProperties
@ -69,7 +60,7 @@ class Weather2Test : LocalProperties() {
assertThat(getCountry("foo"), "foo is not a valid country").isEqualTo(OWM.Country.UNITED_STATES) assertThat(getCountry("foo"), "foo is not a valid country").isEqualTo(OWM.Country.UNITED_STATES)
assertThat(getCountry("fr"), "country should France").isEqualTo(OWM.Country.FRANCE) assertThat(getCountry("fr"), "country should France").isEqualTo(OWM.Country.FRANCE)
val country = OWM.Country.values() val country = OWM.Country.entries.toTypedArray()
repeat(3) { repeat(3) {
val rand = country[(country.indices).random()] val rand = country[(country.indices).random()]
assertThat(getCountry(rand.value), rand.name).isEqualTo(rand) assertThat(getCountry(rand.value), rand.name).isEqualTo(rand)

View file

@ -30,10 +30,8 @@
*/ */
package net.thauvin.erik.mobibot.modules package net.thauvin.erik.mobibot.modules
import assertk.assertFailure
import assertk.assertThat import assertk.assertThat
import assertk.assertions.endsWith import assertk.assertions.endsWith
import assertk.assertions.isSuccess
import assertk.assertions.matches import assertk.assertions.matches
import assertk.assertions.startsWith import assertk.assertions.startsWith
import net.thauvin.erik.mobibot.Utils.bold import net.thauvin.erik.mobibot.Utils.bold

View file

@ -1,9 +1,9 @@
#Generated by the Semver Plugin for Gradle #Generated by the Semver Plugin for Gradle
#Sun Jul 02 02:19:45 PDT 2023 #Thu Jul 06 10:21:40 PDT 2023
version.buildmeta=20230702021945 version.buildmeta=20230706102140
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+20230702021945 version.semver=0.8.0-rc+20230706102140