From aab95fb0400495ad2de460554167174f32e8cb08 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Tue, 16 Nov 2021 22:04:41 -0800 Subject: [PATCH] Minor cleanups. --- .../kotlin/net/thauvin/erik/mobibot/FeedReader.kt | 3 +-- .../kotlin/net/thauvin/erik/mobibot/commands/Cycle.kt | 1 - .../kotlin/net/thauvin/erik/mobibot/commands/Info.kt | 3 +-- .../kotlin/net/thauvin/erik/mobibot/commands/Say.kt | 1 - .../kotlin/net/thauvin/erik/mobibot/commands/Users.kt | 1 - .../thauvin/erik/mobibot/commands/links/Comment.kt | 11 ++++++----- 6 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/main/kotlin/net/thauvin/erik/mobibot/FeedReader.kt b/src/main/kotlin/net/thauvin/erik/mobibot/FeedReader.kt index 739f45a..a61a6a7 100644 --- a/src/main/kotlin/net/thauvin/erik/mobibot/FeedReader.kt +++ b/src/main/kotlin/net/thauvin/erik/mobibot/FeedReader.kt @@ -34,7 +34,6 @@ package net.thauvin.erik.mobibot import com.rometools.rome.io.FeedException import com.rometools.rome.io.SyndFeedInput import com.rometools.rome.io.XmlReader -import net.thauvin.erik.mobibot.Utils.cyan import net.thauvin.erik.mobibot.Utils.green import net.thauvin.erik.mobibot.Utils.helpFormat import net.thauvin.erik.mobibot.Utils.sendMessage @@ -84,7 +83,7 @@ class FeedReader(private val url: String, val event: GenericMessageEvent) : Runn } else { items.take(maxItems).forEach { messages.add(NoticeMessage(it.title)) - messages.add(NoticeMessage(helpFormat(it.link.cyan(), false))) + messages.add(NoticeMessage(helpFormat(it.link.green(), false))) } } } diff --git a/src/main/kotlin/net/thauvin/erik/mobibot/commands/Cycle.kt b/src/main/kotlin/net/thauvin/erik/mobibot/commands/Cycle.kt index e5b019d..00d6638 100644 --- a/src/main/kotlin/net/thauvin/erik/mobibot/commands/Cycle.kt +++ b/src/main/kotlin/net/thauvin/erik/mobibot/commands/Cycle.kt @@ -47,7 +47,6 @@ class Cycle : AbstractCommand() { override val isPublic = false override val isVisible = true - override fun commandResponse(channel: String, args: String, event: GenericMessageEvent) { with(event.bot()) { if (isChannelOp(channel, event)) { diff --git a/src/main/kotlin/net/thauvin/erik/mobibot/commands/Info.kt b/src/main/kotlin/net/thauvin/erik/mobibot/commands/Info.kt index 8e54bf0..41065ff 100644 --- a/src/main/kotlin/net/thauvin/erik/mobibot/commands/Info.kt +++ b/src/main/kotlin/net/thauvin/erik/mobibot/commands/Info.kt @@ -33,7 +33,6 @@ package net.thauvin.erik.mobibot.commands import net.thauvin.erik.mobibot.ReleaseInfo import net.thauvin.erik.mobibot.Utils.capitalise -import net.thauvin.erik.mobibot.Utils.cyan import net.thauvin.erik.mobibot.Utils.green import net.thauvin.erik.mobibot.Utils.helpFormat import net.thauvin.erik.mobibot.Utils.isChannelOp @@ -47,7 +46,7 @@ import java.lang.management.ManagementFactory class Info(private val tell: Tell) : AbstractCommand() { private val allVersions = listOf( - "${ReleaseInfo.PROJECT.capitalise()} ${ReleaseInfo.VERSION} (${ReleaseInfo.WEBSITE.cyan()})", + "${ReleaseInfo.PROJECT.capitalise()} ${ReleaseInfo.VERSION} (${ReleaseInfo.WEBSITE.green()})", "Written by ${ReleaseInfo.AUTHOR} (${ReleaseInfo.AUTHOR_URL.green()})" ) override val name = "info" diff --git a/src/main/kotlin/net/thauvin/erik/mobibot/commands/Say.kt b/src/main/kotlin/net/thauvin/erik/mobibot/commands/Say.kt index a89c64e..34b4aec 100644 --- a/src/main/kotlin/net/thauvin/erik/mobibot/commands/Say.kt +++ b/src/main/kotlin/net/thauvin/erik/mobibot/commands/Say.kt @@ -44,7 +44,6 @@ class Say : AbstractCommand() { override val isPublic = false override val isVisible = true - override fun commandResponse(channel: String, args: String, event: GenericMessageEvent) { if (isChannelOp(channel, event)) { event.bot().sendIRC().message(channel, args) diff --git a/src/main/kotlin/net/thauvin/erik/mobibot/commands/Users.kt b/src/main/kotlin/net/thauvin/erik/mobibot/commands/Users.kt index 5133146..e643858 100644 --- a/src/main/kotlin/net/thauvin/erik/mobibot/commands/Users.kt +++ b/src/main/kotlin/net/thauvin/erik/mobibot/commands/Users.kt @@ -44,7 +44,6 @@ class Users : AbstractCommand() { override val isPublic = true override val isVisible = true - override fun commandResponse(channel: String, args: String, event: GenericMessageEvent) { val nicks = mutableListOf() val ch = event.bot().userChannelDao.getChannel(channel) diff --git a/src/main/kotlin/net/thauvin/erik/mobibot/commands/links/Comment.kt b/src/main/kotlin/net/thauvin/erik/mobibot/commands/links/Comment.kt index 02f0a3c..5b137ff 100644 --- a/src/main/kotlin/net/thauvin/erik/mobibot/commands/links/Comment.kt +++ b/src/main/kotlin/net/thauvin/erik/mobibot/commands/links/Comment.kt @@ -38,7 +38,8 @@ import net.thauvin.erik.mobibot.Utils.helpFormat import net.thauvin.erik.mobibot.Utils.isChannelOp import net.thauvin.erik.mobibot.Utils.sendMessage import net.thauvin.erik.mobibot.commands.AbstractCommand -import net.thauvin.erik.mobibot.entries.EntriesUtils +import net.thauvin.erik.mobibot.entries.EntriesUtils.buildComment +import net.thauvin.erik.mobibot.entries.EntriesUtils.buildLinkLabel import net.thauvin.erik.mobibot.entries.EntryLink import org.pircbotx.hooks.types.GenericMessageEvent @@ -110,7 +111,7 @@ class Comment : AbstractCommand() { if (isChannelOp(channel, event) && cmd.length > 1) { val comment = entry.getComment(commentIndex) comment.nick = cmd.substring(1) - event.sendMessage(EntriesUtils.buildComment(entryIndex, commentIndex, comment)) + event.sendMessage(buildComment(entryIndex, commentIndex, comment)) LinksMgr.entries.save() } else { event.sendMessage("Please ask a channel op to change the author of this comment for you.") @@ -126,7 +127,7 @@ class Comment : AbstractCommand() { ) { if (isChannelOp(channel, event) || event.user.nick == entry.getComment(commentIndex).nick) { entry.deleteComment(commentIndex) - event.sendMessage("Comment ${EntriesUtils.buildLinkLabel(entryIndex)}.${commentIndex + 1} removed.") + event.sendMessage("Comment ${buildLinkLabel(entryIndex)}.${commentIndex + 1} removed.") LinksMgr.entries.save() } else { event.sendMessage("Please ask a channel op to delete this comment for you.") @@ -141,11 +142,11 @@ class Comment : AbstractCommand() { event: GenericMessageEvent ) { entry.setComment(commentIndex, cmd, event.user.nick) - event.sendMessage(EntriesUtils.buildComment(entryIndex, commentIndex, entry.getComment(commentIndex))) + event.sendMessage(buildComment(entryIndex, commentIndex, entry.getComment(commentIndex))) LinksMgr.entries.save() } private fun showComment(entry: EntryLink, entryIndex: Int, commentIndex: Int, event: GenericMessageEvent) { - event.sendMessage(EntriesUtils.buildComment(entryIndex, commentIndex, entry.getComment(commentIndex))) + event.sendMessage(buildComment(entryIndex, commentIndex, entry.getComment(commentIndex))) } }