twitter

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const TwitterAPIBase = "https://api.twitter.com/2"

TwitterAPIBase is the base URL for Twitter API v2

Variables

This section is empty.

Functions

This section is empty.

Types

type Tweet

type Tweet struct {
	ID   string `json:"id"`
	Text string `json:"text"`
}

Tweet represents a tweet object

type TwitterClient

type TwitterClient struct {
	BearerToken string
	Client      *http.Client
}

TwitterClient represents a Twitter API client

func NewTwitterClient

func NewTwitterClient(bearerToken string) *TwitterClient

NewTwitterClient initializes a new Twitter API client

func (*TwitterClient) AddStreamRule

func (t *TwitterClient) AddStreamRule(username string) error

AddStreamRule adds a rule to listen for mentions

func (*TwitterClient) DeleteStreamRules

func (t *TwitterClient) DeleteStreamRules(ruleIDs []string) error

DeleteStreamRules removes specific stream rules

func (*TwitterClient) GetReplies

func (t *TwitterClient) GetReplies(tweetID, botUsername string) ([]Tweet, error)

GetReplies fetches all replies to a tweet

func (*TwitterClient) GetStreamRules

func (t *TwitterClient) GetStreamRules() ([]byte, error)

GetStreamRules fetches existing stream rules

func (*TwitterClient) HasReplied

func (t *TwitterClient) HasReplied(tweetID, botUsername string) (bool, error)

HasReplied checks if the bot has already replied to a tweet

func (*TwitterClient) ListenForMentions

func (t *TwitterClient) ListenForMentions() (*Tweet, error)

ListenForMentions listens to the stream for mentions

func (*TwitterClient) Post

func (t *TwitterClient) Post(message string) error

func (*TwitterClient) ReplyToTweet

func (t *TwitterClient) ReplyToTweet(tweetID, message string) error

ReplyToTweet replies to a given tweet

Jump to

Keyboard shortcuts

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