Documentation ¶
Index ¶
- Constants
- func GenerateRandomArticleMessage() (string, error)
- func GenerateSearchResultMessage(query string) (string, error)
- func GetRandomPage() (int, string, string, error)
- func OnSlashCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
- type Page
- type PageResult
- type PrefixSearch
- type SearchContinue
- type SearchResponse
- type SearchResult
- type WikipediaPage
- type WikipediaRandomResult
Constants ¶
View Source
const ENDPOINT = "https://ja.wikipedia.org/w/api.php"
View Source
const PSLIMIT = "3"
Variables ¶
This section is empty.
Functions ¶
func GetRandomPage ¶
get a random page of Wikipedia
func OnSlashCommand ¶
func OnSlashCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
Types ¶
type PageResult ¶
A struct for page fetching results
func GetPageContent ¶
func GetPageContent(pageId int) (PageResult, error)
type PrefixSearch ¶
type SearchContinue ¶
type SearchResponse ¶
type SearchResponse struct { BatchComplete string `json:"batchcomplete"` Continue SearchContinue `json:"continue"` Query SearchResult `json:"query"` }
search results
func SearchArticle ¶
func SearchArticle(query string) (SearchResponse, error)
type SearchResult ¶
type SearchResult struct {
PrefixSearch []PrefixSearch `json:"prefixsearch"`
}
type WikipediaPage ¶
A struct for Wikipedia page infomation
type WikipediaRandomResult ¶
type WikipediaRandomResult struct { Query struct { Random []WikipediaPage `json:"random"` } `json:"query"` }
A struct for parsing results of Wikipedia API
Click to show internal directories.
Click to hide internal directories.