diff --git a/build.gradle b/build.gradle
index 4d4a074..b4aed72 100644
--- a/build.gradle
+++ b/build.gradle
@@ -3,12 +3,12 @@ plugins {
id 'checkstyle'
id 'com.github.ben-manes.versions' version '0.38.0'
id 'idea'
- id 'io.gitlab.arturbosch.detekt' version '1.17.0'
+ id 'io.gitlab.arturbosch.detekt' version '1.17.1'
id 'jacoco'
id 'java'
id 'net.thauvin.erik.gradle.semver' version '1.0.4'
- id 'org.jetbrains.kotlin.jvm' version '1.5.0'
- id 'org.jetbrains.kotlin.kapt' version '1.5.0'
+ id 'org.jetbrains.kotlin.jvm' version '1.5.10'
+ id 'org.jetbrains.kotlin.kapt' version '1.5.10'
id 'org.sonarqube' version '3.2.0'
id 'pmd'
}
diff --git a/config/detekt/baseline.xml b/config/detekt/baseline.xml
index 0b6f182..6b6b2e0 100644
--- a/config/detekt/baseline.xml
+++ b/config/detekt/baseline.xml
@@ -39,6 +39,7 @@
NestedBlockDepth:WorldTime.kt$WorldTime$override fun commandResponse( sender: String, cmd: String, args: String, isPrivate: Boolean )
ReturnCount:Addons.kt$Addons$ fun exec(sender: String, login: String, cmd: String, args: String, isOp: Boolean, isPrivate: Boolean): Boolean
ReturnCount:Addons.kt$Addons$ fun help(sender: String, topic: String, isOp: Boolean, isPrivate: Boolean): Boolean
+ SwallowedException:CryptoPrices.kt$CryptoPrices$catch (e: IllegalArgumentException) { price.amount }
ThrowsCount:GoogleSearch.kt$GoogleSearch.Companion$ @JvmStatic @Throws(ModuleException::class) fun searchGoogle(query: String, apiKey: String?, cseKey: String?): List<Message>
ThrowsCount:StockQuote.kt$StockQuote.Companion$ @JvmStatic @Throws(ModuleException::class) fun getQuote(symbol: String, apiKey: String?): List<Message>
ThrowsCount:StockQuote.kt$StockQuote.Companion$@Throws(ModuleException::class) private fun getJsonResponse(response: String, debugMessage: String): JSONObject
diff --git a/src/main/kotlin/net/thauvin/erik/mobibot/modules/CryptoPrices.kt b/src/main/kotlin/net/thauvin/erik/mobibot/modules/CryptoPrices.kt
index 4cd57c2..8f98fa7 100644
--- a/src/main/kotlin/net/thauvin/erik/mobibot/modules/CryptoPrices.kt
+++ b/src/main/kotlin/net/thauvin/erik/mobibot/modules/CryptoPrices.kt
@@ -38,6 +38,9 @@ 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.
*/
@@ -51,7 +54,12 @@ class CryptoPrices(bot: Mobibot) : ThreadedModule(bot) {
if (args.matches("\\w+( [a-zA-Z]{3}+)?".toRegex())) {
try {
val price = currentPrice(args.split(' '))
- send(sender, PublicMessage("${price.base}: ${price.amount} [${price.currency}]"))
+ val amount = try {
+ price.toCurrency()
+ } catch (e: IllegalArgumentException) {
+ price.amount
+ }
+ send(sender, PublicMessage("${price.base}: $amount [${price.currency}]"))
} catch (e: CryptoException) {
if (logger.isWarnEnabled) logger.warn("$debugMessage => ${e.statusCode}", e)
send(e.message)
diff --git a/version.properties b/version.properties
index 18e0fb1..854ee64 100644
--- a/version.properties
+++ b/version.properties
@@ -1,9 +1,9 @@
#Generated by the Semver Plugin for Gradle
-#Wed May 19 19:28:39 PDT 2021
-version.buildmeta=842
+#Tue May 25 18:01:58 PDT 2021
+version.buildmeta=848
version.major=0
version.minor=8
version.patch=0
version.prerelease=beta
version.project=mobibot
-version.semver=0.8.0-beta+842
+version.semver=0.8.0-beta+848