jabot-ping-handler

Java + Bot = Jabot

License

License

GroupId

GroupId

com.krrrr38
ArtifactId

ArtifactId

jabot-ping-handler
Last Version

Last Version

0.2.0
Release Date

Release Date

Type

Type

jar
Description

Description

jabot-ping-handler
Java + Bot = Jabot

Download jabot-ping-handler

How to add to project

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

Dependencies

compile (1)

Group / Artifact Type Version
com.krrrr38 : jabot-handler-plugin jar 0.2.0

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

There are no modules declared in this project.

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