wikipedia

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2022 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Command = &discordac.AppliedCommand{
	Specification: &discordgo.ApplicationCommand{
		Name:        "wikipedia",
		Description: "Search wikipedia",
		Type:        discordgo.ChatApplicationCommand,
		Options: []*discordgo.ApplicationCommandOption{
			{
				Type:        discordgo.ApplicationCommandOptionString,
				Name:        "query",
				Description: "What to search",
				Required:    true,
			},
		},
	},
	Handler: func(cc *discordac.CommandContext) {
		if query, ok := cc.GetOption("query"); ok {
			cc.Respond("Searching...")
			go findWikipedia(query.StringValue(), cc)
		}
	},
}

Functions

This section is empty.

Types

type Response

type Response struct {
	XMLName       xml.Name `xml:"api"`
	Text          string   `xml:",chardata"`
	Batchcomplete string   `xml:"batchcomplete,attr"`
	Query         struct {
		Text      string `xml:",chardata"`
		Redirects struct {
			Text string `xml:",chardata"`
			R    struct {
				Text string `xml:",chardata"`
				From string `xml:"from,attr"`
				To   string `xml:"to,attr"`
			} `xml:"r"`
		} `xml:"redirects"`
		Pages struct {
			Text string `xml:",chardata"`
			Page struct {
				Text    string `xml:",chardata"`
				Idx     string `xml:"_idx,attr"`
				Pageid  string `xml:"pageid,attr"`
				Ns      string `xml:"ns,attr"`
				Title   string `xml:"title,attr"`
				Extract struct {
					Text  string `xml:",chardata"`
					Space string `xml:"space,attr"`
				} `xml:"extract"`
			} `xml:"page"`
		} `xml:"pages"`
	} `xml:"query"`
}

Jump to

Keyboard shortcuts

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