twitter

package
v0.0.0-...-eb4b608 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2023 License: Unlicense Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxNoteLength = 500
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BirdwatchPivot

type BirdwatchPivot struct {
	DestinationUrl string `json:"destinationUrl"`
	Footer         struct {
		Text     string `json:"text"`
		Entities []struct {
			FromIndex int `json:"fromIndex"`
			ToIndex   int `json:"toIndex"`
			Ref       struct {
				Type    string `json:"type"`
				Url     string `json:"url"`
				UrlType string `json:"urlType"`
			} `json:"ref"`
		} `json:"entities"`
	} `json:"footer"`
	Note struct {
		RestId string `json:"rest_id"`
	} `json:"note"`
	Subtitle struct {
		Text     string `json:"text"`
		Entities []struct {
			FromIndex int `json:"fromIndex"`
			ToIndex   int `json:"toIndex"`
			Ref       struct {
				Type    string `json:"type"`
				Url     string `json:"url"`
				UrlType string `json:"urlType"`
			} `json:"ref"`
		} `json:"entities"`
	} `json:"subtitle"`
	Title    string `json:"title"`
	IconType string `json:"iconType"`
}

type Card

type Card struct {
	RestId string `json:"rest_id"`
	Legacy struct {
		BindingValues []struct {
			Key   string `json:"key"`
			Value struct {
				StringValue  string `json:"string_value,omitempty"`
				Type         string `json:"type"`
				BooleanValue bool   `json:"boolean_value,omitempty"`
				ScribeKey    string `json:"scribe_key,omitempty"`
			} `json:"value"`
		} `json:"binding_values"`
		CardPlatform struct {
			Platform struct {
				Audience struct {
					Name string `json:"name"`
				} `json:"audience"`
				Device struct {
					Name    string `json:"name"`
					Version string `json:"version"`
				} `json:"device"`
			} `json:"platform"`
		} `json:"card_platform"`
		Name            string        `json:"name"`
		Url             string        `json:"url"`
		UserRefsResults []interface{} `json:"user_refs_results"`
	} `json:"legacy"`
}

func (*Card) HasPoll

func (c *Card) HasPoll() bool

func (*Card) Poll

func (c *Card) Poll() (Poll, error)

type Legacy

type Legacy struct {
	BookmarkCount     int    `json:"bookmark_count"`
	CreatedAt         string `json:"created_at"`
	ConversationIdStr string `json:"conversation_id_str"`
	DisplayTextRange  []int  `json:"display_text_range"`
	Entities          struct {
		Media []struct {
			DisplayUrl    string `json:"display_url"`
			ExpandedUrl   string `json:"expanded_url"`
			IdStr         string `json:"id_str"`
			Indices       []int  `json:"indices"`
			MediaUrlHttps string `json:"media_url_https"`
			Type          string `json:"type"`
			Url           string `json:"url"`
			Sizes         struct {
				Large struct {
					H      int    `json:"h"`
					W      int    `json:"w"`
					Resize string `json:"resize"`
				} `json:"large"`
				Medium struct {
					H      int    `json:"h"`
					W      int    `json:"w"`
					Resize string `json:"resize"`
				} `json:"medium"`
				Small struct {
					H      int    `json:"h"`
					W      int    `json:"w"`
					Resize string `json:"resize"`
				} `json:"small"`
				Thumb struct {
					H      int    `json:"h"`
					W      int    `json:"w"`
					Resize string `json:"resize"`
				} `json:"thumb"`
			} `json:"sizes"`
			OriginalInfo struct {
				Height     int `json:"height"`
				Width      int `json:"width"`
				FocusRects []struct {
					X int `json:"x"`
					Y int `json:"y"`
					W int `json:"w"`
					H int `json:"h"`
				} `json:"focus_rects"`
			} `json:"original_info"`
		} `json:"media"`
		UserMentions []interface{} `json:"user_mentions"`
		Urls         []Url         `json:"urls"`
	} `json:"entities"`
	ExtendedEntities struct {
		Media []Medium `json:"media"`
	} `json:"extended_entities"`
	FavoriteCount             int    `json:"favorite_count"`
	Favorited                 bool   `json:"favorited"`
	FullText                  string `json:"full_text"`
	IsQuoteStatus             bool   `json:"is_quote_status"`
	Lang                      string `json:"lang"`
	PossiblySensitive         bool   `json:"possibly_sensitive"`
	PossiblySensitiveEditable bool   `json:"possibly_sensitive_editable"`
	QuoteCount                int    `json:"quote_count"`
	ReplyCount                int    `json:"reply_count"`
	RetweetCount              int    `json:"retweet_count"`
	Retweeted                 bool   `json:"retweeted"`
	UserIdStr                 string `json:"user_id_str"`
	IdStr                     string `json:"id_str"`
}

func (*Legacy) Metrics

func (l *Legacy) Metrics() string

type Medium

type Medium struct {
	DisplayUrl           string `json:"display_url"`
	ExpandedUrl          string `json:"expanded_url"`
	IdStr                string `json:"id_str"`
	Indices              []int  `json:"indices"`
	MediaKey             string `json:"media_key"`
	MediaUrlHttps        string `json:"media_url_https"`
	Type                 string `json:"type"`
	Url                  string `json:"url"`
	ExtMediaAvailability struct {
		Status string `json:"status"`
	} `json:"ext_media_availability"`
	MediaStats struct {
		ViewCount int `json:"viewCount"`
	} `json:"mediaStats"`
	VideoInfo struct {
		Variants []struct {
			Url     string `json:"url"`
			Bitrate int    `json:"bitrate"`
		} `json:"variants"`
	} `json:"video_info"`
}

func (*Medium) Caption

func (m *Medium) Caption() string

func (*Medium) IsGIF

func (m *Medium) IsGIF() bool

func (*Medium) IsPhoto

func (m *Medium) IsPhoto() bool

func (*Medium) IsVideo

func (m *Medium) IsVideo() bool
func (m *Medium) Link() string

type NoteTweet

type NoteTweet struct {
	IsExpandable     bool `json:"is_expandable"`
	NoteTweetResults struct {
		Result struct {
			Id        string `json:"id"`
			Text      string `json:"text"`
			EntitySet struct {
				UserMentions []interface{} `json:"user_mentions"`
				Urls         []struct {
					DisplayUrl  string `json:"display_url"`
					ExpandedUrl string `json:"expanded_url"`
					Url         string `json:"url"`
					Indices     []int  `json:"indices"`
				} `json:"urls"`
				Hashtags []interface{} `json:"hashtags"`
				Symbols  []interface{} `json:"symbols"`
			} `json:"entity_set"`
		} `json:"result"`
	} `json:"note_tweet_results"`
}

type Option

type Option struct {
	Position int
	Label    string
	Votes    int
}

type Plugin

type Plugin struct{}

func New

func New() *Plugin

func (*Plugin) Commands

func (p *Plugin) Commands() []telebot.Command

func (*Plugin) Handlers

func (p *Plugin) Handlers(*telebot.User) []plugin.Handler

func (*Plugin) Name

func (*Plugin) Name() string

func (*Plugin) OnStatus

func (p *Plugin) OnStatus(c plugin.GobotContext) error

type Poll

type Poll struct {
	EndDatetime time.Time
	Options     []Option
	TotalVotes  int
}

func (*Poll) Closed

func (p *Poll) Closed() bool

type Result

type Result struct {
	TweetInfo           // TODO: On Withheld, TweetInfo is under "Tweet"
	Tweet     TweetInfo `json:"tweet"`
	Typename  string    `json:"__typename"`
	Reason    string    `json:"reason"`
	Card      Card      `json:"card"`
}

type TokenResponse

type TokenResponse struct {
	GuestToken string `json:"guest_token"`
}

type Tombstone

type Tombstone struct {
	Typename string `json:"__typename"`
	Text     struct {
		Text     string `json:"text"`
		Entities []struct {
			FromIndex int `json:"fromIndex"`
			ToIndex   int `json:"toIndex"`
			Ref       struct {
				Type    string `json:"type"`
				Url     string `json:"url"`
				UrlType string `json:"urlType"`
			} `json:"ref"`
		} `json:"entities"`
	} `json:"text"`
}

type Tweet

type Tweet struct {
	RestId         string         `json:"rest_id"`
	BirdwatchPivot BirdwatchPivot `json:"birdwatch_pivot"`
	Core           struct {
		UserResults UserResult `json:"user_results"`
	} `json:"core"`
	NoteTweet NoteTweet `json:"note_tweet"`
	Source    string    `json:"source"`
	Legacy    Legacy    `json:"legacy"`
	Card      Card      `json:"card"`
}

type TweetInfo

type TweetInfo struct {
	RestId         string         `json:"rest_id"`
	BirdwatchPivot BirdwatchPivot `json:"birdwatch_pivot"`
	Core           struct {
		UserResults UserResult `json:"user_results"`
	} `json:"core"`
	UnmentionInfo struct {
	} `json:"unmention_info"`
	Source string `json:"source"`

	NoteTweet          NoteTweet `json:"note_tweet"`
	Legacy             Legacy    `json:"legacy"`
	QuotedStatusResult struct {
		Result struct {
			Tweet
			Reason   string `json:"reason"`
			Typename string `json:"__typename"`

			TweetSub Tweet `json:"tweet"`
		} `json:"result"`
	} `json:"quoted_status_result"`
}

type TweetResponse

type TweetResponse struct {
	Data struct {
		TweetResult struct {
			Result Result `json:"result"`
		} `json:"tweetResult"`
	} `json:"data"`
}

type Url

type Url struct {
	DisplayUrl  string `json:"display_url"`
	ExpandedUrl string `json:"expanded_url"`
	Url         string `json:"url"`
	Indices     []int  `json:"indices"`
}

type UserResult

type UserResult struct {
	Result struct {
		Typename                   string `json:"__typename"`
		Id                         string `json:"id"`
		RestId                     string `json:"rest_id"`
		AffiliatesHighlightedLabel struct {
		} `json:"affiliates_highlighted_label"`
		HasNftAvatar bool `json:"has_nft_avatar"`
		Legacy       struct {
			CreatedAt           string `json:"created_at"`
			DefaultProfile      bool   `json:"default_profile"`
			DefaultProfileImage bool   `json:"default_profile_image"`
			Description         string `json:"description"`
			Entities            struct {
				Description struct {
					Urls []struct {
						DisplayUrl  string `json:"display_url"`
						ExpandedUrl string `json:"expanded_url"`
						Url         string `json:"url"`
						Indices     []int  `json:"indices"`
					} `json:"urls"`
				} `json:"description"`
				Url struct {
					Urls []struct {
						DisplayUrl  string `json:"display_url"`
						ExpandedUrl string `json:"expanded_url"`
						Url         string `json:"url"`
						Indices     []int  `json:"indices"`
					} `json:"urls"`
				} `json:"url"`
			} `json:"entities"`
			FastFollowersCount      int           `json:"fast_followers_count"`
			FavouritesCount         int           `json:"favourites_count"`
			FollowersCount          int           `json:"followers_count"`
			FriendsCount            int           `json:"friends_count"`
			HasCustomTimelines      bool          `json:"has_custom_timelines"`
			IsTranslator            bool          `json:"is_translator"`
			ListedCount             int           `json:"listed_count"`
			Location                string        `json:"location"`
			MediaCount              int           `json:"media_count"`
			Name                    string        `json:"name"`
			NormalFollowersCount    int           `json:"normal_followers_count"`
			PinnedTweetIdsStr       []string      `json:"pinned_tweet_ids_str"`
			PossiblySensitive       bool          `json:"possibly_sensitive"`
			ProfileBannerUrl        string        `json:"profile_banner_url"`
			ProfileImageUrlHttps    string        `json:"profile_image_url_https"`
			ProfileInterstitialType string        `json:"profile_interstitial_type"`
			Protected               bool          `json:"protected"`
			ScreenName              string        `json:"screen_name"`
			StatusesCount           int           `json:"statuses_count"`
			TranslatorType          string        `json:"translator_type"`
			Url                     string        `json:"url"`
			Verified                bool          `json:"verified"`
			VerifiedType            string        `json:"verified_type"`
			WithheldInCountries     []interface{} `json:"withheld_in_countries"`
		} `json:"legacy"`
	} `json:"result"`
}

func (*UserResult) Author

func (u *UserResult) Author() string

Jump to

Keyboard shortcuts

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