Documentation ¶
Index ¶
- Variables
- type Bot
- type BotOwner
- type BotStatRequest
- type Bots
- type HTTPClient
- func (c *HTTPClient) GetBot(id string) (*Bot, error)
- func (c *HTTPClient) GetBotsByVote(page int) (*Bots, error)
- func (c *HTTPClient) GetNewBots() (*Bots, error)
- func (c *HTTPClient) GetUser(id string) (*User, error)
- func (c *HTTPClient) GetVote(token, botID, userID string) (*Vote, error)
- func (c *HTTPClient) PostServers(token, botID string, servers, shards int) error
- func (c *HTTPClient) SearchBots(query string, page int) (*Bots, error)
- type Koreanbots
- type RawResponse
- type Response
- type User
- type Vote
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrBadRequest returned when sent wrong body ErrBadRequest = errors.New("400 Bad Request") // ErrForbidden returned when get wrong Authorization header ErrForbidden = errors.New("403 Forbidden") // ErrRateLimited returned when rate limited. ErrRateLimited = errors.New("429 Too Many Request") // ErrUnknownStatusCode returned when status code is not 200 or not defined as error ErrUnknownStatusCode = errors.New("api returned unknown status code") )
Functions ¶
This section is empty.
Types ¶
type Bot ¶
type Bot struct { Response ID string `json:"id"` Flags int `json:"flags"` Owners []BotOwner `json:"owners"` Library string `json:"lib"` Prefix string `json:"prefix"` Votes int `json:"votes"` Servers int `json:"servers"` Intro string `json:"intro"` Description string `json:"desc"` Web string `json:"web"` Git string `json:"git"` Url string `json:"url"` Category []string `json:"category"` Status string `json:"status"` Discord string `json:"discord"` State string `json:"state"` Vanity string `json:"vanity"` Background string `json:"bg"` Banner string `json:"banner"` Tag string `json:"tag"` Avatar string `json:"avatar"` Name string `json:"name"` // contains filtered or unexported fields }
Bot is what registered in Koreanbots
func (Bot) GetRaw ¶
func (v Bot) GetRaw() *RawResponse
type BotOwner ¶
type BotOwner struct { Response Id string `json:"id"` Flags int `json:"flags"` Github string `json:"github"` Tag string `json:"tag"` Username string `json:"username"` Bots []string `json:"bots"` // contains filtered or unexported fields }
BotOwner is owner of bot
func (BotOwner) GetRaw ¶
func (v BotOwner) GetRaw() *RawResponse
type BotStatRequest ¶
BotStatRequest is body model of bot's stats endpoint
type Bots ¶
type Bots struct { Type string `json:"type"` Data []Bot `json:"data"` CurrentPage int `json:"currentPage"` TotalPage int `json:"totalPage"` // contains filtered or unexported fields }
Bots are what registered in Koreanbots
func (Bots) GetRaw ¶
func (v Bots) GetRaw() *RawResponse
type HTTPClient ¶
type HTTPClient struct {
// contains filtered or unexported fields
}
func (*HTTPClient) GetBotsByVote ¶
func (c *HTTPClient) GetBotsByVote(page int) (*Bots, error)
GetBotsByVote gets bots by vote in koreanbots
func (*HTTPClient) GetNewBots ¶
func (c *HTTPClient) GetNewBots() (*Bots, error)
GetNewBots gets new bots from koreanbots
func (*HTTPClient) GetUser ¶ added in v1.2.2
func (c *HTTPClient) GetUser(id string) (*User, error)
GetUser get koreanbots user
func (*HTTPClient) GetVote ¶
func (c *HTTPClient) GetVote(token, botID, userID string) (*Vote, error)
GetVote gets vote of user from koreanbots
func (*HTTPClient) PostServers ¶
func (c *HTTPClient) PostServers(token, botID string, servers, shards int) error
PostServers post servers to koreanbots
func (*HTTPClient) SearchBots ¶
func (c *HTTPClient) SearchBots(query string, page int) (*Bots, error)
SearchBots searches bots from koreanbots
type Koreanbots ¶
type Koreanbots struct {
// contains filtered or unexported fields
}
func NewKoreanbots ¶
func NewKoreanbots(session *discordgo.Session, token string, postServers bool) *Koreanbots
NewKoreanbots creates new Koreanbots client
func (Koreanbots) GetVote ¶
func (k Koreanbots) GetVote(userID string) (*Vote, error)
GetVote gets vote of user from koreanbots
func (Koreanbots) PostServers ¶
func (k Koreanbots) PostServers() error
PostServers post servers to koreanbots
type RawResponse ¶
type RawResponse struct { Code int `json:"code"` Data json.RawMessage `json:"data"` Version int `json:"version"` }
RawResponse is raw value of response. You can get this by (Response).GetRaw()
type Response ¶
type Response interface { // GetRaw return raw response GetRaw() *RawResponse }
Response is interface of typed response models
type User ¶ added in v1.2.2
type User struct { Response ID string `json:"id"` Flags int `json:"flags"` Github string `json:"github"` Tag string `json:"tag"` Username string `json:"username"` Bots []Bot `json:"bots"` // contains filtered or unexported fields }
func (User) GetRaw ¶ added in v1.2.2
func (u User) GetRaw() *RawResponse
Click to show internal directories.
Click to hide internal directories.