bot

package
v0.0.0-...-c2d312f Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2022 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bot

type Bot struct {
	// contains filtered or unexported fields
}

Bot structure.

func New

func New(token string) (*Bot, error)

Creating a new discord bot.

func (*Bot) Close

func (b *Bot) Close() error

Closing a bot connections.

func (*Bot) Handle

func (b *Bot) Handle(s *discordgo.Session, i *discordgo.InteractionCreate)

Handle discord application command.

func (*Bot) RegisterCommand

func (b *Bot) RegisterCommand(c *Command) error

Registering a new discord application command.

func (*Bot) RegisterComponent

func (b *Bot) RegisterComponent(c *Component)

Registering a new discord message component.

func (*Bot) RegisterHandler

func (b *Bot) RegisterHandler(handler any) func()

Registering a discord bot handler.

func (*Bot) Run

func (b *Bot) Run() error

Running the discord bot.

func (*Bot) UnregisterCommands

func (b *Bot) UnregisterCommands() error

Unregister all discord application commands.

type Command

type Command struct {
	// Discord application command.
	discordgo.ApplicationCommand
	// Discord bot application command handler.
	Handler func(s *discordgo.Session, i *discordgo.InteractionCreate)
}

Discord application command structure.

type Component

type Component struct {
	// Custom component id.
	ComponentID string
	// Discord message component handler.
	Handler func(s *discordgo.Session, i *discordgo.InteractionCreate)
}

Discord message component structure.

Jump to

Keyboard shortcuts

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