mqueue

package
v1.17.2 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2019 License: MIT Imports: 13 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 IncrIDCounter added in v1.4.7

func IncrIDCounter() (next int64)

func QueueMessage added in v1.4.7

func QueueMessage(source, sourceID string, guildID, channel int64, msgStr string, embed *discordgo.MessageEmbed)

func QueueMessageEmbed

func QueueMessageEmbed(source, sourceID string, guildID, channel int64, embed *discordgo.MessageEmbed)

func QueueMessageString

func QueueMessageString(source, sourceID string, guildID, channel int64, message string)

func QueueMessageWebhook added in v1.16.2

func QueueMessageWebhook(source, sourceID string, guildID, channel int64, msgStr string, embed *discordgo.MessageEmbed, webhook bool, webhookUsername string)

func RegisterPlugin added in v1.4.1

func RegisterPlugin()

func RegisterSource

func RegisterSource(name string, source PluginWithErrorHandler)

Types

type Plugin added in v1.4.1

type Plugin struct {
}

func (*Plugin) LateBotInit added in v1.11.5

func (p *Plugin) LateBotInit()

func (*Plugin) PluginInfo added in v1.17.0

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

func (*Plugin) StopBot added in v1.4.1

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

type PluginWithErrorHandler

type PluginWithErrorHandler interface {
	HandleMQueueError(elem *QueuedElement, err error)
}

type PluginWithWebhookAvatar added in v1.16.2

type PluginWithWebhookAvatar interface {
	WebhookAvatar() string
}

type QueuedElement

type QueuedElement struct {
	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
	MessageStr string `json:",omitempty"`

	// The actual message as an embed
	MessageEmbed *discordgo.MessageEmbed `json:",omitempty"`

	UseWebhook      bool
	WebhookUsername string
}

type Webhook added in v1.16.2

type Webhook struct {
	ID    int64
	Token string

	GuildID   int64
	ChannelID int64

	Plugin string
}

func CreateWebhook added in v1.16.2

func CreateWebhook(guildID int64, channelID int64, plugin string, avatar string) (*Webhook, error)

func FindCreateWebhook added in v1.16.2

func FindCreateWebhook(guildID int64, channelID int64, plugin string, avatar string) (*Webhook, error)

type WorkItem added in v1.10.0

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

Jump to

Keyboard shortcuts

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