func (r *robot) Name() string {
	return r.name
}
Name returns the name of the bot
package victor
import (
	"fmt"
	"log"
	"os"
	"strings"
	"github.com/brettbuddin/victor/pkg/chat"
	_ "github.com/brettbuddin/victor/pkg/chat/campfire"
	_ "github.com/brettbuddin/victor/pkg/chat/hipchat"
	_ "github.com/brettbuddin/victor/pkg/chat/shell"
	_ "github.com/brettbuddin/victor/pkg/chat/slack"
	_ "github.com/brettbuddin/victor/pkg/chat/slackRealtime"
	"github.com/brettbuddin/victor/pkg/httpserver"
	"github.com/brettbuddin/victor/pkg/store"
	_ "github.com/brettbuddin/victor/pkg/store/boltstore"
	_ "github.com/brettbuddin/victor/pkg/store/memory"
	"github.com/gorilla/mux"
)
type Robot interface {
	Run()
	Stop()
	Name() string
	HandleFunc(string, HandlerFunc)
	Handle(string, Handler)
	Direct(string) string
	Receive(chat.Message)
	Chat() chat.Adapter
	Store() store.Adapter
	HTTP() *mux.Router
	AdapterConfig() (interface{}, bool)
	StoreConfig() (interface{}, bool)
}
type Config struct {
	Name,
	ChatAdapter,
	StoreAdapter,
	HTTPAddr string
	AdapterConfig,
	StoreConfig interface{}
}
type robot struct {
	*dispatch
	name       string
	http       *httpserver.Server
	httpAddr   string
	httpRouter *mux.Router
	store      store.Adapter
	chat       chat.Adapter
	incoming   chan chat.Message
	stop       chan struct{}
	adapterConfig,
	storeConfig interface{}
}
func New(config Config) *robot {
	chatAdapter := config.ChatAdapter
	if chatAdapter == "" {
		chatAdapter = "shell"
	}
	chatInitFunc, err := chat.Load(config.ChatAdapter)
	if err != nil {
		log.Println(err)
		os.Exit(1)
	}
	storeAdapter := config.StoreAdapter
	if storeAdapter == "" {
		storeAdapter = "memory"
	}
	storeInitFunc, err := store.Load(storeAdapter)
	if err != nil {
		log.Println(err)
		os.Exit(1)
	}
	botName := config.Name
	if botName == "" {
		botName = "victor"
	}
	httpAddr := config.HTTPAddr
	if httpAddr == "" {
		httpAddr = ":9000"
	}
	bot := &robot{
		name:     botName,
		httpAddr: httpAddr,
		incoming: make(chan chat.Message),
		stop:     make(chan struct{}),
	}
	bot.store = storeInitFunc(bot)
	bot.adapterConfig = config.AdapterConfig
	bot.dispatch = newDispatch(bot)
	bot.chat = chatInitFunc(bot)
	return bot
}
func (r *robot) Receive(m chat.Message) {
	r.incoming <- m
}
func (r *robot) Run() {
	go r.chat.Run()
	go func() {
		for {
			select {
			case <-r.stop:
				close(r.incoming)
				return
			case m := <-r.incoming:
				if strings.ToLower(m.UserName()) != r.name {
					go r.ProcessMessage(m)
				}
			}
		}
	}()
}
func (r *robot) Stop() {
	r.chat.Stop()
	close(r.stop)
	if r.http != nil {
		r.http.Stop()
	}
}