Documentation ¶
Index ¶
- type ChannelData
- type Database
- func (d *Database) AddChannel(twitchName, channel string, hook *Webhook) (err error)
- func (d *Database) Close()
- func (d *Database) DeleteWebhook(twitchName, wID, cID string) (err error)
- func (d *Database) GetAllTwitchChannels() (channels []string, err error)
- func (d *Database) GetGameByID(id string) (gameData *GameData, err error)
- func (d *Database) GetTwitchNamesByChannel(cID string) (names []string, err error)
- func (d *Database) GetUserByID(id string) (userData *UserData, err error)
- func (d *Database) GetWebhooksByTwitchName(twitchName string) (hooks []*Webhook, err error)
- type GameData
- type GamesResponse
- type StreamsResponse
- type Twitch
- type UserData
- type UsersResponse
- type Webhook
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChannelData ¶
type ChannelData struct { ID string `json:"id"` UserID string `json:"user_id"` GameID string `json:"game_id"` Type string `json:"type"` Title string `json:"title"` ViewerCount int `json:"viewer_count"` StartedAt time.Time `json:"started_at"` Language string `json:"language"` ThumbnailURL string `json:"thumbnail_url"` }
ChannelData ...
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
Database is the struct for holding the main database and the two buckets
var (
DB *Database
)
func (*Database) AddChannel ¶
AddChannel adds a twitch channel to motitor and adds the channelID + webhook to be notified
func (*Database) DeleteWebhook ¶
DeleteWebhook deletes a webhook from a twitch channel
func (*Database) GetAllTwitchChannels ¶
GetAllTwitchChannels returns all the twitch channels being tracked
func (*Database) GetGameByID ¶
GetGameByID returns a twitch game by it's ID it tries to see if the game is cached and if not calls the twitch api and caches response
func (*Database) GetTwitchNamesByChannel ¶
GetTwitchNamesByChannel return all the tracked twitch names from a discord channel
func (*Database) GetUserByID ¶
GetUserByID returns a twitch user by their id it tries to see if the user is cached and if not calls the twitch api and caches response
type GameData ¶
type GameData struct { ID string `json:"id"` Name string `json:"name"` BoxArtURL string `json:"box_art_url"` }
GameData holds info about a specific game
type GamesResponse ¶
type GamesResponse struct {
Data []*GameData `json:"data"`
}
GamesResponse is the data structure for the twitch games endpoint
type StreamsResponse ¶
type StreamsResponse struct {
Data []*ChannelData `json:"data"`
}
StreamsResponse ..
type Twitch ¶
type Twitch struct { ClientID string // contains filtered or unexported fields }
Twitch is the struct that holds the basic info for the package
var API *Twitch
func (*Twitch) GetGameByID ¶
GetGameByID ...
func (*Twitch) GetUserByID ¶
GetUserByID polls the twitch api for a user by their id
func (*Twitch) RequestChannels ¶
func (t *Twitch) RequestChannels(channels []string) (*StreamsResponse, error)
RequestChannels requests a list of channels
type UserData ¶
type UserData struct { ID string `json:"id"` Login string `json:"login"` DisplayName string `json:"display_name"` Type string `json:"type"` BroadcasterType string `json:"broadcaster_type"` Description string `json:"description"` ProfileImageURL string `json:"profile_image_url"` OfflineImageURL string `json:"offline_image_url"` ViewCount int `json:"view_count"` }
UserData holds info about a specific twitch streamer
type UsersResponse ¶
type UsersResponse struct {
Data []*UserData `json:"data"`
}
UsersResponse is the data structure for the twitch users endpoint