clo-yunhee / discord-base

Base code for Discord bots

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Discord Base (name subject to change)

Base code for Discord bots written in Kotlin

TODO: -write README -write wiki -unit tests

Example of simple self-contained bot:

fun main(args: Array<String>) {
    runBot {
        configName = "examplebot.cfg"
        
        shardedWith(2)
        
        commands(prefix = "~") {
            it["exit"] = ExitCommand
            it("root") {
                it["first"] = Command {
                    LOGGER.info("First subcommand")
                }
            }
        }
        
        messageHandler { event ->
            if ("ping" in event.message.contentDisplay) {
                event.message.replyAsync { "Pong!" }
            }
        }
    }
}

About

Base code for Discord bots


Languages

Language:Kotlin 100.0%