This is a refactor of samhofi.us/x/keybase/v2 that takes advantage of the libkeybase performance improvements.
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"keybase/api"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
// Create new keybase api instance
|
|
|
|
k := api.New()
|
|
|
|
|
|
|
|
// Get username, logged in status, and client version
|
|
|
|
username := k.Username()
|
|
|
|
loggedin := k.LoggedIn()
|
|
|
|
version := k.Version()
|
|
|
|
|
|
|
|
// Send current client version to self if client is logged in.
|
|
|
|
if loggedin {
|
|
|
|
chatList, _ := k.ChatList()
|
|
|
|
allChats := ""
|
|
|
|
for _, chat := range chatList {
|
|
|
|
if chat.Channel.MembersType == "team" {
|
|
|
|
allChats += fmt.Sprintf("%s#%s\n", chat.Channel.Name, chat.Channel.TopicName)
|
|
|
|
} else {
|
|
|
|
allChats += fmt.Sprintf("%s\n", chat.Channel.Name)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
c, _ := k.ChatSend(username, fmt.Sprintf("Version: %s\nConversations:\n```%s```\n", version, allChats))
|
|
|
|
fmt.Println(c.Result.Message)
|
|
|
|
} else {
|
|
|
|
fmt.Println("Not logged in")
|
|
|
|
}
|
|
|
|
}
|