diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml
index f70d82d..9156431 100644
--- a/.idea/kotlinc.xml
+++ b/.idea/kotlinc.xml
@@ -7,10 +7,7 @@
-
-
-
-
-
+
+
\ No newline at end of file
diff --git a/src/bld/java/net/thauvin/erik/MobibotBuild.java b/src/bld/java/net/thauvin/erik/MobibotBuild.java
index 1d8c49d..ed33398 100644
--- a/src/bld/java/net/thauvin/erik/MobibotBuild.java
+++ b/src/bld/java/net/thauvin/erik/MobibotBuild.java
@@ -72,8 +72,8 @@ public class MobibotBuild extends Project {
javaRelease = 17;
- downloadSources = true;
autoDownloadPurge = true;
+ downloadSources = true;
repositories = List.of(
MAVEN_LOCAL,
@@ -168,7 +168,7 @@ public class MobibotBuild extends Project {
public void compile() throws Exception {
releaseInfo();
var op = new CompileKotlinOperation().fromProject(this);
- op.compileOptions().progressive(true).verbose(true);
+ op.compileOptions().languageVersion("2.1").progressive(true).verbose(true);
op.execute();
}
diff --git a/src/main/kotlin/net/thauvin/erik/mobibot/Mobibot.kt b/src/main/kotlin/net/thauvin/erik/mobibot/Mobibot.kt
index 94be036..ee726fc 100644
--- a/src/main/kotlin/net/thauvin/erik/mobibot/Mobibot.kt
+++ b/src/main/kotlin/net/thauvin/erik/mobibot/Mobibot.kt
@@ -125,10 +125,10 @@ class Mobibot(nickname: String, val channel: String, logsDirPath: String, p: Pro
).use { fis ->
p.load(fis)
}
- } catch (ignore: FileNotFoundException) {
+ } catch (_: FileNotFoundException) {
System.err.println("Unable to find properties file.")
exitProcess(1)
- } catch (ignore: IOException) {
+ } catch (_: IOException) {
System.err.println("Unable to open properties file.")
exitProcess(1)
}
@@ -147,7 +147,7 @@ class Mobibot(nickname: String, val channel: String, logsDirPath: String, p: Pro
), true
)
System.setOut(stdout)
- } catch (ignore: IOException) {
+ } catch (_: IOException) {
System.err.println("Unable to open output (stdout) log file.")
exitProcess(1)
}
@@ -158,7 +158,7 @@ class Mobibot(nickname: String, val channel: String, logsDirPath: String, p: Pro
), true
)
System.setErr(stderr)
- } catch (ignore: IOException) {
+ } catch (_: IOException) {
System.err.println("Unable to open error (stderr) log file.")
exitProcess(1)
}
diff --git a/src/main/kotlin/net/thauvin/erik/mobibot/Utils.kt b/src/main/kotlin/net/thauvin/erik/mobibot/Utils.kt
index 0b53481..d5d9b30 100644
--- a/src/main/kotlin/net/thauvin/erik/mobibot/Utils.kt
+++ b/src/main/kotlin/net/thauvin/erik/mobibot/Utils.kt
@@ -331,7 +331,7 @@ object Utils {
}
/**
- * Send a formatted commands/modules, etc. list.
+ * Send a formatted list to the channel.
*/
@JvmStatic
@JvmOverloads
@@ -394,7 +394,7 @@ object Utils {
fun String.toIntOrDefault(defaultValue: Int): Int {
return try {
toInt()
- } catch (e: NumberFormatException) {
+ } catch (_: NumberFormatException) {
defaultValue
}
}
diff --git a/src/main/kotlin/net/thauvin/erik/mobibot/commands/links/LinksManager.kt b/src/main/kotlin/net/thauvin/erik/mobibot/commands/links/LinksManager.kt
index e6ee11a..05b8192 100644
--- a/src/main/kotlin/net/thauvin/erik/mobibot/commands/links/LinksManager.kt
+++ b/src/main/kotlin/net/thauvin/erik/mobibot/commands/links/LinksManager.kt
@@ -146,7 +146,7 @@ class LinksManager : AbstractCommand() {
pinboard.addPin(event.bot().serverHostname, entry)
- // Queue link for posting to social media.
+ // Queue the entry for posting to social media.
socialManager.queueEntry(index)
entries.save()
@@ -179,7 +179,7 @@ class LinksManager : AbstractCommand() {
if (title.isNotBlank()) {
return title
}
- } catch (ignore: IOException) {
+ } catch (_: IOException) {
// Do nothing
}
return Constants.NO_TITLE
@@ -193,7 +193,7 @@ class LinksManager : AbstractCommand() {
"Duplicate".bold() + " >> " + printLink(entries.links.indexOf(match), match)
)
true
- } catch (ignore: NoSuchElementException) {
+ } catch (_: NoSuchElementException) {
false
}
}
diff --git a/src/main/kotlin/net/thauvin/erik/mobibot/commands/links/View.kt b/src/main/kotlin/net/thauvin/erik/mobibot/commands/links/View.kt
index 67a65e5..03f68df 100644
--- a/src/main/kotlin/net/thauvin/erik/mobibot/commands/links/View.kt
+++ b/src/main/kotlin/net/thauvin/erik/mobibot/commands/links/View.kt
@@ -89,7 +89,7 @@ class View : AbstractCommand() {
if (start > entries.links.size) {
start = 0
}
- } catch (ignore: NumberFormatException) {
+ } catch (_: NumberFormatException) {
// Do nothing
}
}
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 14fed40..1470987 100644
--- a/src/main/kotlin/net/thauvin/erik/mobibot/modules/CryptoPrices.kt
+++ b/src/main/kotlin/net/thauvin/erik/mobibot/modules/CryptoPrices.kt
@@ -72,7 +72,7 @@ class CryptoPrices : AbstractModule() {
val price = currentPrice(args.split(' '))
val amount = try {
price.toCurrency()
- } catch (ignore: IllegalArgumentException) {
+ } catch (_: IllegalArgumentException) {
price.amount
}
event.respond("${price.base} current price is $amount [${CURRENCIES[price.currency]}]")
diff --git a/src/main/kotlin/net/thauvin/erik/mobibot/modules/StockQuote.kt b/src/main/kotlin/net/thauvin/erik/mobibot/modules/StockQuote.kt
index 2837779..3c980af 100644
--- a/src/main/kotlin/net/thauvin/erik/mobibot/modules/StockQuote.kt
+++ b/src/main/kotlin/net/thauvin/erik/mobibot/modules/StockQuote.kt
@@ -82,7 +82,7 @@ class StockQuote : AbstractModule() {
if (info.isNotEmpty()) {
throw ModuleException(debugMessage, info.unescapeXml())
}
- } catch (ignore: JSONException) {
+ } catch (_: JSONException) {
// Do nothing
}
try {
@@ -94,7 +94,7 @@ class StockQuote : AbstractModule() {
if (error.isNotEmpty()) {
throw ModuleException(debugMessage, error.unescapeXml())
}
- } catch (ignore: JSONException) {
+ } catch (_: JSONException) {
// Do nothing
}
json
diff --git a/src/test/kotlin/net/thauvin/erik/mobibot/modules/ChatGpt2Test.kt b/src/test/kotlin/net/thauvin/erik/mobibot/modules/ChatGpt2Test.kt
index b826a4c..1d94118 100644
--- a/src/test/kotlin/net/thauvin/erik/mobibot/modules/ChatGpt2Test.kt
+++ b/src/test/kotlin/net/thauvin/erik/mobibot/modules/ChatGpt2Test.kt
@@ -59,7 +59,7 @@ class ChatGpt2Test : LocalProperties() {
fun chat() {
assertThat(
ChatGpt2.chat(
- "return only the code for javascript function to make a request with XMLHttpRequest",
+ "javascript function to make a request with XMLHttpRequest, just code",
apiKey,
50
)
diff --git a/src/test/kotlin/net/thauvin/erik/mobibot/modules/Gemini2Test.kt b/src/test/kotlin/net/thauvin/erik/mobibot/modules/Gemini2Test.kt
index 4b09499..bfb04f8 100644
--- a/src/test/kotlin/net/thauvin/erik/mobibot/modules/Gemini2Test.kt
+++ b/src/test/kotlin/net/thauvin/erik/mobibot/modules/Gemini2Test.kt
@@ -51,7 +51,7 @@ class Gemini2Test : LocalProperties() {
fun chatHttpRequestInJavascript() {
assertThat(
Gemini2.chat(
- "return only the code for a javascript function to make a request with XMLHttpRequest",
+ "javascript function to make a request with XMLHttpRequest, just code",
apiKey,
maxTokens
)
@@ -62,8 +62,8 @@ class Gemini2Test : LocalProperties() {
@DisableOnCi
fun chatEncodeUrlInJava() {
assertThat(
- Gemini2.chat("how do I encode a URL in java?", apiKey, 60)
- ).isNotNull().contains("URLEncoder")
+ Gemini2.chat("encode a url in java, one line, just code", apiKey, 60)
+ ).isNotNull().contains("UrlEncoder", true)
}
}