eventsystem

package
v2.46.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: MIT Imports: 11 Imported by: 1

README

YAGPDB's Event System

Instead of just using discordgo's standard simple event system, I like to experiment a little as I work on stuff to see what happens.

It all boils down to a simple 3D slice of handlers (handlers [][][]Handler)

The first index is the event index, that length is generated by events_gen.go

Next index is order, there is 3 orders:

0 - first ran 1 - state handler is here 2 - last, ran concurrently from here on

Orders 1 and 0 are run synchronously, but 2 is run concurrently, this is in order to have the state be as proper as possible.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllDiscordEvents = []Event{
	EventApplicationCommandCreate,
	EventApplicationCommandDelete,
	EventApplicationCommandPermissionsUpdate,
	EventApplicationCommandUpdate,
	EventAutoModerationActionExecution,
	EventAutoModerationRuleCreate,
	EventAutoModerationRuleDelete,
	EventAutoModerationRuleUpdate,
	EventChannelCreate,
	EventChannelDelete,
	EventChannelPinsUpdate,
	EventChannelTopicUpdate,
	EventChannelUpdate,
	EventConnect,
	EventDisconnect,
	EventEntitlementCreate,
	EventEntitlementDelete,
	EventEntitlementUpdate,
	EventGuildAuditLogEntryCreate,
	EventGuildBanAdd,
	EventGuildBanRemove,
	EventGuildCreate,
	EventGuildDelete,
	EventGuildEmojisUpdate,
	EventGuildIntegrationsUpdate,
	EventGuildJoinRequestDelete,
	EventGuildJoinRequestUpdate,
	EventGuildMemberAdd,
	EventGuildMemberRemove,
	EventGuildMemberUpdate,
	EventGuildMembersChunk,
	EventGuildRoleCreate,
	EventGuildRoleDelete,
	EventGuildRoleUpdate,
	EventGuildStickersUpdate,
	EventGuildUpdate,
	EventInteractionCreate,
	EventInviteCreate,
	EventInviteDelete,
	EventMessageAck,
	EventMessageCreate,
	EventMessageDelete,
	EventMessageDeleteBulk,
	EventMessageReactionAdd,
	EventMessageReactionRemove,
	EventMessageReactionRemoveAll,
	EventMessageReactionRemoveEmoji,
	EventMessageUpdate,
	EventPresenceUpdate,
	EventPresencesReplace,
	EventRateLimit,
	EventReady,
	EventRelationshipAdd,
	EventRelationshipRemove,
	EventResumed,
	EventStageInstanceCreate,
	EventStageInstanceDelete,
	EventStageInstanceUpdate,
	EventSubscriptionCreate,
	EventSubscriptionDelete,
	EventSubscriptionUpdate,
	EventThreadCreate,
	EventThreadDelete,
	EventThreadListSync,
	EventThreadMemberUpdate,
	EventThreadMembersUpdate,
	EventThreadUpdate,
	EventTypingStart,
	EventUserGuildSettingsUpdate,
	EventUserNoteUpdate,
	EventUserSettingsUpdate,
	EventUserUpdate,
	EventVoiceChannelStatusUpdate,
	EventVoiceServerUpdate,
	EventVoiceStateUpdate,
	EventWebhooksUpdate,
}
View Source
var AllEvents = []Event{
	EventNewGuild,
	EventAll,
	EventAllPre,
	EventAllPost,
	EventMemberFetched,
	EventYagShardReady,
	EventYagShardsAdded,
	EventYagShardRemoved,
	EventApplicationCommandCreate,
	EventApplicationCommandDelete,
	EventApplicationCommandPermissionsUpdate,
	EventApplicationCommandUpdate,
	EventAutoModerationActionExecution,
	EventAutoModerationRuleCreate,
	EventAutoModerationRuleDelete,
	EventAutoModerationRuleUpdate,
	EventChannelCreate,
	EventChannelDelete,
	EventChannelPinsUpdate,
	EventChannelTopicUpdate,
	EventChannelUpdate,
	EventConnect,
	EventDisconnect,
	EventEntitlementCreate,
	EventEntitlementDelete,
	EventEntitlementUpdate,
	EventGuildAuditLogEntryCreate,
	EventGuildBanAdd,
	EventGuildBanRemove,
	EventGuildCreate,
	EventGuildDelete,
	EventGuildEmojisUpdate,
	EventGuildIntegrationsUpdate,
	EventGuildJoinRequestDelete,
	EventGuildJoinRequestUpdate,
	EventGuildMemberAdd,
	EventGuildMemberRemove,
	EventGuildMemberUpdate,
	EventGuildMembersChunk,
	EventGuildRoleCreate,
	EventGuildRoleDelete,
	EventGuildRoleUpdate,
	EventGuildStickersUpdate,
	EventGuildUpdate,
	EventInteractionCreate,
	EventInviteCreate,
	EventInviteDelete,
	EventMessageAck,
	EventMessageCreate,
	EventMessageDelete,
	EventMessageDeleteBulk,
	EventMessageReactionAdd,
	EventMessageReactionRemove,
	EventMessageReactionRemoveAll,
	EventMessageReactionRemoveEmoji,
	EventMessageUpdate,
	EventPresenceUpdate,
	EventPresencesReplace,
	EventRateLimit,
	EventReady,
	EventRelationshipAdd,
	EventRelationshipRemove,
	EventResumed,
	EventStageInstanceCreate,
	EventStageInstanceDelete,
	EventStageInstanceUpdate,
	EventSubscriptionCreate,
	EventSubscriptionDelete,
	EventSubscriptionUpdate,
	EventThreadCreate,
	EventThreadDelete,
	EventThreadListSync,
	EventThreadMemberUpdate,
	EventThreadMembersUpdate,
	EventThreadUpdate,
	EventTypingStart,
	EventUserGuildSettingsUpdate,
	EventUserNoteUpdate,
	EventUserSettingsUpdate,
	EventUserUpdate,
	EventVoiceChannelStatusUpdate,
	EventVoiceServerUpdate,
	EventVoiceStateUpdate,
	EventWebhooksUpdate,
}
View Source
var DiscordState dstate.StateTracker
View Source
var EventNames = []string{
	"NewGuild",
	"All",
	"AllPre",
	"AllPost",
	"MemberFetched",
	"YagShardReady",
	"YagShardsAdded",
	"YagShardRemoved",
	"ApplicationCommandCreate",
	"ApplicationCommandDelete",
	"ApplicationCommandPermissionsUpdate",
	"ApplicationCommandUpdate",
	"AutoModerationActionExecution",
	"AutoModerationRuleCreate",
	"AutoModerationRuleDelete",
	"AutoModerationRuleUpdate",
	"ChannelCreate",
	"ChannelDelete",
	"ChannelPinsUpdate",
	"ChannelTopicUpdate",
	"ChannelUpdate",
	"Connect",
	"Disconnect",
	"EntitlementCreate",
	"EntitlementDelete",
	"EntitlementUpdate",
	"GuildAuditLogEntryCreate",
	"GuildBanAdd",
	"GuildBanRemove",
	"GuildCreate",
	"GuildDelete",
	"GuildEmojisUpdate",
	"GuildIntegrationsUpdate",
	"GuildJoinRequestDelete",
	"GuildJoinRequestUpdate",
	"GuildMemberAdd",
	"GuildMemberRemove",
	"GuildMemberUpdate",
	"GuildMembersChunk",
	"GuildRoleCreate",
	"GuildRoleDelete",
	"GuildRoleUpdate",
	"GuildStickersUpdate",
	"GuildUpdate",
	"InteractionCreate",
	"InviteCreate",
	"InviteDelete",
	"MessageAck",
	"MessageCreate",
	"MessageDelete",
	"MessageDeleteBulk",
	"MessageReactionAdd",
	"MessageReactionRemove",
	"MessageReactionRemoveAll",
	"MessageReactionRemoveEmoji",
	"MessageUpdate",
	"PresenceUpdate",
	"PresencesReplace",
	"RateLimit",
	"Ready",
	"RelationshipAdd",
	"RelationshipRemove",
	"Resumed",
	"StageInstanceCreate",
	"StageInstanceDelete",
	"StageInstanceUpdate",
	"SubscriptionCreate",
	"SubscriptionDelete",
	"SubscriptionUpdate",
	"ThreadCreate",
	"ThreadDelete",
	"ThreadListSync",
	"ThreadMemberUpdate",
	"ThreadMembersUpdate",
	"ThreadUpdate",
	"TypingStart",
	"UserGuildSettingsUpdate",
	"UserNoteUpdate",
	"UserSettingsUpdate",
	"UserUpdate",
	"VoiceChannelStatusUpdate",
	"VoiceServerUpdate",
	"VoiceStateUpdate",
	"WebhooksUpdate",
}

Functions

func AddHandler

func AddHandler(p common.Plugin, handler HandlerFunc, order Order, evts ...Event)

AddHandler adds a event handler

func AddHandlerAsyncLast

func AddHandlerAsyncLast(p common.Plugin, handler HandlerFunc, evts ...Event)

AddHandlerAsyncLast adds handlers using the OrderAsyncPostState order

func AddHandlerAsyncLastLegacy

func AddHandlerAsyncLastLegacy(p common.Plugin, handler HandlerFuncLegacy, evts ...Event)

AddHandlerAsyncLast adds handlers using the OrderAsyncPostState order

func AddHandlerFirst

func AddHandlerFirst(p common.Plugin, handler HandlerFunc, evts ...Event)

AddHandlerFirst adds handlers using the OrderSyncPreState order

func AddHandlerFirstLegacy

func AddHandlerFirstLegacy(p common.Plugin, handler HandlerFuncLegacy, evts ...Event)

AddHandlerFirst adds handlers using the OrderSyncPreState order

func AddHandlerLegacy

func AddHandlerLegacy(p common.Plugin, handler HandlerFuncLegacy, order Order, evts ...Event)

AddHandler adds a event handler

func AddHandlerSecond

func AddHandlerSecond(p common.Plugin, handler HandlerFunc, evts ...Event)

AddHandlerSecond adds handlers using the OrderSyncPostState order

func AddHandlerSecondLegacy

func AddHandlerSecondLegacy(p common.Plugin, handler HandlerFuncLegacy, evts ...Event)

AddHandlerSecond adds handlers using the OrderSyncPostState order

func EmitEvent

func EmitEvent(data *EventData, evt Event)

EmitEvent emits an event

func HandleEvent

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

func InitWorkers

func InitWorkers(totalShards int)

func QueueEventNonDiscord

func QueueEventNonDiscord(evtData *EventData)

Types

type Event

type Event int
const (
	EventNewGuild                            Event = 0
	EventAll                                 Event = 1
	EventAllPre                              Event = 2
	EventAllPost                             Event = 3
	EventMemberFetched                       Event = 4
	EventYagShardReady                       Event = 5
	EventYagShardsAdded                      Event = 6
	EventYagShardRemoved                     Event = 7
	EventApplicationCommandCreate            Event = 8
	EventApplicationCommandDelete            Event = 9
	EventApplicationCommandPermissionsUpdate Event = 10
	EventApplicationCommandUpdate            Event = 11
	EventAutoModerationActionExecution       Event = 12
	EventAutoModerationRuleCreate            Event = 13
	EventAutoModerationRuleDelete            Event = 14
	EventAutoModerationRuleUpdate            Event = 15
	EventChannelCreate                       Event = 16
	EventChannelDelete                       Event = 17
	EventChannelPinsUpdate                   Event = 18
	EventChannelTopicUpdate                  Event = 19
	EventChannelUpdate                       Event = 20
	EventConnect                             Event = 21
	EventDisconnect                          Event = 22
	EventEntitlementCreate                   Event = 23
	EventEntitlementDelete                   Event = 24
	EventEntitlementUpdate                   Event = 25
	EventGuildAuditLogEntryCreate            Event = 26
	EventGuildBanAdd                         Event = 27
	EventGuildBanRemove                      Event = 28
	EventGuildCreate                         Event = 29
	EventGuildDelete                         Event = 30
	EventGuildEmojisUpdate                   Event = 31
	EventGuildIntegrationsUpdate             Event = 32
	EventGuildJoinRequestDelete              Event = 33
	EventGuildJoinRequestUpdate              Event = 34
	EventGuildMemberAdd                      Event = 35
	EventGuildMemberRemove                   Event = 36
	EventGuildMemberUpdate                   Event = 37
	EventGuildMembersChunk                   Event = 38
	EventGuildRoleCreate                     Event = 39
	EventGuildRoleDelete                     Event = 40
	EventGuildRoleUpdate                     Event = 41
	EventGuildStickersUpdate                 Event = 42
	EventGuildUpdate                         Event = 43
	EventInteractionCreate                   Event = 44
	EventInviteCreate                        Event = 45
	EventInviteDelete                        Event = 46
	EventMessageAck                          Event = 47
	EventMessageCreate                       Event = 48
	EventMessageDelete                       Event = 49
	EventMessageDeleteBulk                   Event = 50
	EventMessageReactionAdd                  Event = 51
	EventMessageReactionRemove               Event = 52
	EventMessageReactionRemoveAll            Event = 53
	EventMessageReactionRemoveEmoji          Event = 54
	EventMessageUpdate                       Event = 55
	EventPresenceUpdate                      Event = 56
	EventPresencesReplace                    Event = 57
	EventRateLimit                           Event = 58
	EventReady                               Event = 59
	EventRelationshipAdd                     Event = 60
	EventRelationshipRemove                  Event = 61
	EventResumed                             Event = 62
	EventStageInstanceCreate                 Event = 63
	EventStageInstanceDelete                 Event = 64
	EventStageInstanceUpdate                 Event = 65
	EventSubscriptionCreate                  Event = 66
	EventSubscriptionDelete                  Event = 67
	EventSubscriptionUpdate                  Event = 68
	EventThreadCreate                        Event = 69
	EventThreadDelete                        Event = 70
	EventThreadListSync                      Event = 71
	EventThreadMemberUpdate                  Event = 72
	EventThreadMembersUpdate                 Event = 73
	EventThreadUpdate                        Event = 74
	EventTypingStart                         Event = 75
	EventUserGuildSettingsUpdate             Event = 76
	EventUserNoteUpdate                      Event = 77
	EventUserSettingsUpdate                  Event = 78
	EventUserUpdate                          Event = 79
	EventVoiceChannelStatusUpdate            Event = 80
	EventVoiceServerUpdate                   Event = 81
	EventVoiceStateUpdate                    Event = 82
	EventWebhooksUpdate                      Event = 83
)

func (Event) String

func (e Event) String() string

type EventData

type EventData struct {
	EvtInterface interface{}
	Type         Event

	Session           *discordgo.Session
	GuildFeatureFlags []string

	GS *dstate.GuildSet // Guaranteed to be available for guild events, except creates and deletes
	// contains filtered or unexported fields
}

func NewEventData

func NewEventData(session *discordgo.Session, t Event, evtInterface interface{}) *EventData

func (*EventData) ApplicationCommandCreate

func (data *EventData) ApplicationCommandCreate() *discordgo.ApplicationCommandCreate

func (*EventData) ApplicationCommandDelete

func (data *EventData) ApplicationCommandDelete() *discordgo.ApplicationCommandDelete

func (*EventData) ApplicationCommandPermissionsUpdate added in v2.17.0

func (data *EventData) ApplicationCommandPermissionsUpdate() *discordgo.ApplicationCommandPermissionsUpdate

func (*EventData) ApplicationCommandUpdate

func (data *EventData) ApplicationCommandUpdate() *discordgo.ApplicationCommandUpdate

func (*EventData) AutoModerationActionExecution added in v2.17.0

func (data *EventData) AutoModerationActionExecution() *discordgo.AutoModerationActionExecution

func (*EventData) AutoModerationRuleCreate added in v2.17.0

func (data *EventData) AutoModerationRuleCreate() *discordgo.AutoModerationRuleCreate

func (*EventData) AutoModerationRuleDelete added in v2.17.0

func (data *EventData) AutoModerationRuleDelete() *discordgo.AutoModerationRuleDelete

func (*EventData) AutoModerationRuleUpdate added in v2.17.0

func (data *EventData) AutoModerationRuleUpdate() *discordgo.AutoModerationRuleUpdate

func (*EventData) CS

func (d *EventData) CS() *dstate.ChannelState

CS is the same as calling d.GS.GetChannel

func (*EventData) CSOrThread

func (d *EventData) CSOrThread() *dstate.ChannelState

CS is the same as calling d.GS.GetChannelOrThread

func (*EventData) Cancel

func (e *EventData) Cancel()

func (*EventData) ChannelCreate

func (data *EventData) ChannelCreate() *discordgo.ChannelCreate

func (*EventData) ChannelDelete

func (data *EventData) ChannelDelete() *discordgo.ChannelDelete

func (*EventData) ChannelPinsUpdate

func (data *EventData) ChannelPinsUpdate() *discordgo.ChannelPinsUpdate

func (*EventData) ChannelTopicUpdate added in v2.27.0

func (data *EventData) ChannelTopicUpdate() *discordgo.ChannelTopicUpdate

func (*EventData) ChannelUpdate

func (data *EventData) ChannelUpdate() *discordgo.ChannelUpdate

func (*EventData) Clone

func (e *EventData) Clone() *EventData

func (*EventData) Connect

func (data *EventData) Connect() *discordgo.Connect

func (*EventData) Context

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

func (*EventData) Disconnect

func (data *EventData) Disconnect() *discordgo.Disconnect

func (*EventData) EntitlementCreate added in v2.45.0

func (data *EventData) EntitlementCreate() *discordgo.EntitlementCreate

func (*EventData) EntitlementDelete added in v2.45.0

func (data *EventData) EntitlementDelete() *discordgo.EntitlementDelete

func (*EventData) EntitlementUpdate added in v2.45.0

func (data *EventData) EntitlementUpdate() *discordgo.EntitlementUpdate

func (*EventData) GuildAuditLogEntryCreate added in v2.17.0

func (data *EventData) GuildAuditLogEntryCreate() *discordgo.GuildAuditLogEntryCreate

func (*EventData) GuildBanAdd

func (data *EventData) GuildBanAdd() *discordgo.GuildBanAdd

func (*EventData) GuildBanRemove

func (data *EventData) GuildBanRemove() *discordgo.GuildBanRemove

func (*EventData) GuildCreate

func (data *EventData) GuildCreate() *discordgo.GuildCreate

func (*EventData) GuildDelete

func (data *EventData) GuildDelete() *discordgo.GuildDelete

func (*EventData) GuildEmojisUpdate

func (data *EventData) GuildEmojisUpdate() *discordgo.GuildEmojisUpdate

func (*EventData) GuildIntegrationsUpdate

func (data *EventData) GuildIntegrationsUpdate() *discordgo.GuildIntegrationsUpdate

func (*EventData) GuildJoinRequestDelete added in v2.17.1

func (data *EventData) GuildJoinRequestDelete() *discordgo.GuildJoinRequestDelete

func (*EventData) GuildJoinRequestUpdate added in v2.17.1

func (data *EventData) GuildJoinRequestUpdate() *discordgo.GuildJoinRequestUpdate

func (*EventData) GuildMemberAdd

func (data *EventData) GuildMemberAdd() *discordgo.GuildMemberAdd

func (*EventData) GuildMemberRemove

func (data *EventData) GuildMemberRemove() *discordgo.GuildMemberRemove

func (*EventData) GuildMemberUpdate

func (data *EventData) GuildMemberUpdate() *discordgo.GuildMemberUpdate

func (*EventData) GuildMembersChunk

func (data *EventData) GuildMembersChunk() *discordgo.GuildMembersChunk

func (*EventData) GuildRoleCreate

func (data *EventData) GuildRoleCreate() *discordgo.GuildRoleCreate

func (*EventData) GuildRoleDelete

func (data *EventData) GuildRoleDelete() *discordgo.GuildRoleDelete

func (*EventData) GuildRoleUpdate

func (data *EventData) GuildRoleUpdate() *discordgo.GuildRoleUpdate

func (*EventData) GuildStickersUpdate

func (data *EventData) GuildStickersUpdate() *discordgo.GuildStickersUpdate

func (*EventData) GuildUpdate

func (data *EventData) GuildUpdate() *discordgo.GuildUpdate

func (*EventData) HasFeatureFlag

func (e *EventData) HasFeatureFlag(flag string) bool

HasFeatureFlag returns true if the guild the event came from has the provided feature flag

func (*EventData) InteractionCreate

func (data *EventData) InteractionCreate() *discordgo.InteractionCreate

func (*EventData) InviteCreate

func (data *EventData) InviteCreate() *discordgo.InviteCreate

func (*EventData) InviteDelete

func (data *EventData) InviteDelete() *discordgo.InviteDelete

func (*EventData) MessageAck

func (data *EventData) MessageAck() *discordgo.MessageAck

func (*EventData) MessageCreate

func (data *EventData) MessageCreate() *discordgo.MessageCreate

func (*EventData) MessageDelete

func (data *EventData) MessageDelete() *discordgo.MessageDelete

func (*EventData) MessageDeleteBulk

func (data *EventData) MessageDeleteBulk() *discordgo.MessageDeleteBulk

func (*EventData) MessageReactionAdd

func (data *EventData) MessageReactionAdd() *discordgo.MessageReactionAdd

func (*EventData) MessageReactionRemove

func (data *EventData) MessageReactionRemove() *discordgo.MessageReactionRemove

func (*EventData) MessageReactionRemoveAll

func (data *EventData) MessageReactionRemoveAll() *discordgo.MessageReactionRemoveAll

func (*EventData) MessageReactionRemoveEmoji

func (data *EventData) MessageReactionRemoveEmoji() *discordgo.MessageReactionRemoveEmoji

func (*EventData) MessageUpdate

func (data *EventData) MessageUpdate() *discordgo.MessageUpdate

func (*EventData) PresenceUpdate

func (data *EventData) PresenceUpdate() *discordgo.PresenceUpdate

func (*EventData) PresencesReplace

func (data *EventData) PresencesReplace() *discordgo.PresencesReplace

func (*EventData) RateLimit

func (data *EventData) RateLimit() *discordgo.RateLimit

func (*EventData) Ready

func (data *EventData) Ready() *discordgo.Ready

func (*EventData) RelationshipAdd

func (data *EventData) RelationshipAdd() *discordgo.RelationshipAdd

func (*EventData) RelationshipRemove

func (data *EventData) RelationshipRemove() *discordgo.RelationshipRemove

func (*EventData) Resumed

func (data *EventData) Resumed() *discordgo.Resumed

func (*EventData) StageInstanceCreate

func (data *EventData) StageInstanceCreate() *discordgo.StageInstanceCreate

func (*EventData) StageInstanceDelete

func (data *EventData) StageInstanceDelete() *discordgo.StageInstanceDelete

func (*EventData) StageInstanceUpdate

func (data *EventData) StageInstanceUpdate() *discordgo.StageInstanceUpdate

func (*EventData) SubscriptionCreate added in v2.45.0

func (data *EventData) SubscriptionCreate() *discordgo.SubscriptionCreate

func (*EventData) SubscriptionDelete added in v2.45.0

func (data *EventData) SubscriptionDelete() *discordgo.SubscriptionDelete

func (*EventData) SubscriptionUpdate added in v2.45.0

func (data *EventData) SubscriptionUpdate() *discordgo.SubscriptionUpdate

func (*EventData) ThreadCreate

func (data *EventData) ThreadCreate() *discordgo.ThreadCreate

func (*EventData) ThreadDelete

func (data *EventData) ThreadDelete() *discordgo.ThreadDelete

func (*EventData) ThreadListSync

func (data *EventData) ThreadListSync() *discordgo.ThreadListSync

func (*EventData) ThreadMemberUpdate

func (data *EventData) ThreadMemberUpdate() *discordgo.ThreadMemberUpdate

func (*EventData) ThreadMembersUpdate

func (data *EventData) ThreadMembersUpdate() *discordgo.ThreadMembersUpdate

func (*EventData) ThreadUpdate

func (data *EventData) ThreadUpdate() *discordgo.ThreadUpdate

func (*EventData) TypingStart

func (data *EventData) TypingStart() *discordgo.TypingStart

func (*EventData) UserGuildSettingsUpdate

func (data *EventData) UserGuildSettingsUpdate() *discordgo.UserGuildSettingsUpdate

func (*EventData) UserNoteUpdate

func (data *EventData) UserNoteUpdate() *discordgo.UserNoteUpdate

func (*EventData) UserSettingsUpdate

func (data *EventData) UserSettingsUpdate() *discordgo.UserSettingsUpdate

func (*EventData) UserUpdate

func (data *EventData) UserUpdate() *discordgo.UserUpdate

func (*EventData) VoiceChannelStatusUpdate added in v2.27.0

func (data *EventData) VoiceChannelStatusUpdate() *discordgo.VoiceChannelStatusUpdate

func (*EventData) VoiceServerUpdate

func (data *EventData) VoiceServerUpdate() *discordgo.VoiceServerUpdate

func (*EventData) VoiceStateUpdate

func (data *EventData) VoiceStateUpdate() *discordgo.VoiceStateUpdate

func (*EventData) WebhooksUpdate

func (data *EventData) WebhooksUpdate() *discordgo.WebhooksUpdate

func (*EventData) WithContext

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

type Handler

type Handler struct {
	Plugin  common.Plugin
	F       HandlerFunc
	FLegacy HandlerFuncLegacy
}

type HandlerFunc

type HandlerFunc func(evtData *EventData) (retry bool, err error)

func RequireCSMW

func RequireCSMW(inner HandlerFunc) HandlerFunc

RequireCSMW will only call the inner handler if a channel state is available

type HandlerFuncLegacy

type HandlerFuncLegacy func(evtData *EventData)

type Order

type Order int
const (
	// Ran first, syncrounously, before changes from the event is applied to state
	OrderSyncPreState Order = 0
	// Ran second, syncrounsly, after state changes have been applied
	OrderSyncPostState Order = 1
	// Ran last, asyncrounously, most handlers should use this unless you need something else in special circumstances
	OrderAsyncPostState Order = 2
)

Jump to

Keyboard shortcuts

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