Added isEnabled function.
This commit is contained in:
parent
562adec177
commit
0e80f22b4f
1 changed files with 8 additions and 9 deletions
|
@ -36,7 +36,6 @@ import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
import net.thauvin.erik.mobibot.FeedReader
|
import net.thauvin.erik.mobibot.FeedReader
|
||||||
import net.thauvin.erik.mobibot.Utils.helpFormat
|
import net.thauvin.erik.mobibot.Utils.helpFormat
|
||||||
import net.thauvin.erik.mobibot.Utils.sendMessage
|
|
||||||
import org.pircbotx.hooks.types.GenericMessageEvent
|
import org.pircbotx.hooks.types.GenericMessageEvent
|
||||||
|
|
||||||
class ChannelFeed(channel: String) : AbstractCommand() {
|
class ChannelFeed(channel: String) : AbstractCommand() {
|
||||||
|
@ -55,16 +54,16 @@ class ChannelFeed(channel: String) : AbstractCommand() {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun commandResponse(channel: String, args: String, event: GenericMessageEvent) {
|
override fun commandResponse(channel: String, args: String, event: GenericMessageEvent) {
|
||||||
with(properties[FEED_PROP]) {
|
if (isEnabled()) {
|
||||||
if (!isNullOrBlank()) {
|
|
||||||
runBlocking {
|
runBlocking {
|
||||||
launch {
|
launch {
|
||||||
FeedReader(this@with, event).run()
|
FeedReader(properties[FEED_PROP]!!, event).run()
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
event.sendMessage("There is no feed setup for this channel.")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun isEnabled(): Boolean {
|
||||||
|
return !properties[FEED_PROP].isNullOrBlank()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue