Welcome to the home to Handwriting.io's chatbot, Deckard.
Deckard is a chatbot library that can help you simplify your life. He was created as a way to help Handwriting.io developers work more efficiently and transparently.
Deckard has two connections built-in. You can talk to him through Slack or through a terminal (stdin/stdout).
Download the source code
go get github.com/handwritingio/deckard-bot
Alternatively, git clone
and go build
to run from source.
And install
go install github.com/handwritingio/deckard-bot
See PLUGINS.md for requirements for each of Deckard's built-in plugins.
First, create a Slack bot:
- Deckard connects to Slack using the Slack RTM (Real Time Messaging API).
- You will need to Create a Slack Bot and get your bot's Slack API Token.
Then initialize the Slack connection in your main.go
import "github.com/handwritingio/deckard-bot/connection/slack"
func main() {
...
slackConn := slack.NewConnection("mySlackBotAPIToken")
...
}
First initialize the Stdio connection in your main.go
import "github.com/handwritingio/deckard-bot/connection/stdio"
func main() {
...
stdioConn := slack.NewConnection()
...
}
That's it!
Once you create a connection, you should initialize plugins and create your bot. We provided a few example plugins that you can use, but feel free to create your own!
import (
"github.com/handwritingio/deckard-bot/bot"
"github.com/handwritingio/deckard-bot/plugins/cats"
// Make sure to import your custom plugins
)
func main() {
...
deckard := bot.New("Deckard", myConnection,
&cats.Plugin{},
// Any other plugins
)
...
}
Now that you've created a connection and initialized your plugins, you should create a new bot and start the bot. Here's an example of what a main.go file can look like:
package main
import (
"github.com/handwritingio/deckard-bot/bot"
"github.com/handwritingio/deckard-bot/plugins/cats"
"github.com/handwritingio/deckard-bot/plugins/dice"
"github.com/handwritingio/deckard-bot/plugins/principles"
"github.com/handwritingio/deckard-bot/plugins/tableflip"
"github.com/handwritingio/deckard-bot/connection/stdio"
)
func main() {
// 1. Setup a new connection
conn := stdio.NewConnection()
// 2. Create the bot using the connection and a list of plugins
deckard := bot.New("Deckard", conn,
&dice.Plugin{},
&tableflip.Plugin{},
&cats.Plugin{},
&principles.Plugin{},
)
// 3. Start the bot!
deckard.Go()
}
go build .
./deckard-bot
See DEVELOP.md
See CONTRIBUTING.md
See LICENSE
Version numbers for this package will follow standard semantic versioning.
Please open an issue on Github and we will look into it as soon as possible.