Esempio n. 1
0
func newDMFolder(api *anaconda.TwitterApi) cmdfolder.Folder {
	// Create the folder
	folder := &Folder{cmdfolder.New(), api}

	// Add commands
	folder.AddCommand("ls", folder.lsDM)

	return folder
}
Esempio n. 2
0
func main() {
	folder := cmdfolder.New()

	// Add services
	folder.AddFolder("twitter", twitter.New())

	// Run it
	folder.Run()
}
Esempio n. 3
0
func newThreadFolder(api *anaconda.TwitterApi, thread *dmThread) cmdfolder.Folder {
	// Create the folder
	folder := &ThreadFolder{cmdfolder.New(), api, thread}

	// Add commands
	folder.AddCommand("ls", folder.lsDM)
	folder.AddCommand("say", folder.say)

	return folder
}
Esempio n. 4
0
/*
New makes a new twitter folder
*/
func New() cmdfolder.Folder {
	// Make API
	anaconda.SetConsumerKey(os.Getenv("TWITTER_API_KEY"))
	anaconda.SetConsumerSecret(os.Getenv("TWITTER_API_SECRET"))
	api := anaconda.NewTwitterApi(os.Getenv("TWITTER_ACCESS_TOKEN"), os.Getenv("TWITTER_ACCESS_TOKEN_SECRET"))

	// Make folder wrappers and store apis
	folder := &Folder{cmdfolder.New(), api}
	dmFolder := newDMFolder(api)

	// Add folders
	folder.AddFolder("dm", dmFolder)

	return folder
}