Documentation ¶
Index ¶
- Constants
- Variables
- func FetchChannel(ctx *GRPCContext, channel *discord.Channel) (*discord.Channel, error)
- func FetchEmoji(ctx *GRPCContext, emoji *discord.Emoji) (*discord.Emoji, error)
- func FetchGuild(ctx *GRPCContext, guild *discord.Guild) (*discord.Guild, error)
- func FetchGuildMember(ctx *GRPCContext, guildMember *discord.GuildMember) (*discord.GuildMember, error)
- func FetchRole(ctx *GRPCContext, role *discord.Role) (*discord.Role, error)
- func FetchUser(ctx *GRPCContext, user *discord.User, createDMChannel bool) (*discord.User, error)
- func NewChannel(guildID *discord.Snowflake, channelID discord.Snowflake) *discord.Channel
- func NewEmoji(guildID *discord.Snowflake, emojiID discord.Snowflake) *discord.Emoji
- func NewGuild(guildID discord.Snowflake) *discord.Guild
- func NewGuildMember(guildID *discord.Snowflake, userID discord.Snowflake) *discord.GuildMember
- func NewRole(guildID *discord.Snowflake, roleID discord.Snowflake) *discord.Role
- func NewUser(userID discord.Snowflake) *discord.User
- func NewWebhook(id discord.Snowflake, token string, webhookType discord.WebhookType) *discord.Webhook
- func OnApplicationCommandCreate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnApplicationCommandDelete(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnApplicationCommandUpdate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnChannelCreate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnChannelDelete(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnChannelPinsUpdate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnChannelUpdate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnGuildAvailable(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnGuildBanAdd(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnGuildBanRemove(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnGuildCreate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnGuildDelete(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnGuildEmojisUpdate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnGuildIntegrationsUpdate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnGuildJoin(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnGuildLeave(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnGuildMemberAdd(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnGuildMemberRemove(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnGuildMemberUpdate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnGuildRoleCreate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnGuildRoleDelete(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnGuildRoleUpdate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnGuildStickersUpdate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnGuildUnavailable(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnGuildUpdate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnIntegrationCreate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnIntegrationDelete(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnIntegrationUpdate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnInteractionCreate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnInviteCreate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnInviteDelete(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnMessageCreate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnMessageDelete(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnMessageDeleteBulk(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnMessageReactionAdd(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnMessageReactionRemove(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnMessageReactionRemoveAll(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnMessageReactionRemoveEmoji(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnMessageUpdate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnPresenceUpdate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnReady(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnResumed(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnSandwichConfigurationReload(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnSandwichShardGroupStatusUpdate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnSandwichShardStatusUpdate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnStageInstanceCreate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnStageInstanceDelete(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnStageInstanceUpdate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnThreadCreate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnThreadDelete(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnThreadMemberUpdate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnThreadMembersUpdate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnThreadUpdate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnTypingStart(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnUserUpdate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnVoiceServerUpdate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnVoiceStateUpdate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func OnWebhookUpdate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
- func WebhookFromURL(url string) (*discord.Webhook, error)
- type Bot
- type Cog
- type CogInfo
- type CogWithBotLoad
- type CogWithBotUnload
- type CogWithEvents
- type DefaultGRPCClient
- func (grpcClient *DefaultGRPCClient) FetchChannelByID(grpcContext *GRPCContext, guildID discord.Snowflake, ...) (channel discord.Channel, err error)
- func (grpcClient *DefaultGRPCClient) FetchChannelsByName(grpcContext *GRPCContext, guildID discord.Snowflake, query string) (channels []discord.Channel, err error)
- func (grpcClient *DefaultGRPCClient) FetchConsumerConfiguration(grpcContext *GRPCContext, identifier string) (identifiers sandwich_structs.SandwichConsumerConfiguration, err error)
- func (grpcClient *DefaultGRPCClient) FetchEmojiByID(grpcContext *GRPCContext, guildID discord.Snowflake, emojiID discord.Snowflake) (emoji discord.Emoji, err error)
- func (grpcClient *DefaultGRPCClient) FetchEmojisByName(grpcContext *GRPCContext, guildID discord.Snowflake, query string) (emojis []discord.Emoji, err error)
- func (grpcClient *DefaultGRPCClient) FetchGuildByID(grpcContext *GRPCContext, guildID discord.Snowflake) (guild discord.Guild, err error)
- func (grpcClient *DefaultGRPCClient) FetchGuildsByName(grpcContext *GRPCContext, query string) (guilds []discord.Guild, err error)
- func (grpcClient *DefaultGRPCClient) FetchMemberByID(grpcContext *GRPCContext, guildID discord.Snowflake, ...) (member discord.GuildMember, err error)
- func (grpcClient *DefaultGRPCClient) FetchMembersByID(grpcContext *GRPCContext, guildID discord.Snowflake, ...) (members []discord.GuildMember, err error)
- func (grpcClient *DefaultGRPCClient) FetchMembersByName(grpcContext *GRPCContext, guildID discord.Snowflake, query string) (members []discord.GuildMember, err error)
- func (grpcClient *DefaultGRPCClient) FetchMutualGuilds(grpcContext *GRPCContext, userID discord.Snowflake, expand bool) (guilds []discord.Guild, err error)
- func (grpcClient *DefaultGRPCClient) FetchRoleByID(grpcContext *GRPCContext, guildID discord.Snowflake, roleID discord.Snowflake) (role discord.Role, err error)
- func (grpcClient *DefaultGRPCClient) FetchRolesByName(grpcContext *GRPCContext, guildID discord.Snowflake, query string) (roles []discord.Role, err error)
- func (grpcClient *DefaultGRPCClient) FetchUserByID(grpcContext *GRPCContext, token string, userID discord.Snowflake, ...) (user discord.User, err error)
- func (grpcClient *DefaultGRPCClient) FetchUserByName(grpcContext *GRPCContext, token string, query string, createDMChannel bool) (users []discord.User, err error)
- func (grpcClient *DefaultGRPCClient) Listen(grpcContext *GRPCContext, identifier string) (client sandwich_protobuf.Sandwich_ListenClient, err error)
- func (grpcClient *DefaultGRPCClient) PostAnalytics(grpcContext *GRPCContext, identifier string, data []byte) error
- func (grpcClient *DefaultGRPCClient) RequestGuildChunk(grpcContext *GRPCContext, guildID discord.Snowflake) error
- func (grpcClient *DefaultGRPCClient) SendWebsocketMessage(grpcContext *GRPCContext, location Location, op int32, data []byte) error
- func (grpcClient *DefaultGRPCClient) WhereIsGuild(grpcContext *GRPCContext, guildID discord.Snowflake) (locations []Location_GuildMember, err error)
- type EventContext
- func (eventCtx *EventContext) DecodeContent(msg sandwich_structs.SandwichPayload, out interface{}) error
- func (eventCtx *EventContext) DecodeExtra(msg sandwich_structs.SandwichPayload, key string, out interface{}) (ok bool, err error)
- func (eventCtx *EventContext) ToGRPCContext() *GRPCContext
- func (eventCtx *EventContext) Trace() sandwich_structs.SandwichTrace
- type EventHandler
- type EventParser
- type GRPC
- type GRPCContext
- type Handlers
- func (h *Handlers) Dispatch(eventCtx *EventContext, payload sandwich_structs.SandwichPayload)
- func (h *Handlers) DispatchType(eventCtx *EventContext, eventName string, ...) error
- func (h *Handlers) RegisterEvent(eventName string, parser EventParser, event interface{}) *EventHandler
- func (h *Handlers) RegisterEventHandler(eventName string, parser EventParser) *EventHandler
- func (h *Handlers) RegisterOnApplicationCommandCreateEvent(event OnApplicationCommandCreateFuncType)
- func (h *Handlers) RegisterOnApplicationCommandDeleteEvent(event OnApplicationCommandDeleteFuncType)
- func (h *Handlers) RegisterOnApplicationCommandUpdateEvent(event OnApplicationCommandUpdateFuncType)
- func (h *Handlers) RegisterOnChannelCreateEvent(event OnChannelCreateFuncType)
- func (h *Handlers) RegisterOnChannelDeleteEvent(event OnChannelDeleteFuncType)
- func (h *Handlers) RegisterOnChannelPinsUpdateEvent(event OnChannelPinsUpdateFuncType)
- func (h *Handlers) RegisterOnChannelUpdateEvent(event OnChannelUpdateFuncType)
- func (h *Handlers) RegisterOnError(event OnErrorFuncType)
- func (h *Handlers) RegisterOnGuildAvailableEvent(event OnGuildAvailableFuncType)
- func (h *Handlers) RegisterOnGuildBanAddEvent(event OnGuildBanAddFuncType)
- func (h *Handlers) RegisterOnGuildBanRemoveEvent(event OnGuildBanRemoveFuncType)
- func (h *Handlers) RegisterOnGuildEmojisUpdateEvent(event OnGuildEmojisUpdateFuncType)
- func (h *Handlers) RegisterOnGuildIntegrationsUpdateEvent(event OnGuildIntegrationsUpdateFuncType)
- func (h *Handlers) RegisterOnGuildJoinEvent(event OnGuildJoinFuncType)
- func (h *Handlers) RegisterOnGuildLeaveEvent(event OnGuildLeaveFuncType)
- func (h *Handlers) RegisterOnGuildMemberAddEvent(event OnGuildMemberAddFuncType)
- func (h *Handlers) RegisterOnGuildMemberRemoveEvent(event OnGuildMemberRemoveFuncType)
- func (h *Handlers) RegisterOnGuildMemberUpdateEvent(event OnGuildMemberUpdateFuncType)
- func (h *Handlers) RegisterOnGuildRoleCreateEvent(event OnGuildRoleCreateFuncType)
- func (h *Handlers) RegisterOnGuildRoleDeleteEvent(event OnGuildRoleDeleteFuncType)
- func (h *Handlers) RegisterOnGuildRoleUpdateEvent(event OnGuildRoleUpdateFuncType)
- func (h *Handlers) RegisterOnGuildStickersUpdateEvent(event OnGuildStickersUpdateFuncType)
- func (h *Handlers) RegisterOnGuildUnavailableEvent(event OnGuildUnavailableFuncType)
- func (h *Handlers) RegisterOnGuildUpdateEvent(event OnGuildUpdateFuncType)
- func (h *Handlers) RegisterOnIntegrationCreateEvent(event OnIntegrationCreateFuncType)
- func (h *Handlers) RegisterOnIntegrationDeleteEvent(event OnIntegrationDeleteFuncType)
- func (h *Handlers) RegisterOnIntegrationUpdateEvent(event OnIntegrationUpdateFuncType)
- func (h *Handlers) RegisterOnInteractionCreateEvent(event OnInteractionCreateFuncType)
- func (h *Handlers) RegisterOnInviteCreateEvent(event OnInviteCreateFuncType)
- func (h *Handlers) RegisterOnInviteDeleteEvent(event OnInviteDeleteFuncType)
- func (h *Handlers) RegisterOnMessageCreateEvent(event OnMessageCreateFuncType)
- func (h *Handlers) RegisterOnMessageDeleteBulkEvent(event OnMessageDeleteBulkFuncType)
- func (h *Handlers) RegisterOnMessageDeleteEvent(event OnMessageDeleteFuncType)
- func (h *Handlers) RegisterOnMessageReactionAddEvent(event OnMessageReactionAddFuncType)
- func (h *Handlers) RegisterOnMessageReactionRemoveAllEvent(event OnMessageReactionRemoveAllFuncType)
- func (h *Handlers) RegisterOnMessageReactionRemoveEmojiEvent(event OnMessageReactionRemoveEmojiFuncType)
- func (h *Handlers) RegisterOnMessageReactionRemoveEvent(event OnMessageReactionRemoveFuncType)
- func (h *Handlers) RegisterOnMessageUpdateEvent(event OnMessageUpdateFuncType)
- func (h *Handlers) RegisterOnPresenceUpdateEvent(event OnPresenceUpdateFuncType)
- func (h *Handlers) RegisterOnReadyEvent(event OnReadyFuncType)
- func (h *Handlers) RegisterOnResumedEvent(event OnResumedFuncType)
- func (h *Handlers) RegisterOnSandwichConfigurationReload(event OnSandwichConfigurationReloadFuncType)
- func (h *Handlers) RegisterOnSandwichShardGroupStatusUpdate(event OnSandwichShardGroupStatusUpdateFuncType)
- func (h *Handlers) RegisterOnSandwichShardStatusUpdate(event OnSandwichShardStatusUpdateFuncType)
- func (h *Handlers) RegisterOnStageInstanceCreateEvent(event OnStageInstanceCreateFuncType)
- func (h *Handlers) RegisterOnStageInstanceDeleteEvent(event OnStageInstanceDeleteFuncType)
- func (h *Handlers) RegisterOnStageInstanceUpdateEvent(event OnStageInstanceUpdateFuncType)
- func (h *Handlers) RegisterOnThreadCreateEvent(event OnThreadCreateFuncType)
- func (h *Handlers) RegisterOnThreadDeleteEvent(event OnThreadDeleteFuncType)
- func (h *Handlers) RegisterOnThreadMemberUpdateEvent(event OnThreadMemberUpdateFuncType)
- func (h *Handlers) RegisterOnThreadMembersUpdateEvent(event OnThreadMembersUpdateFuncType)
- func (h *Handlers) RegisterOnThreadUpdateEvent(event OnThreadUpdateFuncType)
- func (h *Handlers) RegisterOnTypingStartEvent(event OnTypingStartFuncType)
- func (h *Handlers) RegisterOnUserUpdateEvent(event OnUserUpdateFuncType)
- func (h *Handlers) RegisterOnVoiceServerUpdateEvent(event OnVoiceServerUpdateFuncType)
- func (h *Handlers) RegisterOnVoiceStateUpdateEvent(event OnVoiceStateUpdateFuncType)
- func (h *Handlers) RegisterOnWebhookUpdateEvent(event OnWebhookUpdateFuncType)
- func (h *Handlers) WrapFuncType(eventCtx *EventContext, funcTypeErr error) error
- type Location
- type Location_GuildMember
- type MQClient
- type OnApplicationCommandCreateFuncType
- type OnApplicationCommandDeleteFuncType
- type OnApplicationCommandUpdateFuncType
- type OnChannelCreateFuncType
- type OnChannelDeleteFuncType
- type OnChannelPinsUpdateFuncType
- type OnChannelUpdateFuncType
- type OnErrorFuncType
- type OnGuildAvailableFuncType
- type OnGuildBanAddFuncType
- type OnGuildBanRemoveFuncType
- type OnGuildEmojisUpdateFuncType
- type OnGuildIntegrationsUpdateFuncType
- type OnGuildJoinFuncType
- type OnGuildLeaveFuncType
- type OnGuildMemberAddFuncType
- type OnGuildMemberRemoveFuncType
- type OnGuildMemberUpdateFuncType
- type OnGuildRoleCreateFuncType
- type OnGuildRoleDeleteFuncType
- type OnGuildRoleUpdateFuncType
- type OnGuildStickersUpdateFuncType
- type OnGuildUnavailableFuncType
- type OnGuildUpdateFuncType
- type OnIntegrationCreateFuncType
- type OnIntegrationDeleteFuncType
- type OnIntegrationUpdateFuncType
- type OnInteractionCreateFuncType
- type OnInviteCreateFuncType
- type OnInviteDeleteFuncType
- type OnMessageCreateFuncType
- type OnMessageDeleteBulkFuncType
- type OnMessageDeleteFuncType
- type OnMessageReactionAddFuncType
- type OnMessageReactionRemoveAllFuncType
- type OnMessageReactionRemoveEmojiFuncType
- type OnMessageReactionRemoveFuncType
- type OnMessageUpdateFuncType
- type OnPresenceUpdateFuncType
- type OnReadyFuncType
- type OnResumedFuncType
- type OnSandwichConfigurationReloadFuncType
- type OnSandwichShardGroupStatusUpdateFuncType
- type OnSandwichShardStatusUpdateFuncType
- type OnStageInstanceCreateFuncType
- type OnStageInstanceDeleteFuncType
- type OnStageInstanceUpdateFuncType
- type OnThreadCreateFuncType
- type OnThreadDeleteFuncType
- type OnThreadMemberUpdateFuncType
- type OnThreadMembersUpdateFuncType
- type OnThreadUpdateFuncType
- type OnTypingStartFuncType
- type OnUserUpdateFuncType
- type OnVoiceServerUpdateFuncType
- type OnVoiceStateUpdateFuncType
- type OnWebhookUpdateFuncType
- type Sandwich
- func (sandwich *Sandwich) DispatchGRPCPayload(ctx context.Context, payload sandwich_structs.SandwichPayload)
- func (sandwich *Sandwich) DispatchSandwichPayload(ctx context.Context, payload sandwich_structs.SandwichPayload) error
- func (sandwich *Sandwich) FetchIdentifier(ctx context.Context, applicationName string) (identifier *sandwich_structs.ManagerConsumerConfiguration, ok bool, err error)
- func (sandwich *Sandwich) ListenToChannel(ctx context.Context, channel chan []byte) error
- func (sandwich *Sandwich) RecoverEventPanic(errorValue interface{}, eventCtx *EventContext, ...)
- func (sandwich *Sandwich) RegisterBot(identifier string, bot *Bot)
- func (sandwich *Sandwich) SetErrorOnInvalidIdentifier(value bool)
Constants ¶
const (
DiscordEventError = "ERROR"
)
const VERSION = "0.6.1"
VERSION follows semantic versioning.
Variables ¶
var ( ErrInvalidIdentifier = errors.New("payload does not include a valid identifier") ErrInvalidApplication = errors.New("could not find identifier matching application") ErrInvalidToken = errors.New("invalid token was passed") ErrUnknownEvent = errors.New("event type does not have a handler") ErrUnknownGRPCError = errors.New("grpc returned unknown error") ErrCogAlreadyRegistered = errors.New("cog with this name already exists") ErrFetchMissingGuild = errors.New("object requires guild ID to fetch") ErrFetchMissingSnowflake = errors.New("object requires snowflake to fetch") ErrMemberNotFound = errors.New("member provided was not found") ErrUserNotFound = errors.New("user provided was not found") ErrChannelNotFound = errors.New("channel provided was not found") ErrGuildNotFound = errors.New("guild provided was not found") ErrRoleNotFound = errors.New("role provided was not found") ErrEmojiNotFound = errors.New("emoji provided was not found") ErrBadWebhookArgument = errors.New("webhook url provided was not in valid format") )
var LastRequestTimeout = time.Minute * 60
var WebhookURLRegex = regexp.MustCompile("discord(?:app)?.com/api/webhooks/(?P<id>[0-9]{17,20})/(?P<token>[A-Za-z0-9._-]{60,68})")
Functions ¶
func FetchChannel ¶
func FetchEmoji ¶
func FetchGuild ¶
func FetchGuildMember ¶
func FetchGuildMember(ctx *GRPCContext, guildMember *discord.GuildMember) (*discord.GuildMember, error)
func NewChannel ¶
func NewGuildMember ¶
NewGuildMember creates a new partial guild member. Use Fetch() to populate the member.
func NewWebhook ¶
func NewWebhook(id discord.Snowflake, token string, webhookType discord.WebhookType) *discord.Webhook
NewWebhook creates a partial webhook. Use Fetch() to populate the webhook.
func OnApplicationCommandCreate ¶
func OnApplicationCommandCreate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnApplicationCommandCreate.
func OnApplicationCommandDelete ¶
func OnApplicationCommandDelete(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnApplicationCommandDelete.
func OnApplicationCommandUpdate ¶
func OnApplicationCommandUpdate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnApplicationCommandUpdate.
func OnChannelCreate ¶
func OnChannelCreate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnChannelCreate.
func OnChannelDelete ¶
func OnChannelDelete(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnChannelDelete.
func OnChannelPinsUpdate ¶
func OnChannelPinsUpdate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnChannelPinsUpdate.
func OnChannelUpdate ¶
func OnChannelUpdate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnChannelUpdate.
func OnGuildAvailable ¶
func OnGuildAvailable(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnGuildAvailable.
func OnGuildBanAdd ¶
func OnGuildBanAdd(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnGuildBanAdd.
func OnGuildBanRemove ¶
func OnGuildBanRemove(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnGuildBanRemove.
func OnGuildCreate ¶
func OnGuildCreate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnGuildCreate.
func OnGuildDelete ¶
func OnGuildDelete(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnGuildDelete.
func OnGuildEmojisUpdate ¶
func OnGuildEmojisUpdate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnGuildEmojisUpdate.
func OnGuildIntegrationsUpdate ¶
func OnGuildIntegrationsUpdate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnGuildIntegrationsUpdate.
func OnGuildJoin ¶
func OnGuildJoin(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnGuildJoin.
func OnGuildLeave ¶
func OnGuildLeave(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnGuildLeave.
func OnGuildMemberAdd ¶
func OnGuildMemberAdd(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnGuildMemberAdd.
func OnGuildMemberRemove ¶
func OnGuildMemberRemove(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnGuildMemberRemove.
func OnGuildMemberUpdate ¶
func OnGuildMemberUpdate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnGuildMemberUpdate.
func OnGuildRoleCreate ¶
func OnGuildRoleCreate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnGuildRoleCreate.
func OnGuildRoleDelete ¶
func OnGuildRoleDelete(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnGuildRoleDelete.
func OnGuildRoleUpdate ¶
func OnGuildRoleUpdate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnGuildRoleUpdate.
func OnGuildStickersUpdate ¶
func OnGuildStickersUpdate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnGuildStickersUpdate.
func OnGuildUnavailable ¶
func OnGuildUnavailable(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnGuildUnavailable.
func OnGuildUpdate ¶
func OnGuildUpdate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnGuildUpdate.
func OnIntegrationCreate ¶
func OnIntegrationCreate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnIntegrationCreate.
func OnIntegrationDelete ¶
func OnIntegrationDelete(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnIntegrationDelete.
func OnIntegrationUpdate ¶
func OnIntegrationUpdate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnIntegrationUpdate.
func OnInteractionCreate ¶
func OnInteractionCreate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnInteractionCreate.
func OnInviteCreate ¶
func OnInviteCreate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnInviteCreate.
func OnInviteDelete ¶
func OnInviteDelete(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnInviteDelete.
func OnMessageCreate ¶
func OnMessageCreate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnMessageCreate.
func OnMessageDelete ¶
func OnMessageDelete(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnMessageDelete.
func OnMessageDeleteBulk ¶
func OnMessageDeleteBulk(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnMessageDeleteBulk.
func OnMessageReactionAdd ¶
func OnMessageReactionAdd(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnMessageReactionAdd.
func OnMessageReactionRemove ¶
func OnMessageReactionRemove(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnMessageReactionRemove.
func OnMessageReactionRemoveAll ¶
func OnMessageReactionRemoveAll(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnMessageReactionRemoveAll.
func OnMessageReactionRemoveEmoji ¶
func OnMessageReactionRemoveEmoji(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnMessageReactionRemoveEmoji.
func OnMessageUpdate ¶
func OnMessageUpdate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnMessageUpdate.
func OnPresenceUpdate ¶
func OnPresenceUpdate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnPresenceUpdate.
func OnReady ¶
func OnReady(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnReady.
func OnResumed ¶
func OnResumed(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnResumed.
func OnSandwichConfigurationReload ¶
func OnSandwichConfigurationReload(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnSandwichConfigurationReload.
func OnSandwichShardGroupStatusUpdate ¶
func OnSandwichShardGroupStatusUpdate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnSandwichShardGroupStatusUpdate.
func OnSandwichShardStatusUpdate ¶
func OnSandwichShardStatusUpdate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnSandwichShardStatusUpdate.
func OnStageInstanceCreate ¶
func OnStageInstanceCreate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnStageInstanceCreate.
func OnStageInstanceDelete ¶
func OnStageInstanceDelete(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnStageInstanceDelete.
func OnStageInstanceUpdate ¶
func OnStageInstanceUpdate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnStageInstanceUpdate.
func OnThreadCreate ¶
func OnThreadCreate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnThreadCreate.
func OnThreadDelete ¶
func OnThreadDelete(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnThreadDelete.
func OnThreadMemberUpdate ¶
func OnThreadMemberUpdate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnThreadMemberUpdate.
func OnThreadMembersUpdate ¶
func OnThreadMembersUpdate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnThreadMembersUpdate.
func OnThreadUpdate ¶
func OnThreadUpdate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnThreadUpdate.
func OnTypingStart ¶
func OnTypingStart(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnTypingStart.
func OnUserUpdate ¶
func OnUserUpdate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnUserUpdate.
func OnVoiceServerUpdate ¶
func OnVoiceServerUpdate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnVoiceServerUpdate.
func OnVoiceStateUpdate ¶
func OnVoiceStateUpdate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnVoiceStateUpdate.
func OnWebhookUpdate ¶
func OnWebhookUpdate(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
OnWebhookUpdate.
Types ¶
type Cog ¶
Cog is the basic interface for any cog. This must provide information about the cog such as its name and description.
type CogWithBotLoad ¶
type CogWithBotLoad interface {
BotLoad(bot *Bot)
}
CogWithBotLoad is an interface for any cog that implements methods that run when a bot loads.
type CogWithBotUnload ¶
CogWithBotUnload is an interface for any cog that implements methods that run when a bot unloads.
type CogWithEvents ¶
type CogWithEvents interface {
GetEventHandlers() *Handlers
}
CogWithEvents is an interface for any cog that implements custom event listeners.
type DefaultGRPCClient ¶
type DefaultGRPCClient struct{}
func (*DefaultGRPCClient) FetchChannelByID ¶
func (grpcClient *DefaultGRPCClient) FetchChannelByID(grpcContext *GRPCContext, guildID discord.Snowflake, channelID discord.Snowflake) (channel discord.Channel, err error)
func (*DefaultGRPCClient) FetchChannelsByName ¶
func (grpcClient *DefaultGRPCClient) FetchChannelsByName(grpcContext *GRPCContext, guildID discord.Snowflake, query string) (channels []discord.Channel, err error)
func (*DefaultGRPCClient) FetchConsumerConfiguration ¶
func (grpcClient *DefaultGRPCClient) FetchConsumerConfiguration(grpcContext *GRPCContext, identifier string) (identifiers sandwich_structs.SandwichConsumerConfiguration, err error)
func (*DefaultGRPCClient) FetchEmojiByID ¶
func (grpcClient *DefaultGRPCClient) FetchEmojiByID(grpcContext *GRPCContext, guildID discord.Snowflake, emojiID discord.Snowflake) (emoji discord.Emoji, err error)
func (*DefaultGRPCClient) FetchEmojisByName ¶
func (grpcClient *DefaultGRPCClient) FetchEmojisByName(grpcContext *GRPCContext, guildID discord.Snowflake, query string) (emojis []discord.Emoji, err error)
func (*DefaultGRPCClient) FetchGuildByID ¶
func (grpcClient *DefaultGRPCClient) FetchGuildByID(grpcContext *GRPCContext, guildID discord.Snowflake) (guild discord.Guild, err error)
func (*DefaultGRPCClient) FetchGuildsByName ¶
func (grpcClient *DefaultGRPCClient) FetchGuildsByName(grpcContext *GRPCContext, query string) (guilds []discord.Guild, err error)
func (*DefaultGRPCClient) FetchMemberByID ¶
func (grpcClient *DefaultGRPCClient) FetchMemberByID(grpcContext *GRPCContext, guildID discord.Snowflake, memberID discord.Snowflake) (member discord.GuildMember, err error)
func (*DefaultGRPCClient) FetchMembersByID ¶
func (grpcClient *DefaultGRPCClient) FetchMembersByID(grpcContext *GRPCContext, guildID discord.Snowflake, memberIDs []discord.Snowflake) (members []discord.GuildMember, err error)
func (*DefaultGRPCClient) FetchMembersByName ¶
func (grpcClient *DefaultGRPCClient) FetchMembersByName(grpcContext *GRPCContext, guildID discord.Snowflake, query string) (members []discord.GuildMember, err error)
func (*DefaultGRPCClient) FetchMutualGuilds ¶
func (grpcClient *DefaultGRPCClient) FetchMutualGuilds(grpcContext *GRPCContext, userID discord.Snowflake, expand bool) (guilds []discord.Guild, err error)
func (*DefaultGRPCClient) FetchRoleByID ¶
func (grpcClient *DefaultGRPCClient) FetchRoleByID(grpcContext *GRPCContext, guildID discord.Snowflake, roleID discord.Snowflake) (role discord.Role, err error)
func (*DefaultGRPCClient) FetchRolesByName ¶
func (grpcClient *DefaultGRPCClient) FetchRolesByName(grpcContext *GRPCContext, guildID discord.Snowflake, query string) (roles []discord.Role, err error)
func (*DefaultGRPCClient) FetchUserByID ¶
func (grpcClient *DefaultGRPCClient) FetchUserByID(grpcContext *GRPCContext, token string, userID discord.Snowflake, createDMChannel bool) (user discord.User, err error)
func (*DefaultGRPCClient) FetchUserByName ¶
func (grpcClient *DefaultGRPCClient) FetchUserByName(grpcContext *GRPCContext, token string, query string, createDMChannel bool) (users []discord.User, err error)
func (*DefaultGRPCClient) Listen ¶
func (grpcClient *DefaultGRPCClient) Listen(grpcContext *GRPCContext, identifier string) (client sandwich_protobuf.Sandwich_ListenClient, err error)
func (*DefaultGRPCClient) PostAnalytics ¶
func (grpcClient *DefaultGRPCClient) PostAnalytics(grpcContext *GRPCContext, identifier string, data []byte) error
func (*DefaultGRPCClient) RequestGuildChunk ¶
func (grpcClient *DefaultGRPCClient) RequestGuildChunk(grpcContext *GRPCContext, guildID discord.Snowflake) error
func (*DefaultGRPCClient) SendWebsocketMessage ¶
func (grpcClient *DefaultGRPCClient) SendWebsocketMessage(grpcContext *GRPCContext, location Location, op int32, data []byte) error
func (*DefaultGRPCClient) WhereIsGuild ¶
func (grpcClient *DefaultGRPCClient) WhereIsGuild(grpcContext *GRPCContext, guildID discord.Snowflake) (locations []Location_GuildMember, err error)
type EventContext ¶
type EventContext struct { context.Context Logger zerolog.Logger Sandwich *Sandwich Session *discord.Session // Filled in on dispatch EventHandler *EventHandler Handlers *Handlers Identifier *sandwich_structs.ManagerConsumerConfiguration Guild *discord.Guild Payload *sandwich_structs.SandwichPayload }
EventContext is extra data passed to event handlers. This is not the same as a command's context.
func (*EventContext) DecodeContent ¶
func (eventCtx *EventContext) DecodeContent(msg sandwich_structs.SandwichPayload, out interface{}) error
func (*EventContext) DecodeExtra ¶
func (eventCtx *EventContext) DecodeExtra(msg sandwich_structs.SandwichPayload, key string, out interface{}) (ok bool, err error)
func (*EventContext) ToGRPCContext ¶
func (eventCtx *EventContext) ToGRPCContext() *GRPCContext
func (*EventContext) Trace ¶
func (eventCtx *EventContext) Trace() sandwich_structs.SandwichTrace
type EventHandler ¶
type EventHandler struct { EventsMu sync.RWMutex Events []interface{} Parser EventParser // contains filtered or unexported fields }
type EventParser ¶
type EventParser func(eventCtx *EventContext, payload sandwich_structs.SandwichPayload) error
type GRPC ¶
type GRPC interface { Listen(grpcContext *GRPCContext, identifier string) (client sandwich_protobuf.Sandwich_ListenClient, err error) PostAnalytics(grpcContext *GRPCContext, identifier string, data []byte) error FetchGuildByID(grpcContext *GRPCContext, guildID discord.Snowflake) (guild discord.Guild, err error) FetchGuildsByName(grpcContext *GRPCContext, query string) (guilds []discord.Guild, err error) FetchChannelByID(grpcContext *GRPCContext, guildID discord.Snowflake, channelID discord.Snowflake) (channel discord.Channel, err error) FetchChannelsByName(grpcContext *GRPCContext, guildID discord.Snowflake, query string) (channels []discord.Channel, err error) FetchRoleByID(grpcContext *GRPCContext, guildID discord.Snowflake, roleID discord.Snowflake) (role discord.Role, err error) FetchRolesByName(grpcContext *GRPCContext, guildID discord.Snowflake, query string) (roles []discord.Role, err error) FetchEmojiByID(grpcContext *GRPCContext, guildID discord.Snowflake, emojiID discord.Snowflake) (emoji discord.Emoji, err error) FetchEmojisByName(grpcContext *GRPCContext, guildID discord.Snowflake, query string) (emojis []discord.Emoji, err error) FetchMemberByID(grpcContext *GRPCContext, guildID discord.Snowflake, memberID discord.Snowflake) (member discord.GuildMember, err error) FetchMembersByID(grpcContext *GRPCContext, guildID discord.Snowflake, memberIDs []discord.Snowflake) (members []discord.GuildMember, err error) FetchMembersByName(grpcContext *GRPCContext, guildID discord.Snowflake, query string) (members []discord.GuildMember, err error) FetchUserByID(grpcContext *GRPCContext, token string, userID discord.Snowflake, createDMChannel bool) (user discord.User, err error) FetchUserByName(grpcContext *GRPCContext, token string, query string, createDMChannel bool) (users []discord.User, err error) FetchConsumerConfiguration(grpcContext *GRPCContext, identifier string) (identifiers sandwich_structs.SandwichConsumerConfiguration, err error) FetchMutualGuilds(grpcContext *GRPCContext, userID discord.Snowflake, expand bool) (guilds []discord.Guild, err error) RequestGuildChunk(grpcContext *GRPCContext, guildID discord.Snowflake) error SendWebsocketMessage(grpcContext *GRPCContext, location Location, op int32, data []byte) error WhereIsGuild(grpcContext *GRPCContext, guildID discord.Snowflake) (locations []Location_GuildMember, err error) }
func NewDefaultGRPCClient ¶
func NewDefaultGRPCClient() (grpcClient GRPC)
type GRPCContext ¶
type GRPCContext struct { context.Context Logger zerolog.Logger SandwichClient sandwich_protobuf.SandwichClient GRPCInterface GRPC Session *discord.Session Identifier *sandwich_structs.ManagerConsumerConfiguration }
type Handlers ¶
type Handlers struct { EventHandlers map[string]*EventHandler // contains filtered or unexported fields }
func SetupHandler ¶
SetupHandler ensures all nullable variables are properly constructed.
func (*Handlers) Dispatch ¶
func (h *Handlers) Dispatch(eventCtx *EventContext, payload sandwich_structs.SandwichPayload)
Dispatch dispatches a payload. All dispatched events will be sent through a goroutine, so no errors are returned.
func (*Handlers) DispatchType ¶
func (h *Handlers) DispatchType(eventCtx *EventContext, eventName string, payload sandwich_structs.SandwichPayload) error
DispatchType is similar to Dispatch however a custom event name can. be passed, preserving the original payload.
func (*Handlers) RegisterEvent ¶
func (h *Handlers) RegisterEvent(eventName string, parser EventParser, event interface{}) *EventHandler
func (*Handlers) RegisterEventHandler ¶
func (h *Handlers) RegisterEventHandler(eventName string, parser EventParser) *EventHandler
RegisterEventHandler adds a new event handler. If there is already an event registered with the name, it is overridden.
func (*Handlers) RegisterOnApplicationCommandCreateEvent ¶
func (h *Handlers) RegisterOnApplicationCommandCreateEvent(event OnApplicationCommandCreateFuncType)
RegisterOnApplicationCommandCreateEvent adds a new event handler for the APPLICATION_COMMAND_CREATE event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnApplicationCommandDeleteEvent ¶
func (h *Handlers) RegisterOnApplicationCommandDeleteEvent(event OnApplicationCommandDeleteFuncType)
RegisterOnApplicationCommandDeleteEvent adds a new event handler for the APPLICATION_COMMAND_DELETE event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnApplicationCommandUpdateEvent ¶
func (h *Handlers) RegisterOnApplicationCommandUpdateEvent(event OnApplicationCommandUpdateFuncType)
RegisterOnApplicationCommandUpdateEvent adds a new event handler for the APPLICATION_COMMAND_UPDATE event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnChannelCreateEvent ¶
func (h *Handlers) RegisterOnChannelCreateEvent(event OnChannelCreateFuncType)
RegisterOnChannelCreateEvent adds a new event handler for the CHANNEL_CREATE event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnChannelDeleteEvent ¶
func (h *Handlers) RegisterOnChannelDeleteEvent(event OnChannelDeleteFuncType)
RegisterOnChannelDeleteEvent adds a new event handler for the CHANNEL_DELETE event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnChannelPinsUpdateEvent ¶
func (h *Handlers) RegisterOnChannelPinsUpdateEvent(event OnChannelPinsUpdateFuncType)
RegisterOnChannelPinsUpdateEvent adds a new event handler for the CHANNEL_PINS_UPDATE event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnChannelUpdateEvent ¶
func (h *Handlers) RegisterOnChannelUpdateEvent(event OnChannelUpdateFuncType)
RegisterOnChannelUpdateEvent adds a new event handler for the CHANNEL_UPDATE event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnError ¶
func (h *Handlers) RegisterOnError(event OnErrorFuncType)
RegisterOnError registers a handler when events raise an error. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnGuildAvailableEvent ¶
func (h *Handlers) RegisterOnGuildAvailableEvent(event OnGuildAvailableFuncType)
RegisterOnGuildAvailableEvent adds a new event handler for the GUILD_AVAILABLE event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnGuildBanAddEvent ¶
func (h *Handlers) RegisterOnGuildBanAddEvent(event OnGuildBanAddFuncType)
RegisterOnGuildBanAddEvent adds a new event handler for the GUILD_BAN_ADD event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnGuildBanRemoveEvent ¶
func (h *Handlers) RegisterOnGuildBanRemoveEvent(event OnGuildBanRemoveFuncType)
RegisterOnGuildBanRemoveEvent adds a new event handler for the GUILD_BAN_REMOVE event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnGuildEmojisUpdateEvent ¶
func (h *Handlers) RegisterOnGuildEmojisUpdateEvent(event OnGuildEmojisUpdateFuncType)
RegisterOnGuildEmojisUpdateEvent adds a new event handler for the GUILD_EMOJIS_UPDATE event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnGuildIntegrationsUpdateEvent ¶
func (h *Handlers) RegisterOnGuildIntegrationsUpdateEvent(event OnGuildIntegrationsUpdateFuncType)
RegisterOnGuildIntegrationsUpdateEvent adds a new event handler for the GUILD_INTEGRATIONS_UPDATE event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnGuildJoinEvent ¶
func (h *Handlers) RegisterOnGuildJoinEvent(event OnGuildJoinFuncType)
RegisterOnGuildJoinEvent adds a new event handler for the GUILD_JOIN event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnGuildLeaveEvent ¶
func (h *Handlers) RegisterOnGuildLeaveEvent(event OnGuildLeaveFuncType)
RegisterOnGuildLeaveEvent adds a new event handler for the GUILD_LEAVE event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnGuildMemberAddEvent ¶
func (h *Handlers) RegisterOnGuildMemberAddEvent(event OnGuildMemberAddFuncType)
RegisterOnGuildMemberAddEvent adds a new event handler for the GUILD_MEMBER_ADD event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnGuildMemberRemoveEvent ¶
func (h *Handlers) RegisterOnGuildMemberRemoveEvent(event OnGuildMemberRemoveFuncType)
RegisterOnGuildMemberRemoveEvent adds a new event handler for the GUILD_MEMBER_REMOVE event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnGuildMemberUpdateEvent ¶
func (h *Handlers) RegisterOnGuildMemberUpdateEvent(event OnGuildMemberUpdateFuncType)
RegisterOnGuildMemberUpdateEvent adds a new event handler for the GUILD_MEMBER_UPDATE event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnGuildRoleCreateEvent ¶
func (h *Handlers) RegisterOnGuildRoleCreateEvent(event OnGuildRoleCreateFuncType)
RegisterOnGuildRoleCreateEvent adds a new event handler for the GUILD_ROLE_CREATE event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnGuildRoleDeleteEvent ¶
func (h *Handlers) RegisterOnGuildRoleDeleteEvent(event OnGuildRoleDeleteFuncType)
RegisterOnGuildRoleDeleteEvent adds a new event handler for the GUILD_ROLE_DELETE event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnGuildRoleUpdateEvent ¶
func (h *Handlers) RegisterOnGuildRoleUpdateEvent(event OnGuildRoleUpdateFuncType)
RegisterOnGuildRoleUpdateEvent adds a new event handler for the GUILD_ROLE_UPDATE event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnGuildStickersUpdateEvent ¶
func (h *Handlers) RegisterOnGuildStickersUpdateEvent(event OnGuildStickersUpdateFuncType)
RegisterOnGuildStickersUpdateEvent adds a new event handler for the GUILD_STICKERS_UPDATE event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnGuildUnavailableEvent ¶
func (h *Handlers) RegisterOnGuildUnavailableEvent(event OnGuildUnavailableFuncType)
RegisterOnGuildUnavailableEvent adds a new event handler for the GUILD_UNAVAILABLE event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnGuildUpdateEvent ¶
func (h *Handlers) RegisterOnGuildUpdateEvent(event OnGuildUpdateFuncType)
RegisterOnGuildUpdateEvent adds a new event handler for the GUILD_UPDATE event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnIntegrationCreateEvent ¶
func (h *Handlers) RegisterOnIntegrationCreateEvent(event OnIntegrationCreateFuncType)
RegisterOnIntegrationCreateEvent adds a new event handler for the INTEGRATION_CREATE event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnIntegrationDeleteEvent ¶
func (h *Handlers) RegisterOnIntegrationDeleteEvent(event OnIntegrationDeleteFuncType)
RegisterOnIntegrationDeleteEvent adds a new event handler for the INTEGRATION_DELETE event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnIntegrationUpdateEvent ¶
func (h *Handlers) RegisterOnIntegrationUpdateEvent(event OnIntegrationUpdateFuncType)
RegisterOnIntegrationUpdateEvent adds a new event handler for the INTEGRATION_UPDATE event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnInteractionCreateEvent ¶
func (h *Handlers) RegisterOnInteractionCreateEvent(event OnInteractionCreateFuncType)
RegisterOnInteractionCreateEvent adds a new event handler for the INTERACTION_CREATE event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnInviteCreateEvent ¶
func (h *Handlers) RegisterOnInviteCreateEvent(event OnInviteCreateFuncType)
RegisterOnInviteCreateEvent adds a new event handler for the INVITE_CREATE event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnInviteDeleteEvent ¶
func (h *Handlers) RegisterOnInviteDeleteEvent(event OnInviteDeleteFuncType)
RegisterOnInviteDeleteEvent adds a new event handler for the INVITE_DELETE event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnMessageCreateEvent ¶
func (h *Handlers) RegisterOnMessageCreateEvent(event OnMessageCreateFuncType)
RegisterOnMessageCreateEvent adds a new event handler for the MESSAGE_CREATE event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnMessageDeleteBulkEvent ¶
func (h *Handlers) RegisterOnMessageDeleteBulkEvent(event OnMessageDeleteBulkFuncType)
RegisterOnMessageDeleteBulkEvent adds a new event handler for the MESSAGE_DELETE_BULK event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnMessageDeleteEvent ¶
func (h *Handlers) RegisterOnMessageDeleteEvent(event OnMessageDeleteFuncType)
RegisterOnMessageDeleteEvent adds a new event handler for the MESSAGE_DELETE event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnMessageReactionAddEvent ¶
func (h *Handlers) RegisterOnMessageReactionAddEvent(event OnMessageReactionAddFuncType)
RegisterOnMessageReactionAddEvent adds a new event handler for the MESSAGE_REACTION_ADD event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnMessageReactionRemoveAllEvent ¶
func (h *Handlers) RegisterOnMessageReactionRemoveAllEvent(event OnMessageReactionRemoveAllFuncType)
RegisterOnMessageReactionRemoveAllEvent adds a new event handler for the MESSAGE_REACTION_REMOVE_ALL event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnMessageReactionRemoveEmojiEvent ¶
func (h *Handlers) RegisterOnMessageReactionRemoveEmojiEvent(event OnMessageReactionRemoveEmojiFuncType)
RegisterOnMessageReactionRemoveEmojiEvent adds a new event handler for the MESSAGE_REACTION_REMOVE_EMOJI event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnMessageReactionRemoveEvent ¶
func (h *Handlers) RegisterOnMessageReactionRemoveEvent(event OnMessageReactionRemoveFuncType)
RegisterOnMessageReactionRemoveEvent adds a new event handler for the MESSAGE_REACTION_REMOVE event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnMessageUpdateEvent ¶
func (h *Handlers) RegisterOnMessageUpdateEvent(event OnMessageUpdateFuncType)
RegisterOnMessageUpdateEvent adds a new event handler for the MESSAGE_UPDATE event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnPresenceUpdateEvent ¶
func (h *Handlers) RegisterOnPresenceUpdateEvent(event OnPresenceUpdateFuncType)
RegisterOnPresenceUpdateEvent adds a new event handler for the PRESENCE_UPDATE event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnReadyEvent ¶
func (h *Handlers) RegisterOnReadyEvent(event OnReadyFuncType)
RegisterOnReadyEvent adds a new event handler for the READY event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnResumedEvent ¶
func (h *Handlers) RegisterOnResumedEvent(event OnResumedFuncType)
RegisterOnResumedEvent adds a new event handler for the RESUMED event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnSandwichConfigurationReload ¶
func (h *Handlers) RegisterOnSandwichConfigurationReload(event OnSandwichConfigurationReloadFuncType)
RegisterOnSandwichConfigurationReload adds a new event handler for the SW_CONFIGURATION_RELOAD event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnSandwichShardGroupStatusUpdate ¶
func (h *Handlers) RegisterOnSandwichShardGroupStatusUpdate(event OnSandwichShardGroupStatusUpdateFuncType)
RegisterOnSandwichShardGroupStatusUpdate adds a new event handler for the SW_SHARD_GROUP_STATUS_UPDATE event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnSandwichShardStatusUpdate ¶
func (h *Handlers) RegisterOnSandwichShardStatusUpdate(event OnSandwichShardStatusUpdateFuncType)
RegisterOnSandwichShardStatusUpdate adds a new event handler for the SW_SHARD_STATUS_UPDATE event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnStageInstanceCreateEvent ¶
func (h *Handlers) RegisterOnStageInstanceCreateEvent(event OnStageInstanceCreateFuncType)
RegisterOnStageInstanceCreateEvent adds a new event handler for the STAGE_INSTANCE_CREATE event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnStageInstanceDeleteEvent ¶
func (h *Handlers) RegisterOnStageInstanceDeleteEvent(event OnStageInstanceDeleteFuncType)
RegisterOnStageInstanceDeleteEvent adds a new event handler for the STAGE_INSTANCE_DELETE event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnStageInstanceUpdateEvent ¶
func (h *Handlers) RegisterOnStageInstanceUpdateEvent(event OnStageInstanceUpdateFuncType)
RegisterOnStageInstanceUpdateEvent adds a new event handler for the STAGE_INSTANCE_UPDATE event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnThreadCreateEvent ¶
func (h *Handlers) RegisterOnThreadCreateEvent(event OnThreadCreateFuncType)
RegisterOnThreadCreateEvent adds a new event handler for the THREAD_CREATE event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnThreadDeleteEvent ¶
func (h *Handlers) RegisterOnThreadDeleteEvent(event OnThreadDeleteFuncType)
RegisterOnThreadDeleteEvent adds a new event handler for the THREAD_DELETE event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnThreadMemberUpdateEvent ¶
func (h *Handlers) RegisterOnThreadMemberUpdateEvent(event OnThreadMemberUpdateFuncType)
RegisterOnThreadMemberUpdateEvent adds a new event handler for the THREAD_MEMBER_UPDATE event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnThreadMembersUpdateEvent ¶
func (h *Handlers) RegisterOnThreadMembersUpdateEvent(event OnThreadMembersUpdateFuncType)
RegisterOnThreadMembersUpdateEvent adds a new event handler for the THREAD_MEMBERS_UPDATE event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnThreadUpdateEvent ¶
func (h *Handlers) RegisterOnThreadUpdateEvent(event OnThreadUpdateFuncType)
RegisterOnThreadUpdateEvent adds a new event handler for the THREAD_UPDATE event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnTypingStartEvent ¶
func (h *Handlers) RegisterOnTypingStartEvent(event OnTypingStartFuncType)
RegisterOnTypingStartEvent adds a new event handler for the TYPING_START event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnUserUpdateEvent ¶
func (h *Handlers) RegisterOnUserUpdateEvent(event OnUserUpdateFuncType)
RegisterOnUserUpdateEvent adds a new event handler for the USER_UPDATE event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnVoiceServerUpdateEvent ¶
func (h *Handlers) RegisterOnVoiceServerUpdateEvent(event OnVoiceServerUpdateFuncType)
RegisterOnVoiceServerUpdateEvent adds a new event handler for the VOICE_SERVER_UPDATE event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnVoiceStateUpdateEvent ¶
func (h *Handlers) RegisterOnVoiceStateUpdateEvent(event OnVoiceStateUpdateFuncType)
RegisterOnVoiceStateUpdateEvent adds a new event handler for the VOICE_STATE_UPDATE event. It does not override a handler and instead will add another handler.
func (*Handlers) RegisterOnWebhookUpdateEvent ¶
func (h *Handlers) RegisterOnWebhookUpdateEvent(event OnWebhookUpdateFuncType)
RegisterOnWebhookUpdateEvent adds a new event handler for the WEBHOOKS_UPDATE event. It does not override a handler and instead will add another handler.
func (*Handlers) WrapFuncType ¶
func (h *Handlers) WrapFuncType(eventCtx *EventContext, funcTypeErr error) error
WrapFuncType handles the error of a FuncType if it returns an error. It will call any ERROR handlers. Errors that occur in the ERROR handler will not trigger the ERROR handler.
type Location_GuildMember ¶
type Location_GuildMember struct { Location GuildMember discord.GuildMember }
type MQClient ¶
type MQClient interface { String() string Channel() string Connect(ctx context.Context, clientName string, args map[string]interface{}) error Subscribe(ctx context.Context, channel string) error Unsubscribe(ctx context.Context) Chan() chan []byte }
func NewMQClient ¶
type OnApplicationCommandCreateFuncType ¶
type OnApplicationCommandCreateFuncType func(eventCtx *EventContext, command discord.ApplicationCommand) error
type OnApplicationCommandDeleteFuncType ¶
type OnApplicationCommandDeleteFuncType func(eventCtx *EventContext, command discord.ApplicationCommand) error
type OnApplicationCommandUpdateFuncType ¶
type OnApplicationCommandUpdateFuncType func(eventCtx *EventContext, command discord.ApplicationCommand) error
type OnChannelCreateFuncType ¶
type OnChannelCreateFuncType func(eventCtx *EventContext, channel discord.Channel) error
type OnChannelDeleteFuncType ¶
type OnChannelDeleteFuncType func(eventCtx *EventContext, channel discord.Channel) error
type OnChannelUpdateFuncType ¶
type OnErrorFuncType ¶
type OnErrorFuncType func(eventCtx *EventContext, eventErr error) error
type OnGuildAvailableFuncType ¶
type OnGuildAvailableFuncType func(eventCtx *EventContext, guild discord.Guild) error
type OnGuildBanAddFuncType ¶
type OnGuildBanAddFuncType func(eventCtx *EventContext, user discord.User) error
type OnGuildBanRemoveFuncType ¶
type OnGuildBanRemoveFuncType func(eventCtx *EventContext, user discord.User) error
type OnGuildIntegrationsUpdateFuncType ¶
type OnGuildIntegrationsUpdateFuncType func(eventCtx *EventContext) error
type OnGuildJoinFuncType ¶
type OnGuildJoinFuncType func(eventCtx *EventContext, guild discord.Guild) error
type OnGuildLeaveFuncType ¶
type OnGuildLeaveFuncType func(eventCtx *EventContext, unavailableGuild discord.UnavailableGuild) error
type OnGuildMemberAddFuncType ¶
type OnGuildMemberAddFuncType func(eventCtx *EventContext, member discord.GuildMember) error
type OnGuildMemberRemoveFuncType ¶
type OnGuildMemberRemoveFuncType func(eventCtx *EventContext, member discord.User) error
type OnGuildMemberUpdateFuncType ¶
type OnGuildMemberUpdateFuncType func(eventCtx *EventContext, before discord.GuildMember, after discord.GuildMember) error
type OnGuildRoleCreateFuncType ¶
type OnGuildRoleCreateFuncType func(eventCtx *EventContext, role discord.Role) error
type OnGuildRoleDeleteFuncType ¶
type OnGuildRoleDeleteFuncType func(eventCtx *EventContext, roleID discord.Snowflake) error
type OnGuildUnavailableFuncType ¶
type OnGuildUnavailableFuncType func(eventCtx *EventContext, unavailableGuild discord.UnavailableGuild) error
type OnGuildUpdateFuncType ¶
type OnIntegrationCreateFuncType ¶
type OnIntegrationCreateFuncType func(eventCtx *EventContext, integration discord.Integration) error
type OnIntegrationUpdateFuncType ¶
type OnIntegrationUpdateFuncType func(eventCtx *EventContext, before discord.Integration, after discord.Integration) error
type OnInteractionCreateFuncType ¶
type OnInteractionCreateFuncType func(eventCtx *EventContext, interaction discord.Interaction) error
type OnInviteCreateFuncType ¶
type OnInviteCreateFuncType func(eventCtx *EventContext, invite discord.Invite) error
type OnInviteDeleteFuncType ¶
type OnInviteDeleteFuncType func(eventCtx *EventContext, invite discord.Invite) error
type OnMessageCreateFuncType ¶
type OnMessageCreateFuncType func(eventCtx *EventContext, message discord.Message) error
type OnMessageDeleteFuncType ¶
type OnMessageReactionAddFuncType ¶
type OnMessageReactionAddFuncType func(eventCtx *EventContext, channel *discord.Channel, messageID discord.Snowflake, emoji discord.Emoji, guildMember discord.GuildMember) error
type OnMessageUpdateFuncType ¶
type OnPresenceUpdateFuncType ¶
type OnPresenceUpdateFuncType func(eventCtx *EventContext, user discord.User, payload discord.PresenceUpdate) error
type OnReadyFuncType ¶
type OnReadyFuncType func(eventCtx *EventContext) error
type OnResumedFuncType ¶
type OnResumedFuncType func(eventCtx *EventContext) error
type OnSandwichConfigurationReloadFuncType ¶
type OnSandwichConfigurationReloadFuncType func(eventCtx *EventContext) error
type OnSandwichShardGroupStatusUpdateFuncType ¶
type OnSandwichShardGroupStatusUpdateFuncType func(eventCtx *EventContext, manager string, shardGroup int32, status sandwich_structs.ShardGroupStatus) error
type OnSandwichShardStatusUpdateFuncType ¶
type OnSandwichShardStatusUpdateFuncType func(eventCtx *EventContext, manager string, shardGroup int32, shard int32, status sandwich_structs.ShardStatus) error
type OnStageInstanceCreateFuncType ¶
type OnStageInstanceCreateFuncType func(eventCtx *EventContext, stage discord.StageInstance) error
type OnStageInstanceDeleteFuncType ¶
type OnStageInstanceDeleteFuncType func(eventCtx *EventContext, stage discord.StageInstance) error
type OnStageInstanceUpdateFuncType ¶
type OnStageInstanceUpdateFuncType func(eventCtx *EventContext, stage discord.StageInstance) error
type OnThreadCreateFuncType ¶
type OnThreadCreateFuncType func(eventCtx *EventContext, thread discord.Channel) error
type OnThreadDeleteFuncType ¶
type OnThreadDeleteFuncType func(eventCtx *EventContext, thread discord.Channel) error
type OnThreadMemberUpdateFuncType ¶
type OnThreadMemberUpdateFuncType func(eventCtx *EventContext, thread *discord.Channel, user discord.ThreadMember) error
type OnThreadUpdateFuncType ¶
type OnTypingStartFuncType ¶
type OnTypingStartFuncType func(eventCtx *EventContext, channel *discord.Channel, member *discord.GuildMember, user *discord.User, timestamp time.Time) error
type OnUserUpdateFuncType ¶
type OnVoiceServerUpdateFuncType ¶
type OnVoiceServerUpdateFuncType func(eventCtx *EventContext, payload discord.VoiceServerUpdate) error
type OnVoiceStateUpdateFuncType ¶
type OnVoiceStateUpdateFuncType func(eventCtx *EventContext, member discord.GuildMember, before discord.VoiceState, after discord.VoiceState) error
type OnWebhookUpdateFuncType ¶
type OnWebhookUpdateFuncType func(eventCtx *EventContext, channel *discord.Channel) error
type Sandwich ¶
type Sandwich struct { Logger zerolog.Logger Bots map[string]*Bot SandwichEvents *Handlers Identifiers map[string]*sandwich_structs.ManagerConsumerConfiguration LastIdentifierRequest map[string]time.Time RESTInterface discord.RESTInterface SandwichClient protobuf.SandwichClient GRPCInterface GRPC ErrorOnInvalidIdentifier bool // contains filtered or unexported fields }
func NewSandwich ¶
func NewSandwich(conn grpc.ClientConnInterface, restInterface discord.RESTInterface, logger io.Writer) *Sandwich
func (*Sandwich) DispatchGRPCPayload ¶
func (sandwich *Sandwich) DispatchGRPCPayload(ctx context.Context, payload sandwich_structs.SandwichPayload)
func (*Sandwich) DispatchSandwichPayload ¶
func (sandwich *Sandwich) DispatchSandwichPayload(ctx context.Context, payload sandwich_structs.SandwichPayload) error
func (*Sandwich) FetchIdentifier ¶
func (sandwich *Sandwich) FetchIdentifier(ctx context.Context, applicationName string) (identifier *sandwich_structs.ManagerConsumerConfiguration, ok bool, err error)
func (*Sandwich) ListenToChannel ¶
func (*Sandwich) RecoverEventPanic ¶
func (sandwich *Sandwich) RecoverEventPanic(errorValue interface{}, eventCtx *EventContext, payload *sandwich_structs.SandwichPayload)