Documentation
¶
Index ¶
- Variables
- func CaptureError(err error)
- func CaptureEvent(event *sentry.Event)
- func CaptureMessage(message string)
- func ConnectDB()
- func ConnectDiscord(events []any)
- func ConnectRedis()
- func DisconnectDB()
- func DisconnectDiscord()
- func DisconnectRedis()
- func InitSentry()
- func ReadyEventQueue(size int)
- func ReadyMessageCache(size int)
- func RegisterCommands(s *discordgo.Session, g string)
- func RegisterStatsCollector(collector func(*discordgo.Session))
- func StartCron(session *discordgo.Session)
- func StopCron()
- type CachedMessage
- type Command
- type Event
- type EventHandler
- type EventQueue
- type MessageCache
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 Discord *discordgo.Session
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 CaptureMessage ¶
func CaptureMessage(message string)
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 RegisterStatsCollector ¶
RegisterStatsCollector sets the function to be called for stats collection
Types ¶
type CachedMessage ¶
type CachedMessage struct {
ID string
Content string
ChannelID string
GuildID string
Author *discordgo.User
Attachments []*discordgo.MessageAttachment
}
message cache stuff
type Command ¶
type Command struct {
*discordgo.ApplicationCommand
Handler func(*discordgo.Session, *discordgo.InteractionCreate) *discordgo.InteractionResponse
}
type EventHandler ¶
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
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)
Click to show internal directories.
Click to hide internal directories.