services

package
v0.0.0-...-61e7c92 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Commands = make(map[string]*Command)
View Source
var CronScheduler *cron.Cron
View Source
var DB *sql.DB
View Source
var Redis *r.Client
View Source
var RegisteredCommands = make([]*discordgo.ApplicationCommand, len(Commands))

Functions

func CaptureError

func CaptureError(err error)

func CaptureEvent

func CaptureEvent(event *sentry.Event)

func CaptureMessage

func CaptureMessage(message string)

func ConnectDB

func ConnectDB()

func ConnectDiscord

func ConnectDiscord(events []any)

func ConnectRedis

func ConnectRedis()

func DisconnectDB

func DisconnectDB()

func DisconnectDiscord

func DisconnectDiscord()

func DisconnectRedis

func DisconnectRedis()

func InitSentry

func InitSentry()

func ReadyEventQueue

func ReadyEventQueue(size int)

func ReadyMessageCache

func ReadyMessageCache(size int)

func RegisterCommands

func RegisterCommands(s *discordgo.Session, g string)

func RegisterStatsCollector

func RegisterStatsCollector(collector func(*discordgo.Session))

RegisterStatsCollector sets the function to be called for stats collection

func StartCron

func StartCron(session *discordgo.Session)

StartCron initializes and starts the cron scheduler

func StopCron

func StopCron()

StopCron gracefully stops the cron scheduler

Types

type CachedMessage

type CachedMessage struct {
	ID          string
	Content     string
	ChannelID   string
	GuildID     string
	Author      *discordgo.User
	Attachments []*discordgo.MessageAttachment
}

message cache stuff

type Event

type Event struct {
	Type    string
	Data    interface{}
	GuildID string
}

Event represents a Discord event that needs to be processed

type EventHandler

type EventHandler func(Event) error

EventHandler is a function that processes an event

type EventQueue

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

EventQueue manages the queueing and processing of Discord events

var EQ *EventQueue

func NewEventQueue

func NewEventQueue(bufferSize int) *EventQueue

NewEventQueue creates a new event queue with the specified buffer size

func (*EventQueue) Enqueue

func (eq *EventQueue) Enqueue(event Event)

Enqueue adds a new event to the queue

func (*EventQueue) GetQueueSize

func (eq *EventQueue) GetQueueSize() int

func (*EventQueue) RegisterHandler

func (eq *EventQueue) RegisterHandler(eventType string, handler EventHandler)

RegisterHandler registers a handler function for a specific event type

func (*EventQueue) Start

func (eq *EventQueue) Start(numWorkers int)

Start begins processing events from the queue

func (*EventQueue) Stop

func (eq *EventQueue) Stop()

Stop gracefully shuts down the event queue

type MessageCache

type MessageCache struct {
	Messages map[string]*list.Element
	Order    *list.List
	MaxSize  int
	Mutex    sync.Mutex
}
var MsgCache *MessageCache

func NewMessageCache

func NewMessageCache(size int) *MessageCache

func (*MessageCache) AddMessage

func (mc *MessageCache) AddMessage(msg *discordgo.Message)

func (*MessageCache) GetMessage

func (mc *MessageCache) GetMessage(id string) (*CachedMessage, bool)

Jump to

Keyboard shortcuts

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