Skip to content

Latest commit

 

History

History
136 lines (93 loc) · 3.32 KB

README.md

File metadata and controls

136 lines (93 loc) · 3.32 KB

botan(牡丹)

Join the chat at https://gitter.im/masahitojp/botan-core

Circle CI

Maven Central

Known Vulnerabilities

botan Tiny chat bot framework for Java SE 8.(like a Hubot)

requirement

Java8

Getting Started

Write simple java application

package com.github.masahitojp.implementation;

import com.github.masahitojp.botan.Botan;
import com.github.masahitojp.botan.exception.BotanException;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class SlackBot {

    static public void main(final String[] Args) {

        final Botan botan = new Botan.BotanBuilder()
                .build();
        try {
            botan.start();
        } catch (final BotanException ex) {
            log.warn(ex.getMessage());
        }

    }
}
package com.github.masahitojp.implementation.handlers;

import com.github.masahitojp.botan.Robot;
import com.github.masahitojp.botan.handler.BotanMessageHandlers;

@SuppressWarnings("unused")
public class PingMessageHandlers implements BotanMessageHandlers {

    @Override
    public void register(final Robot robot) {
        robot.respond(
                "ping\z",
                "ping method",
                message -> message.reply("pong")
        );
    }
}

if you want to more examples, see sample project.

Add dependency to your build.gradle

apply plugin: 'java'

repositories.mavenCentral()

dependencies {
	compile 'com.github.masahitojp:botan-core:0.6.+'
}

sourceCompatibility = targetCompatibility = 1.8

Run and View

show your slack team

Features

Currently, supports following adapters and brains:

License

Apache License, Version 2.0

Special Thanks

  • @_pochi -san wrote a nice logo. Thanks!!

Inspired projects

How to write Handlers

  • create class which implements BotanMessageHandlers.
  • Override register method
    • Robot#respond
package com.github.masahitojp.implementation.handlers;

import com.github.masahitojp.botan.Robot;
import com.github.masahitojp.botan.handler.BotanMessageHandlers;

@SuppressWarnings("unused")
public class PingMessageHandlers implements BotanMessageHandlers {

    @Override
    public void register(final Robot robot) {
        robot.respond(
                "ping\z",
                "ping method",
                message -> message.reply("pong")
        );
    }
}