package com.github.masahitojp.botan;

import com.github.masahitojp.botan.adapter.ComandLineAdapter;
import com.github.masahitojp.botan.adapter.SlackAdapter;
import com.github.masahitojp.botan.brain.MapDBBrain;
import com.github.masahitojp.botan.brain.RedisBrain;
import com.github.masahitojp.botan.exception.BotanException;
import com.github.masahitojp.botan.utils.BotanUtils;

public class SlackBot {


	static public void main(String[] Args) {

        final String team = BotanUtils.envToOpt("SLACK_TEAM").orElse("");
        final String user = BotanUtils.envToOpt("SLACK_USERNAME").orElse("");
        final String pswd = BotanUtils.envToOpt("SLACK_PASSWORD").orElse("");
        final String channel = BotanUtils.envToOpt("SLACK_ROOM").orElse("");
        final String mapDBPath = BotanUtils.envToOpt("MAPDB_PATH").orElse("botanDB");
        final String mapDBName = BotanUtils.envToOpt("MAPDB_NAME").orElse(team);

        final Botan botan = new Botan.BotanBuilder(new ComandLineAdapter())
                .setBrain(new RedisBrain("localhost", 6379))
                .build();

        try {
            botan.start();
        } catch (final BotanException ex) {
            ex.printStackTrace();
        }

	}
}

@@ -78,135 +78,20 @@
 ter.
-ComandLineAdapter;%0Aimport com.github.masahitojp.botan.adapter.SlackAdapter;%0Aimport com.github.masahitojp.botan.brain.MapDBBrain
+SlackAdapter
 ;%0Aim
@@ -282,17 +282,20 @@
 Bot %7B%0A%0A%0A
-%09
+    
 static p
@@ -660,17 +660,17 @@
 ing 
-mapDBPath
+redisHost
  = B
@@ -693,18 +693,18 @@
 pt(%22
-MAPDB_PATH
+REDIS_HOST
 %22).o
@@ -714,15 +714,17 @@
 se(%22
-botanDB
+localhost
 %22);%0A
@@ -748,17 +748,17 @@
 ing 
-mapDBName
+redisPort
  = B
@@ -781,35 +781,198 @@
 pt(%22
-MAPDB_NAME%22).orElse(team);%0A
+REDIS_PORT%22).orElse(%22%22);%0A        int port;%0A        try %7B%0A            port = Integer.parseInt(redisPort);%0A        %7D catch (final NumberFormatException ex) %7B%0A            port = 6379;%0A        %7D
 %0A   
@@ -1027,26 +1027,46 @@
 new 
-ComandLineAdapter(
+SlackAdapter(team, user, pswd, channel
 ))%0A 
@@ -1109,25 +1109,23 @@
 ain(
-%22localh
+redisH
 ost
-%22
 , 
-6379
+port
 ))%0A 
@@ -1284,9 +1284,12 @@
  %7D%0A%0A
-%09
+    
 %7D%0A%7D%0A

modify botan-core 0.0.0.25