Minor cleanups.
This commit is contained in:
parent
2963e747be
commit
aab95fb040
6 changed files with 8 additions and 12 deletions
|
@ -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)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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<String>()
|
||||
val ch = event.bot().userChannelDao.getChannel(channel)
|
||||
|
|
|
@ -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)))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue