A simple package for bootstrapping a Twitter bot in Go
Go
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
LICENSE
README.md
twitter.go

README.md

botville

Twitter bot bootstrapping for Go

Make sure to define the following environment variables:

  • BOTVILLE_TWITTER_ID – the numeric Twitter id of the bot
  • BOTVILLE_TWITTER_KEY, BOTVILLE_TWITTER_SECRET – the API key and secret belonging to the bot
  • BOTVILLE_TWITTER_ACCESS_KEY, BOTVILLE_TWITTER_ACCESS_SECRET – the OAuth access credentials for the bot

Quick example:

import "github.com/zhaytee/botville"

func main() {
    eventQueue := botville.StartConnectionLoop()
    for {
        e := <-eventQueue
        switch event := e.(type) {
        case botville.MessageEvent:
            handleMessageEvent(&event)
        case botville.FollowEvent:
            handleFollowEvent(&event)
        case botville.StreamChangeEvent:
            handleStreamChangeEvent(&event)
        }
    }        
}