Jabot
Java + Bot ⇒ Jabot
require Java8 or later
This module is inspired by Ruboty, thank you r7kamura.
Deploy your own
Heroku
with Slack
executable binary
Access Latest Releases Page
- downlaod latest version's
jabot-app-*-executable.zip
and unzip - edit
plugins.yml
to load adapter and handlers - add custom plugin into
lib
directory 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