Tiny chat bot framework for Java SE 8.(like a Hubot)
Java8
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.
apply plugin: 'java'
repositories.mavenCentral()
dependencies {
compile 'com.github.masahitojp:botan-core:0.6.+'
}
sourceCompatibility = targetCompatibility = 1.8
show your slack team
Currently, supports following adapters and brains:
- Adapter
- Slack
- Brain
- Redis
- botan-mapdb(MapDB)
Apache License, Version 2.0
- @_pochi -san wrote a nice logo. Thanks!!
- https://hubot.github.com/
- https://www.lita.io/
- https://github.com/r7kamura/ruboty
- https://github.com/liquidz/jubot
- 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")
);
}
}