Java + Bot ⇒ Jabot
require Java8 or later
This module is inspired by Ruboty, thank you r7kamura.
with Slack
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.
Run jabot with jabot-app/src/assemble/plugins.yml
make run
Test
make test
executable interface project
core functions to load plugins and start application
When using following plugins, just package and copy jar into plugins directory and edit plugins.yml
, then restart jabot.
+------+ +---------+ +---------+ +-------+
| User | <==> | Adapter | <==> | Handler | <==> | Brain |
+------+ +---------+ +---------+ +-------+
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 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 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
packaging
make package # generate executable zip, tar.gz in `jabot-app/target`
make release
SNAPSHOT
make deploy