services

package
v0.0.0-...-11583a9 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const MaxMessageCacheSize = 5_000

Variables

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

Functions

func ConnectDB

func ConnectDB()

func ConnectDiscord

func ConnectDiscord(events []interface{})

func ConnectKafka

func ConnectKafka()

func ConnectRedis

func ConnectRedis()

func DisconnectDB

func DisconnectDB()

func DisconnectDiscord

func DisconnectDiscord()

func DisconnectKafka

func DisconnectKafka()

func DisconnectRedis

func DisconnectRedis()

func ReadyMessageCache

func ReadyMessageCache()

func RegisterCommands

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

Types

type CachedMessage

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

message cache stuff

type KafkaService

type KafkaService struct {
	// contains filtered or unexported fields
}
var Kafka *KafkaService

func (*KafkaService) Produce

func (k *KafkaService) Produce(ctx context.Context, key, value []byte) error

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() *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