Skip to content

mizoguche/botlin

Repository files navigation

Botlin

CircleCI

Usage

See mizoguche/botlin-template for example.

Deploy template

Deploy

Configuration example

fun main(args: Array<String>) {
    botlin {
        install(SlackEngine) {
            token =  System.getenv("SLACK_TOKEN")
        }

        install(RedisStorage) {
            uri = URI("redis://localhost:6379")
        }

        install(MessageCommand)
        install(Echo)
        install(Cron)

        intercept<BotMessage> {
            if (it.message == "PING") {
                it.reply("PONG")
            }
        }
    }.start()
}

Description

Goal

Easy to use

  • Readable configuration

Easy to extend

  • You can create your original feature easily
  • You can adopt new web services as BotEngine easily

Main objects

  • BotEngine
    • Providers which receives/sends messages
    • ex. SlackEngine
  • BotMessage
    • Abstract expression of messages
  • BotFeature
    • Realize some useful features
    • ex. Echo, Cron
  • BotPipeline
    • Any objects can flow through BotPipeline
      • BotEngines send BotMessages to BotPipeline
    • Objects flowing through BotPipeline are intercepted from BotFeature or Botlin configuration

License

MIT