common

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2023 License: MIT Imports: 3 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChatCommandConfiguration

type ChatCommandConfiguration struct {
	Description       string
	EphemeralResponse bool
	Options           map[string]ChatCommandOption
}

type ChatCommandOption

type ChatCommandOption struct {
	Description string
	Type        CommandOptionType
	Required    bool
}

type Event

type Event struct {
	Name             string
	ID               string
	Location         string
	Completed        bool
	DateTime         time.Time
	CompleteDateTime time.Time
	Description      string
	ImageURL         string

	Organizer User
}

Event represents a calendar event

type ExternalChatManager

type ExternalChatManager interface {
	SendMessage(user string, message string)
}

type ExternalChatModule

type ExternalChatModule interface {
	Initialize(ExternalChatManager)

	RecieveMessage(user User, message string)
}

type Module

type Module interface {
	Initialize(birdbot ModuleManager) error
}

type ModuleManager

type ModuleManager interface {
	OnReady(func() error) error

	OnNotify(func(string) error) error

	// Event events
	OnEventCreate(func(Event) error) error
	OnEventDelete(func(Event) error) error
	OnEventUpdate(func(Event) error) error
	OnEventComplete(func(Event) error) error

	// Actions
	CreateEvent(event Event) error
	Notify(message string) error

	// Commands
	RegisterCommand(string, ChatCommandConfiguration, func(User, map[string]any) string)

	// Submodules
	RegisterExternalChat(channelID string, chat ExternalChatModule) error

	GetConfigPath(fileName string) string
}

ModuleManager is the primary way for a module to interact with BirdBot by listening to events and committing actions

type User

type User struct {
	ID          string
	AvatarURL   string
	DisplayName string
}

User represents a user within BirdBot

func (*User) DiscordMention

func (user *User) DiscordMention() string

DiscordMention generated a Discord mention string for the user

Jump to

Keyboard shortcuts

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