Jabot

Java + Bot = Jabot

License

License

GroupId

GroupId

com.krrrr38
ArtifactId

ArtifactId

jabot
Last Version

Last Version

0.2.0
Release Date

Release Date

Type

Type

pom
Description

Description

Jabot
Java + Bot = Jabot
Project URL

Project URL

https://github.com/krrrr38/jabot
Source Code Management

Source Code Management

https://github.com/krrrr38/jabot

Download jabot

Filename Size
jabot-0.2.0.pom 6 KB
Browse

How to add to project

<!-- https://jarcasting.com/artifacts/com.krrrr38/jabot/ -->
<dependency>
    <groupId>com.krrrr38</groupId>
    <artifactId>jabot</artifactId>
    <version>0.2.0</version>
    <type>pom</type>
</dependency>
// https://jarcasting.com/artifacts/com.krrrr38/jabot/
implementation 'com.krrrr38:jabot:0.2.0'
// https://jarcasting.com/artifacts/com.krrrr38/jabot/
implementation ("com.krrrr38:jabot:0.2.0")
'com.krrrr38:jabot:pom:0.2.0'
<dependency org="com.krrrr38" name="jabot" rev="0.2.0">
  <artifact name="jabot" type="pom" />
</dependency>
@Grapes(
@Grab(group='com.krrrr38', module='jabot', version='0.2.0')
)
libraryDependencies += "com.krrrr38" % "jabot" % "0.2.0"
[com.krrrr38/jabot "0.2.0"]

Dependencies

provided (1)

Group / Artifact Type Version
org.projectlombok : lombok jar 1.16.8

test (2)

Group / Artifact Type Version
junit : junit jar 4.12
org.hamcrest : hamcrest-library jar 1.3

Project Modules

  • jabot-app
  • jabot-loader
  • jabot-plugin-base
  • jabot-handler-plugin
  • jabot-adapter-plugin
  • jabot-brain-plugin
  • plugins/jabot-shell-adapter
  • plugins/jabot-slack-adapter
  • plugins/jabot-hipchat-adapter
  • plugins/jabot-line-bot-api-adapter
  • plugins/jabot-inmemory-brain
  • plugins/jabot-redis-brain
  • plugins/jabot-ping-handler
  • plugins/jabot-time-handler
  • plugins/jabot-help-handler
  • plugins/jabot-echo-handler
  • plugins/jabot-replace-handler
  • plugins/jabot-task-handler
  • plugins/jabot-memo-handler
  • plugins/jabot-job-handler
  • plugins/jabot-health-check-handler

Jabot

Build Status Maven Central License: MIT

Java + Bot ⇒ Jabot

require Java8 or later

This module is inspired by Ruboty, thank you r7kamura.

Deploy your own

Heroku

Deploy with Slack

executable binary

Access Latest Releases Page

  1. downlaod latest version's jabot-app-*-executable.zip and unzip
  2. edit plugins.yml to load adapter and handlers
  3. add custom plugin into lib directory
  4. sh bin/jabot (-c /path/to/plugins.yml)

One adapter is required. Handlers and Brain are optional. If brain is not set, in-memory brain would be used.

├── plugins.yml
├── bin
│   ├── jabot
│   └── jabot.bat
└── lib
    ├── jabot-echo-handler.jar
    ├── jabot-ping-handler.jar
    ├── jabot-inmemory-brain.jar
    ├── jabot-shell-adapter.jar
    ├── ...
    └── ... (more custom plugin jar)

plugins.yml example (namespace is used as brain namespace)

# this file is example plugins setting
name: jabot
adapter: # require one adapter
  plugin: com.krrrr38.jabot.plugin.adapter.ShellAdapter
  namespace: shell-adapter
  options:
    prompt: "> "
handlers: # NOTE: messages would be handled by THIS ORDER.
  - plugin: com.krrrr38.jabot.plugin.handler.HelpHandler
    namespace: help-handler
  - plugin: com.krrrr38.jabot.plugin.handler.PingHandler
    namespace: ping-handler
    options:
      foo: ENV['OTHER_ENV']
brain:
  plugin: com.krrrr38.jabot.plugin.brain.InmemoryBrain
  namespace: inmemory-brain
  options:
    secretPassword: bar

options are also loaded from system environment variables with NAME_SPACE_OPTION_KEY format like followings.

SHELL_ADAPTER_PROMPT=>>>
INMEMORY_BRAIN_SECRET_PASSWORD=bar

See plugins directory.

Development jabot

Run jabot with jabot-app/src/assemble/plugins.yml

make run

Test

make test

jabot-app

executable interface project

jabot-loader

core functions to load plugins and start application

Development jabot Plugins

When using following plugins, just package and copy jar into plugins directory and edit plugins.yml, then restart jabot.

+------+      +---------+      +---------+      +-------+
| User | <==> | Adapter | <==> | Handler | <==> | Brain |
+------+      +---------+      +---------+      +-------+

Adapter

Adapter make us to receive and send messages with bot, such as ShellAdapter, SlackAdapter,...

add dependency

<dependency>
  <groupId>com.krrrr38</groupId>
  <artifactId>jabot-adapter-plugin</artifactId>
</dependency>

write your Adapter which extends Adapter.

Handler

Handler define rules that bot reply messages or change message for next handler and so on, such as PingHandler, ReplaceHandler,...

Usually, multiple Handlers are users like a chain.

add dependency

<dependency>
  <groupId>com.krrrr38</groupId>
  <artifactId>jabot-handler-plugin</artifactId>
</dependency>

write your Handler which extends Handler

Brain

Brain is storage for Handlers, such as InmemoryBrain, RedisBrain,...

add dependency

<dependency>
  <groupId>com.krrrr38</groupId>
  <artifactId>jabot-brain-plugin</artifactId>
</dependency>

write your Brain which extends Brain

Distribution

packaging

make package # generate executable zip, tar.gz in `jabot-app/target`

Release

make release

SNAPSHOT

make deploy

Versions

Version
0.2.0
0.1.2
0.1.1
0.1.0
0.0.1