jabot-plugin-base

Java + Bot = Jabot

Лицензия

Лицензия

Группа

Группа

com.krrrr38
Идентификатор

Идентификатор

jabot-plugin-base
Последняя версия

Последняя версия

0.2.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

jabot-plugin-base
Java + Bot = Jabot

Скачать jabot-plugin-base

Как подключить последнюю версию

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

Зависимости

compile (1)

Идентификатор библиотеки Тип Версия
org.slf4j : slf4j-api jar 1.7.12

provided (1)

Идентификатор библиотеки Тип Версия
org.projectlombok : lombok jar 1.16.8

test (3)

Идентификатор библиотеки Тип Версия
com.github.stefanbirkner : system-rules jar 1.16.0
junit : junit jar 4.12
org.hamcrest : hamcrest-library jar 1.3

Модули Проекта

Данный проект не имеет модулей.

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

Версии библиотеки

Версия
0.2.0
0.1.2
0.1.1
0.1.0
0.0.1