Updated dependencies.

This commit is contained in:
Erik C. Thauvin 2021-05-28 11:29:39 -07:00
parent 05b7ca8a41
commit 2c1ea56e79
5 changed files with 10 additions and 14 deletions

View file

@ -1,7 +1,7 @@
plugins {
id 'application'
id 'checkstyle'
id 'com.github.ben-manes.versions' version '0.38.0'
id 'com.github.ben-manes.versions' version '0.39.0'
id 'idea'
id 'io.gitlab.arturbosch.detekt' version '1.17.1'
id 'jacoco'

View file

@ -39,7 +39,6 @@
<ID>NestedBlockDepth:WorldTime.kt$WorldTime$override fun commandResponse( sender: String, cmd: String, args: String, isPrivate: Boolean )</ID>
<ID>ReturnCount:Addons.kt$Addons$ fun exec(sender: String, login: String, cmd: String, args: String, isOp: Boolean, isPrivate: Boolean): Boolean</ID>
<ID>ReturnCount:Addons.kt$Addons$ fun help(sender: String, topic: String, isOp: Boolean, isPrivate: Boolean): Boolean</ID>
<ID>SwallowedException:CryptoPrices.kt$CryptoPrices$catch (e: IllegalArgumentException) { price.amount }</ID>
<ID>ThrowsCount:GoogleSearch.kt$GoogleSearch.Companion$ @JvmStatic @Throws(ModuleException::class) fun searchGoogle(query: String, apiKey: String?, cseKey: String?): List&lt;Message&gt;</ID>
<ID>ThrowsCount:StockQuote.kt$StockQuote.Companion$ @JvmStatic @Throws(ModuleException::class) fun getQuote(symbol: String, apiKey: String?): List&lt;Message&gt;</ID>
<ID>ThrowsCount:StockQuote.kt$StockQuote.Companion$@Throws(ModuleException::class) private fun getJsonResponse(response: String, debugMessage: String): JSONObject</ID>

View file

@ -33,14 +33,11 @@ package net.thauvin.erik.mobibot.modules
import net.thauvin.erik.crypto.CryptoException
import net.thauvin.erik.crypto.CryptoPrice
import net.thauvin.erik.crypto.CryptoPrice.Companion.marketPrice
import net.thauvin.erik.crypto.CryptoPrice.Companion.spotPrice
import net.thauvin.erik.mobibot.Mobibot
import net.thauvin.erik.mobibot.Utils.helpFormat
import net.thauvin.erik.mobibot.msg.PublicMessage
import java.text.NumberFormat
import java.util.Currency
/**
* The Cryptocurrency Prices module.
*/
@ -56,7 +53,7 @@ class CryptoPrices(bot: Mobibot) : ThreadedModule(bot) {
val price = currentPrice(args.split(' '))
val amount = try {
price.toCurrency()
} catch (e: IllegalArgumentException) {
} catch (ignore: IllegalArgumentException) {
price.amount
}
send(sender, PublicMessage("${price.base}: $amount [${price.currency}]"))
@ -82,9 +79,9 @@ class CryptoPrices(bot: Mobibot) : ThreadedModule(bot) {
*/
fun currentPrice(args: List<String>): CryptoPrice {
return if (args.size == 2)
marketPrice(args[0], args[1])
spotPrice(args[0], args[1])
else
marketPrice(args[0])
spotPrice(args[0])
}
}

View file

@ -45,11 +45,11 @@ class CryptoPricesTest {
var price = currentPrice(listOf("BTC"))
assertThat(price.base).describedAs("is BTC").isEqualTo("BTC")
assertThat(price.currency).describedAs("is USD").isEqualTo("USD")
assertThat(price.amount).describedAs("BTC > 0").isGreaterThan(0.00)
assertThat(price.amount.signum() > 0).describedAs("BTC > 0").isTrue
price = currentPrice(listOf("ETH", "EUR"))
assertThat(price.base).describedAs("is ETH").isEqualTo("ETH")
assertThat(price.currency).describedAs("is EUR").isEqualTo("EUR")
assertThat(price.amount).describedAs("ETH > 0").isGreaterThan(0.00)
assertThat(price.amount.signum() > 0).describedAs("ETH > 0").isTrue
}
}

View file

@ -1,9 +1,9 @@
#Generated by the Semver Plugin for Gradle
#Tue May 25 18:01:58 PDT 2021
version.buildmeta=848
#Fri May 28 11:26:02 PDT 2021
version.buildmeta=854
version.major=0
version.minor=8
version.patch=0
version.prerelease=beta
version.project=mobibot
version.semver=0.8.0-beta+848
version.semver=0.8.0-beta+854