pubsub

package
v2.33.1 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2024 License: MIT Imports: 14 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// if set, return true to handle the event, false to ignore it
	FilterFunc func(guildID int64) (handle bool)
)

Functions

func AddHandler

func AddHandler(evt string, cb func(*Event), t interface{})

AddEventHandler adds a event handler For the specified event, should only be done during startup

func EvictCacheSet

func EvictCacheSet(slot *cacheset.Slot, key interface{})

EvictCacheSet sends a pubsub to evict the key on slot on all nodes if guildID is set to -1, otherwise the bot worker for that guild is the only one that handles it

func PollEvents

func PollEvents()

func Publish

func Publish(evt string, target int64, data interface{}) error

PublishEvent publishes the specified event set target to -1 to handle on all nodes

func PublishLogErr

func PublishLogErr(evt string, target int64, data interface{})

func PublishRatelimit

func PublishRatelimit(rl *discordgo.RateLimit)

PublishRatelimit publishes a new global ratelimit hit on discord

Types

type Event

type Event struct {
	TargetGuild    string // The guild this event was meant for, or * for all
	TargetGuildInt int64
	EventName      string
	Data           interface{}
}

Jump to

Keyboard shortcuts

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