From 22bf1cfed504fb3f9332e6b5f7c06837c50737a8 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Mon, 25 Oct 2021 13:02:57 -0700 Subject: [PATCH] Clean up. --- src/main/kotlin/net/thauvin/erik/mobibot/Constants.kt | 7 ------- src/main/kotlin/net/thauvin/erik/mobibot/Mobibot.kt | 11 ++++------- .../kotlin/net/thauvin/erik/mobibot/PinboardUtils.kt | 4 ++-- .../kotlin/net/thauvin/erik/mobibot/modules/Calc.kt | 2 +- 4 files changed, 7 insertions(+), 17 deletions(-) diff --git a/src/main/kotlin/net/thauvin/erik/mobibot/Constants.kt b/src/main/kotlin/net/thauvin/erik/mobibot/Constants.kt index 4b93ac1..2ae420d 100644 --- a/src/main/kotlin/net/thauvin/erik/mobibot/Constants.kt +++ b/src/main/kotlin/net/thauvin/erik/mobibot/Constants.kt @@ -31,8 +31,6 @@ */ package net.thauvin.erik.mobibot -import java.util.Locale - /** * The `Constants`. */ @@ -87,11 +85,6 @@ object Constants { */ const val LINK_CMD = "L" - /** - * Default locale. - */ - val LOCALE: Locale = Locale.getDefault() - /** * The empty title string. */ diff --git a/src/main/kotlin/net/thauvin/erik/mobibot/Mobibot.kt b/src/main/kotlin/net/thauvin/erik/mobibot/Mobibot.kt index b7b7d1a..6bfbe8a 100644 --- a/src/main/kotlin/net/thauvin/erik/mobibot/Mobibot.kt +++ b/src/main/kotlin/net/thauvin/erik/mobibot/Mobibot.kt @@ -31,9 +31,6 @@ */ package net.thauvin.erik.mobibot -import net.thauvin.erik.mobibot.PinboardUtils.addPin -import net.thauvin.erik.mobibot.PinboardUtils.deletePin -import net.thauvin.erik.mobibot.PinboardUtils.updatePin import net.thauvin.erik.mobibot.Utils.appendIfMissing import net.thauvin.erik.mobibot.Utils.buildCmdSyntax import net.thauvin.erik.mobibot.Utils.colorize @@ -196,7 +193,7 @@ class Mobibot(nickname: String, channel: String, logsDirPath: String, p: Propert */ fun addPin(entry: EntryLink) { if (isPinboardEnabled) { - addPin(pinboard, ircServer, entry) + PinboardUtils.addPin(pinboard, ircServer, entry) } } @@ -236,7 +233,7 @@ class Mobibot(nickname: String, channel: String, logsDirPath: String, p: Propert */ fun deletePin(index: Int, entry: EntryLink) { if (isPinboardEnabled) { - deletePin(pinboard, entry) + PinboardUtils.deletePin(pinboard, entry) } if (twitter.isAutoPost) { twitter.removeEntry(index) @@ -506,7 +503,7 @@ class Mobibot(nickname: String, channel: String, logsDirPath: String, p: Propert */ fun updatePin(oldUrl: String, entry: EntryLink) { if (isPinboardEnabled) { - updatePin(pinboard, ircServer, oldUrl, entry) + PinboardUtils.updatePin(pinboard, ircServer, oldUrl, entry) } } @@ -526,7 +523,7 @@ class Mobibot(nickname: String, channel: String, logsDirPath: String, p: Propert */ @JvmStatic fun main(args: Array) { - // Setup the command line options + // Set up the command line options val options = Options() .addOption( Constants.HELP_ARG.substring(0, 1), diff --git a/src/main/kotlin/net/thauvin/erik/mobibot/PinboardUtils.kt b/src/main/kotlin/net/thauvin/erik/mobibot/PinboardUtils.kt index 01bd1f1..2d91b64 100644 --- a/src/main/kotlin/net/thauvin/erik/mobibot/PinboardUtils.kt +++ b/src/main/kotlin/net/thauvin/erik/mobibot/PinboardUtils.kt @@ -68,7 +68,7 @@ object PinboardUtils { * Deletes a pin. */ @JvmStatic - fun deletePin(poster: PinboardPoster, entry: EntryLink) { + fun deletePin(poster: PinboardPoster, entry: EntryLink) { runBlocking { launch { poster.deletePin(entry.link) @@ -80,7 +80,7 @@ object PinboardUtils { * Updates a pin. */ @JvmStatic - fun updatePin(poster: PinboardPoster, ircServer: String, oldUrl: String, entry: EntryLink) { + fun updatePin(poster: PinboardPoster, ircServer: String, oldUrl: String, entry: EntryLink) { runBlocking { launch { with(entry) { diff --git a/src/main/kotlin/net/thauvin/erik/mobibot/modules/Calc.kt b/src/main/kotlin/net/thauvin/erik/mobibot/modules/Calc.kt index 6202fdf..5ff5c73 100644 --- a/src/main/kotlin/net/thauvin/erik/mobibot/modules/Calc.kt +++ b/src/main/kotlin/net/thauvin/erik/mobibot/modules/Calc.kt @@ -49,7 +49,7 @@ class Calc(bot: Mobibot) : AbstractModule(bot) { isPrivate: Boolean ) { if (args.isNotBlank()) { - with (bot) { + with(bot) { try { send(calculate(args)) } catch (e: IllegalArgumentException) {