Changed Modules command to fetch data directly from the addons.
This commit is contained in:
parent
c99d2ce805
commit
a70f22d402
2 changed files with 5 additions and 4 deletions
|
@ -401,6 +401,7 @@ class Mobibot(nickname: String, val channel: String, logsDirPath: String, p: Pro
|
|||
addons.add(Ignore())
|
||||
addons.add(LinksMgr())
|
||||
addons.add(Me())
|
||||
addons.add(Modules(addons))
|
||||
addons.add(Msg())
|
||||
addons.add(Nick())
|
||||
addons.add(Posting())
|
||||
|
@ -426,7 +427,6 @@ class Mobibot(nickname: String, val channel: String, logsDirPath: String, p: Pro
|
|||
addons.add(Info(tell))
|
||||
addons.add(Joke())
|
||||
addons.add(Lookup())
|
||||
addons.add(Modules(addons.modulesNames))
|
||||
addons.add(Ping())
|
||||
addons.add(RockPaperScissors())
|
||||
addons.add(StockQuote())
|
||||
|
|
|
@ -32,12 +32,13 @@
|
|||
|
||||
package net.thauvin.erik.mobibot.commands
|
||||
|
||||
import net.thauvin.erik.mobibot.Addons
|
||||
import net.thauvin.erik.mobibot.Utils.helpFormat
|
||||
import net.thauvin.erik.mobibot.Utils.isChannelOp
|
||||
import net.thauvin.erik.mobibot.Utils.sendList
|
||||
import org.pircbotx.hooks.types.GenericMessageEvent
|
||||
|
||||
class Modules(private val modulesNames: List<String>) : AbstractCommand() {
|
||||
class Modules(private val addons: Addons) : AbstractCommand() {
|
||||
override val name = "modules"
|
||||
override val help = listOf("To view a list of enabled modules:", helpFormat("%c $name"))
|
||||
override val isOpOnly = true
|
||||
|
@ -46,11 +47,11 @@ class Modules(private val modulesNames: List<String>) : AbstractCommand() {
|
|||
|
||||
override fun commandResponse(channel: String, args: String, event: GenericMessageEvent) {
|
||||
if (isChannelOp(channel, event)) {
|
||||
if (modulesNames.isEmpty()) {
|
||||
if (addons.modulesNames.isEmpty()) {
|
||||
event.respondPrivateMessage("There are no enabled modules.")
|
||||
} else {
|
||||
event.respondPrivateMessage("The enabled modules are: ")
|
||||
event.sendList(modulesNames, 7, isIndent = true)
|
||||
event.sendList(addons.modulesNames, 7, isIndent = true)
|
||||
}
|
||||
} else {
|
||||
helpResponse(channel, args, event)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue