bot

package
v0.0.0-...-0d805c2 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2020 License: BSD-2-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager interface {

	// NewUnit creates a new unit with given guild parameters and registers it with the manager.
	NewUnit(*bot.AttachedGuild)

	// SpawnUnits is the high-level method responsible for creating bot units for all attached guilds.
	SpawnUnits() error

	// BotCommandPrefix returns the bot commaand prefix of the unit mapped to given guild ID.
	BotCommandPrefix(string) (string, error)

	// UnitGuild returns the guild of the unit mapped to given guild ID.
	UnitGuild(string) (*discordgo.Guild, error)

	// SetUnitGuild sets the guild of the unit mapped to given guild ID.
	SetUnitGuild(string, *discordgo.Guild) error

	// SetUnitState transitions a bot unit instance from its current state to given state.
	// If the target state is Ready, it also broadcasts a wake-up signal to goroutines
	// waiting for this unit to be ready.
	SetUnitState(string, UnitState) error

	// WaitUntilUnitIsReady waits for a bot unit to be in ready state.
	WaitForReadyUnit(string) error
	// contains filtered or unexported methods
}

Manager is the type responsible for keeping track of bot units (i.e. abstractions of actual bots within Discord guilds).

It is meant to be created exactly one time, on an application-wide level. A Manager instance is obtained using the GetManager() function.

func GetManager

func GetManager() Manager

GetManager returns a Manager instance.

type UnitState

type UnitState int

UnitState is the state of a bot unit.

const (
	UnitStateUnknown UnitState = iota
	UnitStateNotReady
	UnitStateReady
)

Bot manager states

Jump to

Keyboard shortcuts

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