eventsystem

package
v0.30.1 Latest Latest
Warning

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

Go to latest
Published: May 23, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EventNames = []string{
	"NewGuild",
	"All",
	"AllPre",
	"AllPost",
	"MemberFetched",
	"ChannelCreate",
	"ChannelDelete",
	"ChannelPinsUpdate",
	"ChannelUpdate",
	"Connect",
	"Disconnect",
	"GuildBanAdd",
	"GuildBanRemove",
	"GuildCreate",
	"GuildDelete",
	"GuildEmojisUpdate",
	"GuildIntegrationsUpdate",
	"GuildMemberAdd",
	"GuildMemberRemove",
	"GuildMemberUpdate",
	"GuildMembersChunk",
	"GuildRoleCreate",
	"GuildRoleDelete",
	"GuildRoleUpdate",
	"GuildUpdate",
	"MessageAck",
	"MessageCreate",
	"MessageDelete",
	"MessageDeleteBulk",
	"MessageReactionAdd",
	"MessageReactionRemove",
	"MessageReactionRemoveAll",
	"MessageUpdate",
	"PresenceUpdate",
	"PresencesReplace",
	"RateLimit",
	"Ready",
	"RelationshipAdd",
	"RelationshipRemove",
	"Resumed",
	"TypingStart",
	"UserGuildSettingsUpdate",
	"UserNoteUpdate",
	"UserSettingsUpdate",
	"UserUpdate",
	"VoiceServerUpdate",
	"VoiceStateUpdate",
}

Functions

func EmitEvent

func EmitEvent(data *EventData, evt Event)

EmitEvent emits an event

func HandleEvent

func HandleEvent(s *discordgo.Session, evt interface{})

func NumHandlers

func NumHandlers(evt Event) int

Types

type Event

type Event int
const (
	EventNewGuild                 Event = 0
	EventAll                      Event = 1
	EventAllPre                   Event = 2
	EventAllPost                  Event = 3
	EventMemberFetched            Event = 4
	EventChannelCreate            Event = 5
	EventChannelDelete            Event = 6
	EventChannelPinsUpdate        Event = 7
	EventChannelUpdate            Event = 8
	EventConnect                  Event = 9
	EventDisconnect               Event = 10
	EventGuildBanAdd              Event = 11
	EventGuildBanRemove           Event = 12
	EventGuildCreate              Event = 13
	EventGuildDelete              Event = 14
	EventGuildEmojisUpdate        Event = 15
	EventGuildIntegrationsUpdate  Event = 16
	EventGuildMemberAdd           Event = 17
	EventGuildMemberRemove        Event = 18
	EventGuildMemberUpdate        Event = 19
	EventGuildMembersChunk        Event = 20
	EventGuildRoleCreate          Event = 21
	EventGuildRoleDelete          Event = 22
	EventGuildRoleUpdate          Event = 23
	EventGuildUpdate              Event = 24
	EventMessageAck               Event = 25
	EventMessageCreate            Event = 26
	EventMessageDelete            Event = 27
	EventMessageDeleteBulk        Event = 28
	EventMessageReactionAdd       Event = 29
	EventMessageReactionRemove    Event = 30
	EventMessageReactionRemoveAll Event = 31
	EventMessageUpdate            Event = 32
	EventPresenceUpdate           Event = 33
	EventPresencesReplace         Event = 34
	EventRateLimit                Event = 35
	EventReady                    Event = 36
	EventRelationshipAdd          Event = 37
	EventRelationshipRemove       Event = 38
	EventResumed                  Event = 39
	EventTypingStart              Event = 40
	EventUserGuildSettingsUpdate  Event = 41
	EventUserNoteUpdate           Event = 42
	EventUserSettingsUpdate       Event = 43
	EventUserUpdate               Event = 44
	EventVoiceServerUpdate        Event = 45
	EventVoiceStateUpdate         Event = 46
)

func (Event) String

func (e Event) String() string

type EventData

type EventData struct {
	*EventDataContainer
	EvtInterface interface{}
	Type         Event
	// contains filtered or unexported fields
}

func (*EventData) Context

func (e *EventData) Context() context.Context

func (*EventData) WithContext

func (e *EventData) WithContext(ctx context.Context) *EventData

type EventDataContainer

type EventDataContainer struct {
	ChannelCreate            *discordgo.ChannelCreate
	ChannelDelete            *discordgo.ChannelDelete
	ChannelPinsUpdate        *discordgo.ChannelPinsUpdate
	ChannelUpdate            *discordgo.ChannelUpdate
	Connect                  *discordgo.Connect
	Disconnect               *discordgo.Disconnect
	GuildBanAdd              *discordgo.GuildBanAdd
	GuildBanRemove           *discordgo.GuildBanRemove
	GuildCreate              *discordgo.GuildCreate
	GuildDelete              *discordgo.GuildDelete
	GuildEmojisUpdate        *discordgo.GuildEmojisUpdate
	GuildIntegrationsUpdate  *discordgo.GuildIntegrationsUpdate
	GuildMemberAdd           *discordgo.GuildMemberAdd
	GuildMemberRemove        *discordgo.GuildMemberRemove
	GuildMemberUpdate        *discordgo.GuildMemberUpdate
	GuildMembersChunk        *discordgo.GuildMembersChunk
	GuildRoleCreate          *discordgo.GuildRoleCreate
	GuildRoleDelete          *discordgo.GuildRoleDelete
	GuildRoleUpdate          *discordgo.GuildRoleUpdate
	GuildUpdate              *discordgo.GuildUpdate
	MessageAck               *discordgo.MessageAck
	MessageCreate            *discordgo.MessageCreate
	MessageDelete            *discordgo.MessageDelete
	MessageDeleteBulk        *discordgo.MessageDeleteBulk
	MessageReactionAdd       *discordgo.MessageReactionAdd
	MessageReactionRemove    *discordgo.MessageReactionRemove
	MessageReactionRemoveAll *discordgo.MessageReactionRemoveAll
	MessageUpdate            *discordgo.MessageUpdate
	PresenceUpdate           *discordgo.PresenceUpdate
	PresencesReplace         *discordgo.PresencesReplace
	RateLimit                *discordgo.RateLimit
	Ready                    *discordgo.Ready
	RelationshipAdd          *discordgo.RelationshipAdd
	RelationshipRemove       *discordgo.RelationshipRemove
	Resumed                  *discordgo.Resumed
	TypingStart              *discordgo.TypingStart
	UserGuildSettingsUpdate  *discordgo.UserGuildSettingsUpdate
	UserNoteUpdate           *discordgo.UserNoteUpdate
	UserSettingsUpdate       *discordgo.UserSettingsUpdate
	UserUpdate               *discordgo.UserUpdate
	VoiceServerUpdate        *discordgo.VoiceServerUpdate
	VoiceStateUpdate         *discordgo.VoiceStateUpdate

	Session *discordgo.Session
}

type Handler

type Handler func(evtData *EventData)
var (
	ConcurrentAfter *Handler
)

func AddHandler

func AddHandler(handler Handler, evts ...Event) *Handler

AddHandler adds a event handler

func AddHandlerBefore

func AddHandlerBefore(handler Handler, evt Event, before *Handler) *Handler

AddHandlerBefore adds a handler to be called before another handler

func AddHandlerFirst

func AddHandlerFirst(handler Handler, evt Event) *Handler

AddHandlerFirst adds a handler first in the queue

Jump to

Keyboard shortcuts

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