twitter

package
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 14, 2018 License: MIT Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Twitter

type Twitter struct {
	API           TwitterAPI
	Configuration *anaconda.Configuration
	Mutex         *sync.Mutex
}

Twitter is the data structure to reflect the twitter client

func NewClient

func NewClient(consumerKey, consumerSecret, accessToken, accessTokenSecret string, debug bool) *Twitter

NewClient returns a new client to communicate with twitter. If debug is enabled, we will load a debug configuration for the twitter client.

func (*Twitter) FollowNewPerson

func (client *Twitter) FollowNewPerson() error

FollowNewPerson will follow a new person on twitter to raise the attraction for the bot. We will follow a new person who follow on random follower of @TrendingGithub Only persons who don`t have a relationship to the bot will be followed.

func (*Twitter) LoadConfiguration

func (client *Twitter) LoadConfiguration() error

LoadConfiguration loads the configuration of the twitter client from twitter. See https://dev.twitter.com/rest/reference/get/help/configuration

func (*Twitter) SetupConfigurationRefresh

func (client *Twitter) SetupConfigurationRefresh(d time.Duration)

SetupConfigurationRefresh sets up a scheduler and will refresh the configuration from twitter every duration d. The reason for this is that these values can change over time. See https://dev.twitter.com/rest/reference/get/help/configuration

func (*Twitter) SetupFollowNewPeopleScheduling

func (client *Twitter) SetupFollowNewPeopleScheduling(d time.Duration)

SetupFollowNewPeopleScheduling sets up a scheduler and will search for a new person to follow every duration d. This is our growth hack feature.

func (*Twitter) Tweet

func (client *Twitter) Tweet(text string) (*anaconda.Tweet, error)

Tweet will ... tweet the text :D ... Badum ts

type TwitterAPI

type TwitterAPI interface {
	GetConfiguration(v url.Values) (conf anaconda.Configuration, err error)
	PostTweet(status string, v url.Values) (tweet anaconda.Tweet, err error)
	GetFollowersIds(v url.Values) (c anaconda.Cursor, err error)
	GetFriendshipsLookup(v url.Values) (friendships []anaconda.Friendship, err error)
	FollowUserId(userId int64, v url.Values) (user anaconda.User, err error)
}

TwitterAPI is the interface to decouple the twitter API.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL