action

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package action holds common bot actions that can be called via multiple sources.

Index

Constants

This section is empty.

Variables

View Source
var ErrTableEmpty = errors.New("table is empty")

ErrTableEmpty is returned if a Random call is made on an empty table.

Functions

This section is empty.

Types

type Announcement added in v0.1.0

type Announcement struct {
	ID      int       `json:"id"`
	Author  string    `json:"author"`
	Message string    `json:"message"`
	Start   time.Time `json:"start"`
	End     time.Time `json:"end"`
	Last    time.Time `json:"last"`
}

Announcement to make.

func (*Announcement) Empty added in v0.1.0

func (a *Announcement) Empty() bool

Empty returns true if an Announcement is empty.

func (*Announcement) Update added in v0.1.0

func (a *Announcement) Update(connection *db.Connection)

Update the last time the Announcement was made.

type Announcements added in v0.1.0

type Announcements []*Announcement

Announcements to make.

func (*Announcements) Count added in v0.1.0

func (a *Announcements) Count() int

Count of announcements.

func (*Announcements) Current added in v0.1.0

func (a *Announcements) Current() *Announcements

Current announcements, that is announcements that have a start time before now and an end time after now.

func (*Announcements) Load added in v0.1.0

func (a *Announcements) Load(connection *db.Connection)

Load the announcements.

func (*Announcements) Next added in v0.1.0

func (a *Announcements) Next() *Announcement

Next announcement to make. This is determined by least recently announced item. If neither item has been announced then the item with the earliest start time is next.

type Announcer added in v0.1.0

type Announcer struct {
	Refresh bool      `json:"refresh"`
	Bot     string    `json:"bot"`
	Channel string    `json:"channel"`
	Last    time.Time `json:"last"`
	Next    time.Time `json:"next"`

	Authors    *embed.Authors     `json:"-"`
	Session    *discordgo.Session `json:"-"`
	Connection *db.Connection     `json:"-"`
	// contains filtered or unexported fields
}

Announcer used to display Announcements.

func (*Announcer) Run added in v0.1.0

func (a *Announcer) Run()

Run the Announcer.

type Audit added in v0.1.5

type Audit struct {
	Base
}

Audit action.

func (*Audit) Definition added in v0.1.5

func (a *Audit) Definition() *command.Definition

Definition for the audit command.

func (*Audit) Handle added in v0.1.5

func (a *Audit) Handle(event command.Event) error

Handle the audit command.

type Base added in v0.1.0

type Base struct {
	Command     string
	Description string

	Connection *db.Connection
}

Base action.

func (*Base) Random added in v0.1.0

func (b *Base) Random(table string, result interface{}) (int, error)

Random item from a table with a numeric id column.

type Joke

type Joke struct {
	Base
}

Joke action.

func (*Joke) Definition added in v0.1.0

func (j *Joke) Definition() *command.Definition

Definition for the joke command.

func (*Joke) Get added in v0.1.0

Get a joke as a MessageEmbed.

func (*Joke) Handle added in v0.1.0

func (j *Joke) Handle(event command.Event) error

Handle the joke command.

func (*Joke) Handler added in v0.1.0

func (j *Joke) Handler(s *discordgo.Session, in *discordgo.Message)

Handler listens for the joke command.

type Menu struct {
	Base
}

Menu action.

func (m *Menu) Definition() *command.Definition

Definition for the room service command.

func (m *Menu) Get(user string) string

Get item from the menu for the given user.

func (m *Menu) Handle(event command.Event) error

Handle the room-service command.

func (m *Menu) Handler(s *discordgo.Session, in *discordgo.Message)

Handler listens for the menu command.

type Named added in v0.1.7

type Named interface {
	Names() []string
}

Named data which can have its named returned.

type Preview added in v0.1.3

type Preview struct {
	Base
	Authors *embed.Authors
}

Preview commands.

func (*Preview) Definition added in v0.1.3

func (p *Preview) Definition() *command.Definition

Definition for the room preview command.

func (*Preview) Get added in v0.1.3

func (p *Preview) Get(id int) Announcement

Get the given announcement.

func (*Preview) Handle added in v0.1.3

func (p *Preview) Handle(event command.Event) error

Handle the room-service command.

type Vend added in v0.1.4

type Vend struct {
	Base
}

Vend action.

func (*Vend) Definition added in v0.1.4

func (m *Vend) Definition() *command.Definition

Definition for the room service command.

func (*Vend) Get added in v0.1.4

func (m *Vend) Get(user string) string

Get item from the vending machine for the given user.

func (*Vend) Handle added in v0.1.4

func (m *Vend) Handle(event command.Event) error

Handle the room-service command.

func (*Vend) Handler added in v0.1.4

func (m *Vend) Handler(s *discordgo.Session, in *discordgo.Message)

Handler listens for the vend command.

Jump to

Keyboard shortcuts

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