providers

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BloopyBoiUserAgent = "Mozilla/5.0 (compatible; BloopyBoi/1.0; +https://gitlab.com/h3mmy/bloopyboi)"
)
View Source
const (
	ServiceLoggerFieldKey = "service_name"
)

Variables

View Source
var (
	AppCommands = []*discordgo.ApplicationCommand{
		{
			Name:        "inspire",
			Description: "Summons Inspiration",
		},
		{
			Name:        "blissfest",
			Description: "Gets blissfest related information",
			Options: []*discordgo.ApplicationCommandOption{
				{
					Type:        discordgo.ApplicationCommandOptionBoolean,
					Name:        "lineup",
					Description: "Try to fetch lineup image",
					Required:    true,
				},
			},
		},
	}
	AppCommandHandlers = map[string]func(s *discordgo.Session, i *discordgo.InteractionCreate){
		"inspire": func(s *discordgo.Session, i *discordgo.InteractionCreate) {
			bttp := GetInspiroClient()
			s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
				Type: discordgo.InteractionResponseChannelMessageWithSource,
				Data: &discordgo.InteractionResponseData{
					Embeds: []*discordgo.MessageEmbed{
						{
							Author: &discordgo.MessageEmbedAuthor{},
							Image: &discordgo.MessageEmbedImage{
								URL: bttp.GetInspiroImageURL(),
							},
						},
					},
				},
			})
		},
		"blissfest": func(s *discordgo.Session, i *discordgo.InteractionCreate) {
			getLineUp := false

			options := i.ApplicationCommandData().Options
			for _, opt := range options {
				if opt.Name == "lineup" {
					getLineUp = opt.BoolValue()
				}
			}

			bsvc := GetBlissfestService()
			var resData discordgo.InteractionResponseData

			if getLineUp {
				resData = discordgo.InteractionResponseData{
					Embeds: []*discordgo.MessageEmbed{
						{
							Author: &discordgo.MessageEmbedAuthor{},
							Image: &discordgo.MessageEmbedImage{
								URL: bsvc.GetLineupImageURI(),
							},
						},
					},
					Title: "Blissfest",

					Content: fmt.Sprintf("%s left", humanize.Time(*bsvc.GetStartTime())),
				}

			} else {
				resData = discordgo.InteractionResponseData{
					Title:   "Blissfest",
					Content: fmt.Sprintf("%s left", humanize.Time(*bsvc.GetStartTime())),
				}
			}

			s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
				Type: discordgo.InteractionResponseChannelMessageWithSource,
				Data: &resData,
			})
		},
	}
)

Functions

func GetBlissfestService added in v0.4.0

func GetBlissfestService() *services.BlissfestService

func GetBloopyServiceRegistry added in v0.3.7

func GetBloopyServiceRegistry() models.ServiceRegistry

func GetBotName added in v0.3.1

func GetBotName() string

func GetBotToken

func GetBotToken() string

Retrieves Bot Token

func GetFeatures added in v0.4.0

func GetFeatures() map[string]config.FeatureConfig

Returns

func GetInspiroClient added in v0.4.0

func GetInspiroClient() *services.InspiroClient

func GetLogLevel added in v0.3.0

func GetLogLevel() string

Retrieves logLevel if set

func GetUser added in v0.3.2

func GetUser(bloopyId string) models.User

func IsFeaturedConfigured added in v0.3.7

func IsFeaturedConfigured(key string) bool

Checks FeatureConfigs for key

func NewReadinessChecker added in v0.3.0

func NewReadinessChecker() health.Checker

func NewZapLogger added in v0.3.7

func NewZapLogger() *zap.Logger

Types

type BloopyEnt added in v0.3.11

type BloopyEnt struct {
	// contains filtered or unexported fields
}

func NewBloopyEnt added in v0.3.11

func NewBloopyEnt() *BloopyEnt

func (*BloopyEnt) AddDiscordMessage added in v0.3.11

func (be *BloopyEnt) AddDiscordMessage(ctx context.Context, dmsg *discordgo.Message) error

func (*BloopyEnt) Quit added in v0.3.11

func (be *BloopyEnt) Quit(ctx context.Context) error

func (*BloopyEnt) Start added in v0.3.11

func (be *BloopyEnt) Start(ctx context.Context) error

Jump to

Keyboard shortcuts

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