Documentation ¶
Index ¶
- Constants
- func AddHandlesToList(handles []string) error
- func CreateSubscription() error
- func CreateWebhook() (string, error)
- func FilterTweets(twitterIDs []string) (*twitter.Stream, error)
- func Follow(userID int64) error
- func GetClientFromHandle(handle string) (*twitter.Client, *models.OAuthToken, error)
- func GetClientFromToken(oauthToken *models.OAuthToken) *twitter.Client
- func GetIDFromHandle(handle string) (int64, error)
- func GetList() (*twitter.Members, error)
- func GetListTweets(sinceID int64) ([]twitter.Tweet, error)
- func IsFollower(userID int64) (bool, error)
- func MonitorRatelimit()
- func RemoveHandlesToList(handles []string) error
- func Retweet(handle string, tweetID int64) error
- func SendDM(recipientID int64, message string) error
- func SendTweet(handle string, message string) error
- func SyncList() error
- type OAuthRequest
Constants ¶
const ( // OutOfBand is used for setting the callback URL on the twitter OAuth // endpoint OutOfBand = "oob" // VIPBotHandle is a placeholder which is resolved to the real handle via // an environment variable. VIPBotHandle = "vip" // PartyBotHandle is a placeholder which is resolved to the real handle via // an environment variable. PartyBotHandle = "party" )
Variables ¶
This section is empty.
Functions ¶
func AddHandlesToList ¶
AddHandlesToList takes a slice of Twitter handles and adds them to the TCR list on Twitter
func CreateSubscription ¶
func CreateSubscription() error
CreateSubscription subscribes the current webhook to the given user
func CreateWebhook ¶
CreateWebhook creates a new webhook and subscribes it to the user, allowing us to receive notifications for new DMs. This should only be used on the TCRPartyVIP bot.
func FilterTweets ¶
FilterTweets will begin filtering tweets and outputting them to the returned channel
func GetClientFromHandle ¶
GetClientFromHandle returns a twitter client given a handle constant (ie vip or party) or an explicit twitter handle.
func GetClientFromToken ¶
func GetClientFromToken(oauthToken *models.OAuthToken) *twitter.Client
GetClientFromToken returns a twitter client given an OAuth token
func GetIDFromHandle ¶
GetIDFromHandle converts a twitter handle into an ID
func GetListTweets ¶
GetListTweets retrieves a slice of tweets created since the last tweet ID provided
func IsFollower ¶
IsFollower will return true if the given userID is a follower of the VIP bot
func MonitorRatelimit ¶
func MonitorRatelimit()
MonitorRatelimit will ensure that all twitter calls are executed at most once per two seconds
func RemoveHandlesToList ¶
RemoveHandlesToList takes a slice of Twitter handles and removes them to the TCR list on Twitter
Types ¶
type OAuthRequest ¶
OAuthRequest collects all required information for completing the OAuth1 authentication flow
func (*OAuthRequest) GetOAuthURL ¶
func (request *OAuthRequest) GetOAuthURL() (string, error)
GetOAuthURL returns a URL that can be used to authenticate a user via the OAuth 1 API
func (*OAuthRequest) ReceivePIN ¶
func (request *OAuthRequest) ReceivePIN() error
ReceivePIN completes the OAuth dance by retrieving user info. Note that it requires the PIN to be set on the OAuthRequest struct.