mqueue

package
v1.24.1 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2020 License: MIT Imports: 20 Imported by: 0

README

Simple message queue based on postgres, this is for more realiably sending messages with retry on failure, accepting long failture durations such as discord being down.

Documentation

Index

Constants

View Source
const DBSchema = `` /* 266-byte string literal not displayed */

Variables

This section is empty.

Functions

func QueueMessage added in v1.4.7

func QueueMessage(elem *QueuedElement)

QueueMessage queues a message in the message queue

func RegisterPlugin added in v1.4.1

func RegisterPlugin()

RegisterPlugin registers the mqueue plugin into the plugin system and also initializes it

func RegisterSource

func RegisterSource(name string, source PluginWithSourceDisabler)

RegisterSource registers a mqueue source, used for error handling

Types

type Plugin added in v1.4.1

type Plugin struct {
}

Plugin represents the mqueue plugin

func (*Plugin) BotInit added in v1.4.1

func (p *Plugin) BotInit()

func (*Plugin) LateBotInit added in v1.11.5

func (p *Plugin) LateBotInit()

LateBotInit implements bot.LateBotInitHandler

func (*Plugin) PluginInfo added in v1.17.0

func (p *Plugin) PluginInfo() *common.PluginInfo

PluginInfo implements common.Plugin

func (*Plugin) StopBot added in v1.4.1

func (p *Plugin) StopBot(wg *sync.WaitGroup)

StopBot implements bot.BotStopperHandler

type PluginWithSourceDisabler added in v1.20.14

type PluginWithSourceDisabler interface {
	DisableFeed(elem *QueuedElement, err error)
}

PluginWithSourceDisabler todo

type PluginWithWebhookAvatar added in v1.16.2

type PluginWithWebhookAvatar interface {
	WebhookAvatar() string
}

PluginWithWebhookAvatar can be implemented by plugins for custom avatars

type QueuedElement

type QueuedElement struct {
	// The channel to send the message in
	Channel int64
	Guild   int64

	ID int64

	// Where this feed originated from, responsible for handling discord specific errors
	Source string
	// Could be stuff like reddit feed element id, youtube feed element id and so on
	SourceID string

	// The actual message as a simple string
	// specify only one of MessageStr or MessageEmbed
	MessageStr string `json:",omitempty"`

	// The actual message as an embed
	// specify only one of MessageStr or MessageEmbed
	MessageEmbed *discordgo.MessageEmbed `json:",omitempty"`

	UseWebhook      bool
	WebhookUsername string

	AllowedMentions discordgo.AllowedMentions `json:"allowed_mentions"`

	// When the queue grows, the feeds with the highest priority gets sent first
	Priority int
}

QueuedElement represents a queued message

Jump to

Keyboard shortcuts

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