bot

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrAccessForbidden

func ErrAccessForbidden() *api.InteractionResponseData

func ErrIsAccessDenied

func ErrIsAccessDenied(err error) bool

func ErrIsNotFound

func ErrIsNotFound(err error) bool

Types

type AddFlagMappingParams

type AddFlagMappingParams struct {
	Abbr  string `discord:"abbr"`
	Emoji string `discord:"emoji"`
}

type AddGuildOpts

type AddGuildOpts struct {
	Description string `discord:"description"` // required
}

type AddTrackingParams

type AddTrackingParams struct {
	Address string `discord:"address"`
}

type Backoff

type Backoff struct {
	Backoff time.Duration
	Until   time.Time
}

type Bot

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

func New

func New(
	ctx context.Context,
	token string,
	db *db.DB,
	superAdmins []discord.UserID,
	guildID discord.GuildID,
	channelID discord.ChannelID,
	pollingInterval time.Duration,
	legacyMessageFormat bool,
) (*Bot, error)

New requires a discord bot token and returns a Bot instance. A bot token starts with Nj... and can be obtained from the discord developer portal.

func (*Bot) Close

func (b *Bot) Close() error

func (*Bot) ConnQueries added in v0.2.0

func (b *Bot) ConnQueries(ctx context.Context) (q *sqlc.Queries, closer func(), err error)

func (*Bot) Connect

func (b *Bot) Connect(ctx context.Context) error

func (*Bot) IsSuperAdmin

func (b *Bot) IsSuperAdmin(data cmdroute.CommandData) bool

func (*Bot) TxQueries added in v0.2.0

func (b *Bot) TxQueries(ctx context.Context) (q *sqlc.Queries, closer func(error) error, err error)

type RemoveFlagMappingParams

type RemoveFlagMappingParams struct {
	Abbr string `discord:"abbr"`
}

Jump to

Keyboard shortcuts

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