action

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2021 License: MIT Imports: 11 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

This section is empty.

Functions

func Jitter added in v0.0.4

func Jitter(d, jitter time.Duration) time.Duration

Jitter adds some jitter to a duration

Types

type Activities added in v0.0.4

type Activities []*Activity

Activities we want to publicise.

func (Activities) Current added in v0.0.4

func (a Activities) Current() Activities

Current set of running Activities.

func (Activities) Len added in v0.0.4

func (a Activities) Len() int

func (Activities) Less added in v0.0.4

func (a Activities) Less(i, j int) bool

func (Activities) Swap added in v0.0.4

func (a Activities) Swap(i, j int)

type Activity added in v0.0.4

type Activity struct {
	Start     time.Time `json:"start"`
	End       time.Time `json:"end"`
	Announced time.Time `json:"-"`

	Announcement embed.Definition
}

Activity that we want to publicise.

func (*Activity) Before added in v0.0.4

func (a *Activity) Before(b *Activity) bool

Before returns true if this activity happens before the given one.

func (*Activity) Ongoing added in v0.0.4

func (a *Activity) Ongoing() bool

Ongoing returns true if the Activity is currently running.

type Amenity added in v0.0.4

type Amenity struct {
	Channel   string
	Authors   *embed.Authors
	Messenger message.Messenger

	Frequency time.Duration
	Jitter    time.Duration

	store.Data
	Activities
}

Amenity activities.

func NewAmenities added in v0.0.4

func NewAmenities(object store.Object, authors *embed.Authors, messenger message.Messenger) *Amenity

NewAmenities returns a new Amenity action.

func (*Amenity) Publish added in v0.0.4

func (a *Amenity) Publish()

Publish Amenities announcements as required.

type Joke

type Joke struct {
	Store store.Object
	Jokes
}

Joke action.

func NewJoke

func NewJoke(store store.Object) *Joke

NewJoke returns a new Joke Action.

func (*Joke) Random

func (j *Joke) Random(s *discordgo.Session) *discordgo.MessageEmbed

Random joke as a MessageEmbed.

func (*Joke) Refresh

func (j *Joke) Refresh() error

Refresh the joke set from the joke store.

type Jokes

type Jokes []struct {
	Author string
	Joke   string
}

Jokes defines the stored data.

type Menu struct {
	Store store.Object
	Items []string
}

Menu action.

func NewMenu

func NewMenu(store store.Object) *Menu

NewMenu returns a new Menu action.

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

Random menu item.

func (m *Menu) Refresh() error

Refresh the menu set from the menu store.

Jump to

Keyboard shortcuts

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