core

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const RemoteLocation string = "online"

RemoteLocation is the string used to identify a online event

Variables

This section is empty.

Functions

func Bool

func Bool(v bool) *bool

Bool returns a pointer to a bool

func ColorToImage added in v0.4.4

func ColorToImage(c color.Color) image.Image

ColorToImage creates a 16x16 image filled with the specified color.

func ColorToInt added in v0.3.0

func ColorToInt(c color.Color) int

ColorToInt converts a Go Color to a hex int

func GenerateEventChannelName added in v0.3.0

func GenerateEventChannelName(eventName string, location string, dateTime time.Time) string

GenerateEventChannelName deciphers a channel name from a given set of event data

func GetCityFromLocation added in v0.3.0

func GetCityFromLocation(location string) string

GetCityFromLocation returns the city name of an event's location

func GetMonthPrefix added in v0.3.0

func GetMonthPrefix(dateTime time.Time) string

GetMonthPrefix returns a month in short form

func HexToColor added in v0.3.0

func HexToColor(s string) (color.Color, error)

HexToColor coverts hex string to color

func ImageToBase64 added in v0.4.4

func ImageToBase64(img image.Image) string

func Int added in v0.3.0

func Int(v int) *int

Int returns a pointer to an int

func IntToColor added in v0.3.0

func IntToColor(hex int) color.Color

IntToColor converts a hex int to a Go Color

Types

type Channel

type Channel struct {
	Name     string
	ID       string
	Verified bool
}

func GenerateChannelFromEvent added in v0.3.0

func GenerateChannelFromEvent(event common.Event) *Channel

GenerateChannelFromEvent returns a channel object associated with an event

type Config

type Config struct {
	Discord      DiscordConfig  `yaml:"discord"`
	Mastodon     MastodonConfig `yaml:"mastodon"`
	Feedback     Feedback       `yaml:"feedback"`
	StatusPortal StatusPortal   `yaml:"status_portal"`
	Features     Features       `yaml:"features"`
}

Config is used to modify the behavior of birdbot externally

type DiscordConfig

type DiscordConfig struct {
	Token         string `yaml:"token" env:"DISCORD_TOKEN"`
	ApplicationID string `yaml:"application_id" env:"DISCORD_APPLICATION_ID"`
	GuildID       string `yaml:"guild_id" env:"DISCORD_GUILD_ID"`

	EventCategory       string `yaml:"event_category" env:"DISCORD_EVENT_CATEGORY"`
	ArchiveCategory     string `yaml:"archive_category" env:"DISCORD_ARCHIVE_CATEGORY"`
	NotificationChannel string `yaml:"notification_channel" env:"DISCORD_NOTIFICATION_CHANNEL"`

	RoleSelections []RoleSelectionConfig `yaml:"role_selection"`

	ChatLinks map[string][]string `yaml:"chat_links"`
}

DiscordConfig contains discord specific configuration

type Feature added in v0.3.0

type Feature string

Feature is a boolean string used to toggle functionality

func (Feature) IsEnabled added in v0.3.0

func (value Feature) IsEnabled() bool

IsEnabled returns true when a feature is set to be true

func (Feature) IsEnabledByDefault added in v0.3.0

func (value Feature) IsEnabledByDefault() bool

IsEnabled returns true when a feature is set to be true or if the feature flag is not set at all

type Features added in v0.3.0

type Features struct {
	ManageEventChannels Feature `yaml:"manage_event_channels" env:"BIRD_EVENT_CHANNELS"`
	AnnounceEvents      Feature `yaml:"announce_events" env:"BIRD_ANNOUNCE_EVENTS"`
	RecurringEvents     Feature `yaml:"recurring_events" env:"BIRD_RECURRING_EVENTS"`
	RoleSelection       Feature `yaml:"role_selection" env:"BIRD_ROLE_SELECTION"`
	Feedback            Feature `yaml:"feedback" env:"BIRD_FEEDBACK"`
	LoadGamePlugins     Feature `yaml:"load_game_plugins" env:"BIRD_LOAD_GAME_PLUGINS"`
	StatusPortal        Feature `yaml:"status_portal" env:"BIRD_STATUS_PORTAL"`
}

Features contains all features flags that can be used to modify functionality

type Feedback added in v0.4.2

type Feedback struct {
	WebhookURL  string `yaml:"url" env:"BIRD_FEEDBACK_URL"`
	PayloadType string `yaml:"type" env:"BIRD_FEEDBACK_TYPE"`

	SuccessMessage string `yaml:"success_message"`
	FailureMessage string `yaml:"failure_message"`
}

type MastodonConfig added in v0.1.4

type MastodonConfig struct {
	Server       string `yaml:"server" env:"MASTODON_SERVER"`
	Username     string `yaml:"user" env:"MASTODON_USER"`
	Password     string `yaml:"password" env:"MASTODON_PASSWORD"`
	ClientID     string `yaml:"client_id" env:"MASTODON_CLIENT_ID"`
	ClientSecret string `yaml:"client_secret" env:"MASTODON_CLIENT_SECRET"`
}

MastodonConfig contains mastodon specific configuration

type RoleConfig added in v0.3.0

type RoleConfig struct {
	RoleName string `yaml:"name"`
	Color    string `yaml:"color"`
}

type RoleSelectionConfig added in v0.3.0

type RoleSelectionConfig struct {
	Title              string  `yaml:"title"`
	Description        string  `yaml:"description"`
	GenerateColorEmoji Feature `yaml:"generate_color_emoji"`

	SelectionChannel string       `yaml:"discord_channel"`
	Roles            []RoleConfig `yaml:"roles"`
}

type StatusPortal added in v0.4.3

type StatusPortal struct {
	URL string `yaml:"url" env:"BIRD_STATUS_PORTAL_URL"`
}

Jump to

Keyboard shortcuts

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