Add additional information and an example to the docs
This commit is contained in:
61
docs.go
61
docs.go
@ -1,2 +1,61 @@
|
||||
// The keybase package implements an interface for interacting with the Keybase Chat, Team, and Wallet APIs
|
||||
/*
|
||||
The keybase package implements an interface for interacting with the Keybase Chat, Team, and Wallet APIs
|
||||
|
||||
I've tried to follow Keybase's JSON API as closely as possible, so if you're stuck on anything, or wondering
|
||||
why things are organized in a certain way, it's most likely due to that. It may be helpful to look at the
|
||||
Keybase JSON API docs by running some of the following commands in your terminal:
|
||||
// Chat API
|
||||
keybase chat api -h
|
||||
|
||||
// Chat Message Stream
|
||||
keybase chat api-listen -h
|
||||
|
||||
// Team API
|
||||
keybase team api -h
|
||||
|
||||
// Wallet API
|
||||
keybase wallet api -h
|
||||
|
||||
The git repo for this code is hosted on Keybase. You can contact me directly (https://keybase.io/dxb),
|
||||
or join the mkbot team (https://keybase.io/team/mkbot) if you need assistance, or if you'd like to contribute.
|
||||
|
||||
Basic Example
|
||||
|
||||
Here's a quick example of a bot that will attach a reaction with the sender's device name to every message sent
|
||||
in @mkbot#test1:
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"samhofi.us/x/keybase"
|
||||
)
|
||||
|
||||
var k = keybase.NewKeybase()
|
||||
|
||||
func main() {
|
||||
channel := keybase.Channel{
|
||||
Name: "mkbot",
|
||||
TopicName: "test1",
|
||||
MembersType: keybase.TEAM,
|
||||
}
|
||||
opts := keybase.RunOptions{
|
||||
FilterChannel: channel,
|
||||
}
|
||||
fmt.Println("Running...")
|
||||
k.Run(handler, opts)
|
||||
}
|
||||
|
||||
func handler(m keybase.ChatAPI) {
|
||||
msgType := m.Msg.Content.Type
|
||||
msgID := m.Msg.ID
|
||||
deviceName := m.Msg.Sender.DeviceName
|
||||
|
||||
if msgType == "text" {
|
||||
chat := k.NewChat(m.Msg.Channel)
|
||||
chat.React(msgID, deviceName)
|
||||
}
|
||||
}
|
||||
*/
|
||||
package keybase
|
||||
|
||||
Reference in New Issue
Block a user