Categorygithub.com/diamondburned/dgwidgets
modulepackage
0.0.0-20210410192230-6cb212866389
Repository: https://github.com/diamondburned/dgwidgets.git
Documentation: pkg.go.dev

# README

dg-widgets

Make widgets with embeds and reactions. Forked to be compatible with Arikawa.

img

Example usage

// PaginateDemo is a demonstration of the (forked) pagination library.
func (bot *Bot) PaginateDemo(m *gateway.MessageCreateEvent) error {
	p := dgwidgets.NewPaginator(bot.Ctx.Session, m.ChannelID)

	// Add embed pages to paginator
	p.Add(
		discord.Embed{Description: "Page one"},
		discord.Embed{Description: "Page two"},
		discord.Embed{Description: "Page three"},
	)

	// Sets the footers of all added pages to their page numbers.
	p.SetPageFooters()

	// When the paginator is done listening set the colour to yellow.
	p.ColourWhenDone = 0xFFFF00

	// Stop listening for reaction events after 5 minutes.
	p.Widget.Timeout = 5 * time.Minute

	// Add a custom handler for the gun reaction.
	p.Widget.Handle("🔫", func(r *gateway.MessageReactionAddEvent) {
		bot.Ctx.SendMessage(r.ChannelID, "Bang!", nil)
	})

	return p.Spawn()
}

# Functions

EmbedsFromString splits a string into a slice of Embeds.
NewPaginator returns a new Paginator.
NewWidget returns a new widget that listens forever.
QueryInput queries the user with userID for input.

# Constants

No description provided by the author
No description provided by the author
backwards iota.
No description provided by the author

# Variables

BackgroundTimeout is the default timeout for several background jobs, such as clean ups.
error vars.
error vars.
Emoji variables.
Emoji variables.
Emoji variables.
Emoji variables.
Emoji variables.
Emoji variables.
Emoji variables.
Emoji variables.
Emoji variables.
Emoji variables.
Emoji variables.
Emoji variables.
Emoji variables.
PromptTimeout is the variable for the duration to wait before the page number prompt times out.

# Structs

EmojiHandler is an emoji handler.
Paginator provides a method for creating a navigatable embed.
Widget is a message embed with reactions for buttons.

# Type aliases

PageChange is the overloaded enum type to both contain page events and the actual page number.
WidgetHandler -- Self explanatory.