micup

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: MIT Imports: 11 Imported by: 0

README

micup.go

Go Reference CI

micup.go is a standalone Go client for Micup bots, following the Fluxer API that Micup runs on. It covers:

  • Gateway: sessions that resume, replay unprocessed events and re-identify on the same socket; a shard manager for many shards in one process; optional zstd-stream compression; ignored events and presence; command pacing below Micup's limits.
  • Gateway commands: member requests, guild and channel member counts, Lazy Request subscriptions and voice state updates; every Micup dispatch event, including threads, calls, emojis, stickers and member lists, has a typed payload.
  • State: guilds with settings, emojis and stickers, channels and threads with permission overwrites, roles, member roles and voice states, with permission and role hierarchy checks.
  • REST: messages (send, edit, forward, crosspost, delete, bulk delete, list, search), buttons, select menus, modals and commands, reactions, pins, typing, DMs, files (multipart and presigned uploads), channels, threads and forums, roles, guild settings, members, invites, emojis, stickers, audit logs, bans, moderation and webhooks, with paging iterators, Micup's error codes and rate limit rules.
  • Routing: an interaction router for commands, autocomplete, components and modals, next to the typed event mux, and optional slog logging.
  • Helpers: mentions, timestamps, markdown escaping, an embed builder, media URLs, snowflake times and permission names.
  • Voice: the join handshake with fast refusal and permission checks, grant rotation, Opus publishing to LiveKit, and a player with FFmpeg sources, pause, skip and volume.

The module keeps platform transport separate from application behavior. It does not implement music search, queues, command syntax, persistence, or worker coordination.

Used in production

mitune.net, one of the largest music bots on Micup, runs on micup.go.

Requirements

  • Go 1.26.8 or newer
  • A Micup bot token
  • FFmpeg with libopus enabled when publishing voice audio

Install

go get github.com/yestefir/micup.go@v1.0.1

Quick start

import micup "github.com/yestefir/micup.go"

b, err := micup.New(ctx, micup.Config{Token: os.Getenv("MICUP_BOT_TOKEN")})
if err != nil {
	log.Fatal(err)
}

mux := micup.NewEventMux()
mux.On(micup.EventMessageCreate, micup.Listen(func(ctx context.Context, message micup.MessageCreate) error {
	if message.Author.Bot || message.Content != "!ping" {
		return nil
	}
	_, err := b.REST.SendMessage(ctx, message.ChannelID, "pong", message.ID)
	return err
}))

s, err := b.NewSession(micup.SessionOptions{Handler: mux.Handle})
if err != nil {
	log.Fatal(err)
}
err = s.Run(ctx)

Every event has a typed payload; see Events and typed payloads. Slash and context menu commands are registered over REST; see Commands.

Channels, roles, threads, invites, emojis and search are described in Channels, roles, threads and invites, and mentions, embeds and media URLs in Formatting.

Bots in many guilds use b.NewShardManager(micup.ShardOptions{ShardCount: 4, Session: options}) instead of b.NewSession. See Shards.

Public API

For a complete program with token validation and Ctrl+C shutdown, see the runnable ping bot.

Applications import only two paths:

Import Contains
github.com/yestefir/micup.go Everything: bot setup, REST, Gateway events, sessions, shards, state cache, payload types, errors
github.com/yestefir/micup.go/voice LiveKit room and PCM→Opus publishing (separate so bots without voice skip LiveKit and WebRTC)

Both are thin facades over src/. Code under src/ can be moved or split without changing these import paths or names; a test fails if a facade gains logic of its own.

See the guides for setup, Gateway events, voice publishing, security boundaries, and the v0.3 → v0.4 migration.

Repository layout

The implementation lives under src/, one package per domain:

micup.go       Public facade: package micup
events.go      Public facade: event names, payload types, event mux
voice/         Public facade: package voice
src/
  bot/         Entry point: discovery, bot identity, wiring for sessions and shards
  discovery/   /.well-known endpoint discovery and origin checks
  rest/        Authenticated REST client: channels, messages, interactions, users
  gateway/     Opcodes, close codes, event names, single-connection Gateway loop
  events/      Payload type per Gateway event, registry, typed decoding, event mux
  state/       Guild channel and voice state cache
  session/     Reconnecting, resuming session for one shard; voice join handshake
  shard/       Guild-to-shard mapping and multi-shard Manager
  model/       Domain types shared by REST and Gateway
  voice/       LiveKit room and PCM-to-Opus publishing
  internal/    Version, HTTP safety, test fixtures, layer and facade rules
docs/          User, API, architecture, and contributor guides

Package dependencies point one way and are enforced by a test; see Architecture. Go source files intentionally contain no comments.

Run make check before sending a change. CI runs the same checks on Linux, macOS and Windows.

License

This project is free to use under the MIT License, including in commercial projects. Keep the copyright and license notice with copies or substantial portions of the software.

The current release is v1.0.1. Release history is in CHANGELOG.md.

SessionOptions.TrackMembers / Session.MemberInventories(): maintained member inventories.

Documentation

Index

Examples

Constants

View Source
const (
	EventReady                     = gateway.EventReady
	EventResumed                   = gateway.EventResumed
	EventRateLimited               = gateway.EventRateLimited
	EventSessionsReplace           = gateway.EventSessionsReplace
	EventGatewayRolloutUpdate      = gateway.EventGatewayRolloutUpdate
	EventGuildCreate               = gateway.EventGuildCreate
	EventGuildSync                 = gateway.EventGuildSync
	EventGuildUpdate               = gateway.EventGuildUpdate
	EventGuildDelete               = gateway.EventGuildDelete
	EventGuildAuditLogEntryCreate  = gateway.EventGuildAuditLogEntryCreate
	EventGuildRoleCreate           = gateway.EventGuildRoleCreate
	EventGuildRoleUpdate           = gateway.EventGuildRoleUpdate
	EventGuildRoleUpdateBulk       = gateway.EventGuildRoleUpdateBulk
	EventGuildRoleDelete           = gateway.EventGuildRoleDelete
	EventGuildMemberAdd            = gateway.EventGuildMemberAdd
	EventGuildMemberUpdate         = gateway.EventGuildMemberUpdate
	EventGuildMemberRemove         = gateway.EventGuildMemberRemove
	EventGuildMembersChunk         = gateway.EventGuildMembersChunk
	EventGuildBanAdd               = gateway.EventGuildBanAdd
	EventGuildBanRemove            = gateway.EventGuildBanRemove
	EventChannelCreate             = gateway.EventChannelCreate
	EventChannelUpdate             = gateway.EventChannelUpdate
	EventChannelUpdateBulk         = gateway.EventChannelUpdateBulk
	EventChannelDelete             = gateway.EventChannelDelete
	EventChannelPinsUpdate         = gateway.EventChannelPinsUpdate
	EventMessageCreate             = gateway.EventMessageCreate
	EventMessageUpdate             = gateway.EventMessageUpdate
	EventMessageDelete             = gateway.EventMessageDelete
	EventMessageDeleteBulk         = gateway.EventMessageDeleteBulk
	EventReactionAdd               = gateway.EventReactionAdd
	EventReactionRemove            = gateway.EventReactionRemove
	EventReactionRemoveAll         = gateway.EventReactionRemoveAll
	EventReactionRemoveEmoji       = gateway.EventReactionRemoveEmoji
	EventUserUpdate                = gateway.EventUserUpdate
	EventPresenceUpdate            = gateway.EventPresenceUpdate
	EventTypingStart               = gateway.EventTypingStart
	EventInviteCreate              = gateway.EventInviteCreate
	EventInviteDelete              = gateway.EventInviteDelete
	EventWebhooksUpdate            = gateway.EventWebhooksUpdate
	EventInteractionCreate         = gateway.EventInteractionCreate
	EventApplicationCommandsUpdate = gateway.EventApplicationCommandsUpdate
	EventVoiceStateUpdate          = gateway.EventVoiceStateUpdate
	EventVoiceServerUpdate         = gateway.EventVoiceServerUpdate
)
View Source
const (
	EventGuildEmojisUpdate         = gateway.EventGuildEmojisUpdate
	EventGuildStickersUpdate       = gateway.EventGuildStickersUpdate
	EventGuildMemberListUpdate     = gateway.EventGuildMemberListUpdate
	EventGuildCountsUpdate         = gateway.EventGuildCountsUpdate
	EventChannelRecipientAdd       = gateway.EventChannelRecipientAdd
	EventChannelRecipientRemove    = gateway.EventChannelRecipientRemove
	EventChannelMemberCountsUpdate = gateway.EventChannelMemberCountsUpdate
	EventPresenceUpdateBulk        = gateway.EventPresenceUpdateBulk
	EventPassiveUpdates            = gateway.EventPassiveUpdates
	EventReactionAddMany           = gateway.EventReactionAddMany
	EventThreadCreate              = gateway.EventThreadCreate
	EventThreadUpdate              = gateway.EventThreadUpdate
	EventThreadDelete              = gateway.EventThreadDelete
	EventThreadListSync            = gateway.EventThreadListSync
	EventThreadMemberUpdate        = gateway.EventThreadMemberUpdate
	EventThreadMembersUpdate       = gateway.EventThreadMembersUpdate
	EventThreadMemberListUpdate    = gateway.EventThreadMemberListUpdate
	EventCallCreate                = gateway.EventCallCreate
	EventCallUpdate                = gateway.EventCallUpdate
	EventCallDelete                = gateway.EventCallDelete
	EventEntranceSoundPlay         = gateway.EventEntranceSoundPlay
	EventRelationshipAdd           = gateway.EventRelationshipAdd
	EventRelationshipUpdate        = gateway.EventRelationshipUpdate
	EventRelationshipRemove        = gateway.EventRelationshipRemove
)
View Source
const (
	RelationshipFriend          = events.RelationshipFriend
	RelationshipBlocked         = events.RelationshipBlocked
	RelationshipIncomingRequest = events.RelationshipIncomingRequest
	RelationshipOutgoingRequest = events.RelationshipOutgoingRequest
)
View Source
const (
	CodeInvalidFormBody       = rest.CodeInvalidFormBody
	CodeRateLimited           = rest.CodeRateLimited
	CodeSlowmodeRateLimited   = rest.CodeSlowmodeRateLimited
	CodeResourceLocked        = rest.CodeResourceLocked
	CodeUnauthorized          = rest.CodeUnauthorized
	CodeMissingAccess         = rest.CodeMissingAccess
	CodeMissingPermissions    = rest.CodeMissingPermissions
	CodeTwoFactorRequired     = rest.CodeTwoFactorRequired
	CodeCommunicationDisabled = rest.CodeCommunicationDisabled
	CodeContentBlocked        = rest.CodeContentBlocked
	CodeCannotSendEmpty       = rest.CodeCannotSendEmpty
	CodeUnknownChannel        = rest.CodeUnknownChannel
	CodeUnknownGuild          = rest.CodeUnknownGuild
	CodeUnknownMember         = rest.CodeUnknownMember
	CodeUnknownMessage        = rest.CodeUnknownMessage
	CodeUnknownRole           = rest.CodeUnknownRole
	CodeUnknownUser           = rest.CodeUnknownUser
	CodeUnknownInvite         = rest.CodeUnknownInvite
	CodeUnknownEmoji          = rest.CodeUnknownEmoji
	CodeUnknownSticker        = rest.CodeUnknownSticker
	CodeUnknownWebhook        = rest.CodeUnknownWebhook
	CodeThreadArchived        = rest.CodeThreadArchived
	CodeThreadLocked          = rest.CodeThreadLocked
	CodeMaxActiveThreads      = rest.CodeMaxActiveThreads
	CodeNSFWAgeRestricted     = rest.CodeNSFWAgeRestricted
	CodeFeatureDisabled       = rest.CodeFeatureDisabled
)
View Source
const (
	OpDispatch                   = gateway.OpDispatch
	OpHeartbeat                  = gateway.OpHeartbeat
	OpIdentify                   = gateway.OpIdentify
	OpPresenceUpdate             = gateway.OpPresenceUpdate
	OpVoiceStateUpdate           = gateway.OpVoiceStateUpdate
	OpRequestGuildMembers        = gateway.OpRequestGuildMembers
	OpGatewayError               = gateway.OpGatewayError
	OpLazyRequest                = gateway.OpLazyRequest
	OpRequestGuildCounts         = gateway.OpRequestGuildCounts
	OpRequestChannelMemberCounts = gateway.OpRequestChannelMemberCounts
	OpResume                     = gateway.OpResume
	OpReconnect                  = gateway.OpReconnect
	OpInvalidSession             = gateway.OpInvalidSession
	OpHello                      = gateway.OpHello
	OpHeartbeatAck               = gateway.OpHeartbeatAck
	OpVoiceSignal                = gateway.OpVoiceSignal
	OpRequestForumUnreads        = gateway.OpRequestForumUnreads
)
View Source
const (
	CloseUnknownError         = gateway.CloseUnknownError
	CloseUnknownOpcode        = gateway.CloseUnknownOpcode
	CloseDecodeError          = gateway.CloseDecodeError
	CloseNotAuthenticated     = gateway.CloseNotAuthenticated
	CloseAuthenticationFailed = gateway.CloseAuthenticationFailed
	CloseAlreadyAuthenticated = gateway.CloseAlreadyAuthenticated
	CloseInvalidSequence      = gateway.CloseInvalidSequence
	CloseRateLimited          = gateway.CloseRateLimited
	CloseSessionTimeout       = gateway.CloseSessionTimeout
	CloseInvalidShard         = gateway.CloseInvalidShard
	CloseShardingRequired     = gateway.CloseShardingRequired
	CloseInvalidAPIVersion    = gateway.CloseInvalidAPIVersion
)
View Source
const (
	FlagDebounceMessageReactions = gateway.FlagDebounceMessageReactions
	FlagChannelThreads           = gateway.FlagChannelThreads
	FlagGuildVisits              = gateway.FlagGuildVisits
)
View Source
const (
	StatusOnline    = model.StatusOnline
	StatusIdle      = model.StatusIdle
	StatusDND       = model.StatusDND
	StatusInvisible = model.StatusInvisible
	StatusOffline   = model.StatusOffline

	MaxCustomStatusText  = model.MaxCustomStatusText
	MaxCustomStatusEmoji = model.MaxCustomStatusEmoji
)
View Source
const (
	VoiceChannelFull        = gateway.VoiceChannelFull
	VoiceP2PConsentRequired = gateway.VoiceP2PConsentRequired
	VoiceP2PUnavailable     = gateway.VoiceP2PUnavailable
)
View Source
const (
	DefaultMinBackoff = session.DefaultMinBackoff
	DefaultMaxBackoff = session.DefaultMaxBackoff
)
View Source
const (
	PermissionCreateInstantInvite   = model.PermissionCreateInstantInvite
	PermissionKickMembers           = model.PermissionKickMembers
	PermissionBanMembers            = model.PermissionBanMembers
	PermissionAdministrator         = model.PermissionAdministrator
	PermissionManageChannels        = model.PermissionManageChannels
	PermissionManageGuild           = model.PermissionManageGuild
	PermissionAddReactions          = model.PermissionAddReactions
	PermissionViewAuditLog          = model.PermissionViewAuditLog
	PermissionPrioritySpeaker       = model.PermissionPrioritySpeaker
	PermissionStream                = model.PermissionStream
	PermissionViewChannel           = model.PermissionViewChannel
	PermissionSendMessages          = model.PermissionSendMessages
	PermissionSendTTSMessages       = model.PermissionSendTTSMessages
	PermissionManageMessages        = model.PermissionManageMessages
	PermissionEmbedLinks            = model.PermissionEmbedLinks
	PermissionAttachFiles           = model.PermissionAttachFiles
	PermissionReadMessageHistory    = model.PermissionReadMessageHistory
	PermissionMentionEveryone       = model.PermissionMentionEveryone
	PermissionUseExternalEmojis     = model.PermissionUseExternalEmojis
	PermissionConnect               = model.PermissionConnect
	PermissionSpeak                 = model.PermissionSpeak
	PermissionMuteMembers           = model.PermissionMuteMembers
	PermissionDeafenMembers         = model.PermissionDeafenMembers
	PermissionMoveMembers           = model.PermissionMoveMembers
	PermissionUseVAD                = model.PermissionUseVAD
	PermissionChangeNickname        = model.PermissionChangeNickname
	PermissionManageNicknames       = model.PermissionManageNicknames
	PermissionManageRoles           = model.PermissionManageRoles
	PermissionManageWebhooks        = model.PermissionManageWebhooks
	PermissionManageExpressions     = model.PermissionManageExpressions
	PermissionManageThreads         = model.PermissionManageThreads
	PermissionCreatePublicThreads   = model.PermissionCreatePublicThreads
	PermissionCreatePrivateThreads  = model.PermissionCreatePrivateThreads
	PermissionUseExternalStickers   = model.PermissionUseExternalStickers
	PermissionSendMessagesInThreads = model.PermissionSendMessagesInThreads
	PermissionModerateMembers       = model.PermissionModerateMembers
	PermissionCreateExpressions     = model.PermissionCreateExpressions
	PermissionPinMessages           = model.PermissionPinMessages
	PermissionBypassSlowmode        = model.PermissionBypassSlowmode
	PermissionUpdateRTCRegion       = model.PermissionUpdateRTCRegion
	PermissionViewChannelMembers    = model.PermissionViewChannelMembers
	PermissionAll                   = model.PermissionAll
	OverwriteRole                   = model.OverwriteRole
	OverwriteMember                 = model.OverwriteMember
)
View Source
const (
	ChannelTypeGuildText          = model.ChannelTypeGuildText
	ChannelTypeDM                 = model.ChannelTypeDM
	ChannelTypeGuildVoice         = model.ChannelTypeGuildVoice
	ChannelTypeGroupDM            = model.ChannelTypeGroupDM
	ChannelTypeGuildCategory      = model.ChannelTypeGuildCategory
	ChannelTypeGuildAnnouncement  = model.ChannelTypeGuildAnnouncement
	ChannelTypeAnnouncementThread = model.ChannelTypeAnnouncementThread
	ChannelTypePublicThread       = model.ChannelTypePublicThread
	ChannelTypePrivateThread      = model.ChannelTypePrivateThread
	ChannelTypeGuildForum         = model.ChannelTypeGuildForum
	ChannelTypeGuildMedia         = model.ChannelTypeGuildMedia
	ChannelTypeGuildLink          = model.ChannelTypeGuildLink
	ChannelTypePersonalNotes      = model.ChannelTypePersonalNotes
)
View Source
const (
	MessageTypeDefault              = model.MessageTypeDefault
	MessageTypeRecipientAdd         = model.MessageTypeRecipientAdd
	MessageTypeRecipientRemove      = model.MessageTypeRecipientRemove
	MessageTypeCall                 = model.MessageTypeCall
	MessageTypeChannelNameChange    = model.MessageTypeChannelNameChange
	MessageTypeChannelIconChange    = model.MessageTypeChannelIconChange
	MessageTypeChannelPinnedMessage = model.MessageTypeChannelPinnedMessage
	MessageTypeUserJoin             = model.MessageTypeUserJoin
	MessageTypeChannelFollowAdd     = model.MessageTypeChannelFollowAdd
	MessageTypeThreadCreated        = model.MessageTypeThreadCreated
	MessageTypeReply                = model.MessageTypeReply
	MessageTypeThreadStarterMessage = model.MessageTypeThreadStarterMessage
)
View Source
const (
	MessageFlagCrossposted           = model.MessageFlagCrossposted
	MessageFlagIsCrosspost           = model.MessageFlagIsCrosspost
	MessageFlagSuppressEmbeds        = model.MessageFlagSuppressEmbeds
	MessageFlagSourceMessageDeleted  = model.MessageFlagSourceMessageDeleted
	MessageFlagHasThread             = model.MessageFlagHasThread
	MessageFlagEphemeral             = model.MessageFlagEphemeral
	MessageFlagSuppressNotifications = model.MessageFlagSuppressNotifications
	MessageFlagVoiceMessage          = model.MessageFlagVoiceMessage
)
View Source
const (
	MaxEmbeds          = model.MaxEmbeds
	MaxAttachments     = model.MaxAttachments
	MaxBulkDelete      = model.MaxBulkDelete
	MaxMessagesPerPage = model.MaxMessagesPerPage
	MentionUsers       = model.MentionUsers
	MentionRoles       = model.MentionRoles
	MentionEveryone    = model.MentionEveryone
)
View Source
const (
	ComponentTypeActionRow = model.ComponentTypeActionRow
	ComponentTypeButton    = model.ComponentTypeButton
	ButtonStylePrimary     = model.ButtonStylePrimary
	ButtonStyleSecondary   = model.ButtonStyleSecondary
	ButtonStyleSuccess     = model.ButtonStyleSuccess
	ButtonStyleDanger      = model.ButtonStyleDanger
	ButtonStyleLink        = model.ButtonStyleLink
	MaxActionRows          = model.MaxActionRows
	MaxButtonsPerRow       = model.MaxButtonsPerRow
	MaxCustomIDLength      = model.MaxCustomIDLength
	MaxButtonLabelLength   = model.MaxButtonLabelLength
)
View Source
const (
	ComponentTypeStringSelect      = model.ComponentTypeStringSelect
	ComponentTypeUserSelect        = model.ComponentTypeUserSelect
	ComponentTypeRoleSelect        = model.ComponentTypeRoleSelect
	ComponentTypeMentionableSelect = model.ComponentTypeMentionableSelect
	ComponentTypeChannelSelect     = model.ComponentTypeChannelSelect
	SelectDefaultUser              = model.SelectDefaultUser
	SelectDefaultRole              = model.SelectDefaultRole
	SelectDefaultChannel           = model.SelectDefaultChannel
	MaxSelectOptions               = model.MaxSelectOptions
	MaxSelectPlaceholder           = model.MaxSelectPlaceholder
	MaxSelectOptionLabel           = model.MaxSelectOptionLabel
	MaxSelectOptionValue           = model.MaxSelectOptionValue
	MaxSelectOptionDescription     = model.MaxSelectOptionDescription
)
View Source
const (
	InteractionTypePing               = model.InteractionTypePing
	InteractionTypeApplicationCommand = model.InteractionTypeApplicationCommand
	InteractionTypeMessageComponent   = model.InteractionTypeMessageComponent
	InteractionTypeAutocomplete       = model.InteractionTypeAutocomplete
	InteractionTypeModalSubmit        = model.InteractionTypeModalSubmit
	InteractionContextGuild           = model.InteractionContextGuild
	InteractionContextBotDM           = model.InteractionContextBotDM
	InteractionContextPrivateChannel  = model.InteractionContextPrivateChannel
	CommandTypeChatInput              = model.CommandTypeChatInput
	CommandTypeUser                   = model.CommandTypeUser
	CommandTypeMessage                = model.CommandTypeMessage
	OptionTypeSubcommand              = model.OptionTypeSubcommand
	OptionTypeSubcommandGroup         = model.OptionTypeSubcommandGroup
	OptionTypeString                  = model.OptionTypeString
	OptionTypeInteger                 = model.OptionTypeInteger
	OptionTypeBoolean                 = model.OptionTypeBoolean
	OptionTypeUser                    = model.OptionTypeUser
	OptionTypeChannel                 = model.OptionTypeChannel
	OptionTypeRole                    = model.OptionTypeRole
	OptionTypeMentionable             = model.OptionTypeMentionable
	OptionTypeNumber                  = model.OptionTypeNumber
	OptionTypeAttachment              = model.OptionTypeAttachment
	MaxCommandOptions                 = model.MaxCommandOptions
	MaxCommandChoices                 = model.MaxCommandChoices
	MaxCommandName                    = model.MaxCommandName
	MaxCommandDescription             = model.MaxCommandDescription
	ComponentTypeTextInput            = model.ComponentTypeTextInput
	TextInputStyleShort               = model.TextInputStyleShort
	TextInputStyleParagraph           = model.TextInputStyleParagraph
	MaxModalInputs                    = model.MaxModalInputs
	MaxModalTitle                     = model.MaxModalTitle
	MaxTextInputLabel                 = model.MaxTextInputLabel
	MaxTextInputLength                = model.MaxTextInputLength
)
View Source
const (
	ChannelFlagPinned                           = model.ChannelFlagPinned
	ChannelFlagRequireTag                       = model.ChannelFlagRequireTag
	ChannelFlagHideMediaDownloadOptions         = model.ChannelFlagHideMediaDownloadOptions
	AutoArchiveHour                             = model.AutoArchiveHour
	AutoArchiveDay                              = model.AutoArchiveDay
	AutoArchiveThreeDays                        = model.AutoArchiveThreeDays
	AutoArchiveWeek                             = model.AutoArchiveWeek
	ForumSortLatestActivity                     = model.ForumSortLatestActivity
	ForumSortCreationTime                       = model.ForumSortCreationTime
	ForumLayoutDefault                          = model.ForumLayoutDefault
	ForumLayoutList                             = model.ForumLayoutList
	ForumLayoutGrid                             = model.ForumLayoutGrid
	ForumTagMatchSome                           = model.ForumTagMatchSome
	ForumTagMatchAll                            = model.ForumTagMatchAll
	ThreadMemberHasInteracted                   = model.ThreadMemberHasInteracted
	ThreadMemberAllMessages                     = model.ThreadMemberAllMessages
	ThreadMemberOnlyMentions                    = model.ThreadMemberOnlyMentions
	ThreadMemberNoMessages                      = model.ThreadMemberNoMessages
	MaxChannelName                              = model.MaxChannelName
	MaxChannelTopic                             = model.MaxChannelTopic
	MaxForumTopic                               = model.MaxForumTopic
	MaxSlowmodeSeconds                          = model.MaxSlowmodeSeconds
	MaxForumTags                                = model.MaxForumTags
	MaxAppliedTags                              = model.MaxAppliedTags
	MaxForumTagName                             = model.MaxForumTagName
	MaxChannelPositions                         = model.MaxChannelPositions
	EmbedTypeRich                               = model.EmbedTypeRich
	MaxEmbedTitle                               = model.MaxEmbedTitle
	MaxEmbedDescription                         = model.MaxEmbedDescription
	MaxEmbedFields                              = model.MaxEmbedFields
	MaxEmbedFieldName                           = model.MaxEmbedFieldName
	MaxEmbedFieldValue                          = model.MaxEmbedFieldValue
	MaxEmbedFooter                              = model.MaxEmbedFooter
	MaxEmbedAuthor                              = model.MaxEmbedAuthor
	MaxEmbedURL                                 = model.MaxEmbedURL
	VerificationNone                            = model.VerificationNone
	VerificationLow                             = model.VerificationLow
	VerificationMedium                          = model.VerificationMedium
	VerificationHigh                            = model.VerificationHigh
	MFALevelNone                                = model.MFALevelNone
	MFALevelElevated                            = model.MFALevelElevated
	ExplicitFilterDisabled                      = model.ExplicitFilterDisabled
	ExplicitFilterMembersWithoutRoles           = model.ExplicitFilterMembersWithoutRoles
	ExplicitFilterAllMembers                    = model.ExplicitFilterAllMembers
	NotifyAllMessages                           = model.NotifyAllMessages
	NotifyOnlyMentions                          = model.NotifyOnlyMentions
	SystemChannelSuppressJoinNotifications      = model.SystemChannelSuppressJoinNotifications
	FeatureAnimatedBanner                       = model.FeatureAnimatedBanner
	FeatureAnimatedIcon                         = model.FeatureAnimatedIcon
	FeatureBanner                               = model.FeatureBanner
	FeatureCloneEmojiEnabled                    = model.FeatureCloneEmojiEnabled
	FeatureCloneStickerEnabled                  = model.FeatureCloneStickerEnabled
	FeatureDetachedBanner                       = model.FeatureDetachedBanner
	FeatureDiscoverable                         = model.FeatureDiscoverable
	FeatureExpressionPurgeAllowed               = model.FeatureExpressionPurgeAllowed
	FeatureHideOwnerCrown                       = model.FeatureHideOwnerCrown
	FeatureInviteSplash                         = model.FeatureInviteSplash
	FeatureInvitesDisabled                      = model.FeatureInvitesDisabled
	FeaturePartnered                            = model.FeaturePartnered
	FeatureTextChannelFlexibleNames             = model.FeatureTextChannelFlexibleNames
	FeatureVanityURL                            = model.FeatureVanityURL
	FeatureVerified                             = model.FeatureVerified
	FeatureVisitsEnabled                        = model.FeatureVisitsEnabled
	FeatureVoiceE2EE                            = model.FeatureVoiceE2EE
	InviteTypeGuild                             = model.InviteTypeGuild
	InviteTypeGroupDM                           = model.InviteTypeGroupDM
	MaxInviteUses                               = model.MaxInviteUses
	MaxInviteAge                                = model.MaxInviteAge
	MaxBulkExpressions                          = model.MaxBulkExpressions
	MaxEmojiName                                = model.MaxEmojiName
	MaxStickerName                              = model.MaxStickerName
	MemberProfileAvatarUnset                    = model.MemberProfileAvatarUnset
	MemberProfileBannerUnset                    = model.MemberProfileBannerUnset
	MentionNoPreference                         = model.MentionNoPreference
	MentionPreferMention                        = model.MentionPreferMention
	MentionPreferNoMention                      = model.MentionPreferNoMention
	JoinSourceCreator                           = model.JoinSourceCreator
	JoinSourceInstantInvite                     = model.JoinSourceInstantInvite
	JoinSourceVanityURL                         = model.JoinSourceVanityURL
	JoinSourceBotInvite                         = model.JoinSourceBotInvite
	JoinSourceAdminForceAdd                     = model.JoinSourceAdminForceAdd
	JoinSourceDiscovery                         = model.JoinSourceDiscovery
	MessageFlagFailedToMentionSomeRolesInThread = model.MessageFlagFailedToMentionSomeRolesInThread
	AttachmentFlagSpoiler                       = model.AttachmentFlagSpoiler
	AttachmentFlagExplicitMedia                 = model.AttachmentFlagExplicitMedia
	AttachmentFlagAnimated                      = model.AttachmentFlagAnimated
	MessageReferenceDefault                     = model.MessageReferenceDefault
	MessageReferenceForward                     = model.MessageReferenceForward
	MaxStickersPerMessage                       = model.MaxStickersPerMessage
	MaxReactionUsersPerPage                     = model.MaxReactionUsersPerPage
	MaxPinsPerPage                              = model.MaxPinsPerPage
	MaxRefreshURLs                              = model.MaxRefreshURLs
	SearchAuthorUser                            = model.SearchAuthorUser
	SearchAuthorBot                             = model.SearchAuthorBot
	SearchAuthorWebhook                         = model.SearchAuthorWebhook
	SearchHasImage                              = model.SearchHasImage
	SearchHasSound                              = model.SearchHasSound
	SearchHasVideo                              = model.SearchHasVideo
	SearchHasFile                               = model.SearchHasFile
	SearchHasSticker                            = model.SearchHasSticker
	SearchHasEmbed                              = model.SearchHasEmbed
	SearchHasLink                               = model.SearchHasLink
	SearchHasSnapshot                           = model.SearchHasSnapshot
	SearchSortTimestamp                         = model.SearchSortTimestamp
	SearchSortRelevance                         = model.SearchSortRelevance
	SortAscending                               = model.SortAscending
	SortDescending                              = model.SortDescending
	MaxSearchHitsPerPage                        = model.MaxSearchHitsPerPage
	MaxSearchPage                               = model.MaxSearchPage
	UserFlagStaff                               = model.UserFlagStaff
	UserFlagPartner                             = model.UserFlagPartner
	UserFlagBugHunter                           = model.UserFlagBugHunter
	UserFlagFriendlyBot                         = model.UserFlagFriendlyBot
	UserFlagFriendlyBotManualApproval           = model.UserFlagFriendlyBotManualApproval
	UserFlagSpammer                             = model.UserFlagSpammer
	UserFlagProfileHidden                       = model.UserFlagProfileHidden
	WebhookTypeIncoming                         = model.WebhookTypeIncoming
	WebhookTypeChannelFollower                  = model.WebhookTypeChannelFollower
	MaxWebhookName                              = model.MaxWebhookName
	AuditGuildUpdate                            = model.AuditGuildUpdate
	AuditChannelCreate                          = model.AuditChannelCreate
	AuditChannelUpdate                          = model.AuditChannelUpdate
	AuditChannelDelete                          = model.AuditChannelDelete
	AuditChannelOverwriteCreate                 = model.AuditChannelOverwriteCreate
	AuditChannelOverwriteUpdate                 = model.AuditChannelOverwriteUpdate
	AuditChannelOverwriteDelete                 = model.AuditChannelOverwriteDelete
	AuditMemberKick                             = model.AuditMemberKick
	AuditMemberPrune                            = model.AuditMemberPrune
	AuditMemberBanAdd                           = model.AuditMemberBanAdd
	AuditMemberBanRemove                        = model.AuditMemberBanRemove
	AuditMemberUpdate                           = model.AuditMemberUpdate
	AuditMemberRoleUpdate                       = model.AuditMemberRoleUpdate
	AuditMemberMove                             = model.AuditMemberMove
	AuditMemberDisconnect                       = model.AuditMemberDisconnect
	AuditBotAdd                                 = model.AuditBotAdd
	AuditRoleCreate                             = model.AuditRoleCreate
	AuditRoleUpdate                             = model.AuditRoleUpdate
	AuditRoleDelete                             = model.AuditRoleDelete
	AuditInviteCreate                           = model.AuditInviteCreate
	AuditInviteUpdate                           = model.AuditInviteUpdate
	AuditInviteDelete                           = model.AuditInviteDelete
	AuditWebhookCreate                          = model.AuditWebhookCreate
	AuditWebhookUpdate                          = model.AuditWebhookUpdate
	AuditWebhookDelete                          = model.AuditWebhookDelete
	AuditEmojiCreate                            = model.AuditEmojiCreate
	AuditEmojiUpdate                            = model.AuditEmojiUpdate
	AuditEmojiDelete                            = model.AuditEmojiDelete
	AuditMessageDelete                          = model.AuditMessageDelete
	AuditMessageBulkDelete                      = model.AuditMessageBulkDelete
	AuditMessagePin                             = model.AuditMessagePin
	AuditMessageUnpin                           = model.AuditMessageUnpin
	AuditStickerCreate                          = model.AuditStickerCreate
	AuditStickerUpdate                          = model.AuditStickerUpdate
	AuditStickerDelete                          = model.AuditStickerDelete
	AuditThreadCreate                           = model.AuditThreadCreate
	AuditThreadUpdate                           = model.AuditThreadUpdate
	AuditThreadDelete                           = model.AuditThreadDelete
	MaxAuditLogEntries                          = model.MaxAuditLogEntries
	MaxRoleName                                 = model.MaxRoleName
	MaxRoleColor                                = model.MaxRoleColor
	TimestampShortTime                          = model.TimestampShortTime
	TimestampLongTime                           = model.TimestampLongTime
	TimestampShortDate                          = model.TimestampShortDate
	TimestampLongDate                           = model.TimestampLongDate
	TimestampShortDateTime                      = model.TimestampShortDateTime
	TimestampLongDateTime                       = model.TimestampLongDateTime
	TimestampRelative                           = model.TimestampRelative
)
View Source
const (
	ImagePNG  = model.ImagePNG
	ImageJPEG = model.ImageJPEG
	ImageWebP = model.ImageWebP
	ImageGIF  = model.ImageGIF
	ImageAVIF = model.ImageAVIF

	ElevatedPermissions = model.ElevatedPermissions
)
View Source
const DefaultIdentifyInterval = shard.DefaultIdentifyInterval
View Source
const DefaultOrigin = discovery.DefaultOrigin
View Source
const MaxGuildsPerShard = bot.MaxGuildsPerShard
View Source
const SnowflakeEpoch = model.SnowflakeEpoch
View Source
const Version = bot.Version

Variables

View Source
var (
	ErrReconnectRequested = gateway.ErrReconnectRequested
	ErrGatewayClosed      = gateway.ErrClosed
)
View Source
var (
	ErrNotReady           = session.ErrNotReady
	ErrVoiceJoinPending   = session.ErrVoiceJoinPending
	ErrVoiceGrant         = session.ErrVoiceGrant
	ErrVoiceMoved         = session.ErrVoiceMoved
	ErrVoiceRefused       = session.ErrVoiceRefused
	ErrVoicePermission    = session.ErrVoicePermission
	ErrMembersRateLimited = session.ErrMembersRateLimited
	ErrNotInVoice         = session.ErrNotInVoice
	ErrNoResponse         = session.ErrNoResponse
)
View Source
var (
	ErrShardNotOwned       = shard.ErrNotOwned
	ErrShardManagerRunning = shard.ErrRunning
)
View Source
var ErrNoRoute = events.ErrNoRoute

Functions

func AttachmentURL added in v0.8.0

func AttachmentURL(filename string) string

func CompareSnowflakes added in v0.8.0

func CompareSnowflakes(a, b string) int

func DecodeEvent added in v0.6.1

func DecodeEvent(event Event) (any, error)

func EmojiString added in v0.4.0

func EmojiString(emoji Emoji) string

func ErrorCode added in v0.8.0

func ErrorCode(err error) string

func EscapeMarkdown added in v0.8.0

func EscapeMarkdown(text string) string

func EventAs added in v0.6.1

func EventAs[T any](event Event) (T, error)

func FormatTimestamp added in v0.8.0

func FormatTimestamp(at time.Time, style string) string
Example
package main

import (
	"fmt"
	"time"

	micup "github.com/yestefir/micup.go"
)

func main() {
	fmt.Println(micup.FormatTimestamp(time.Unix(1700000000, 0), micup.TimestampRelative))
}
Output:
<t:1700000000:R>

func ImageData added in v0.8.0

func ImageData(contentType string, data []byte) (string, error)

func InviteURL added in v0.8.0

func InviteURL(base, code string) (string, error)

func IsErrorCode added in v0.8.0

func IsErrorCode(err error, codes ...string) bool

func IsForbidden added in v0.8.0

func IsForbidden(err error) bool

func IsNotFound added in v0.8.0

func IsNotFound(err error) bool

func KnownEvents added in v0.6.1

func KnownEvents() []string

func MentionChannel added in v0.8.0

func MentionChannel(channelID string) string

func MentionRole added in v0.8.0

func MentionRole(roleID string) string

func MentionUser added in v0.8.0

func MentionUser(userID string) string

func ParseSnowflake added in v0.8.0

func ParseSnowflake(id string) (uint64, error)

func RunGateway added in v0.4.0

func RunGateway(ctx context.Context, options GatewayOptions, handler EventHandler) error

func ShardForGuild added in v0.3.0

func ShardForGuild(guildID string, shardCount int) (int, error)

func SnowflakeAt added in v0.8.0

func SnowflakeAt(at time.Time) string

func SnowflakeTime added in v0.8.0

func SnowflakeTime(id string) (time.Time, error)

func ValidateSubscriptions added in v0.8.0

func ValidateSubscriptions(subscriptions map[string]Subscription) error

Types

type APIError

type APIError = rest.APIError

type ActionRow added in v0.4.0

type ActionRow = model.ActionRow

func DisableButtons added in v0.4.0

func DisableButtons(rows []ActionRow) []ActionRow

func DisableComponents added in v0.7.0

func DisableComponents(rows []ActionRow) []ActionRow

func NewActionRow added in v0.4.0

func NewActionRow(buttons ...Button) ActionRow

func NewSelectRow added in v0.7.0

func NewSelectRow(menu SelectMenu) ActionRow

type AllowedMentions added in v0.4.0

type AllowedMentions = model.AllowedMentions

type Application added in v0.4.0

type Application = rest.Application

type ApplicationCommand added in v0.6.1

type ApplicationCommand = model.ApplicationCommand

type ApplicationCommandsUpdate added in v0.6.1

type ApplicationCommandsUpdate = events.ApplicationCommandsUpdate

type ArchivedThreadQuery added in v0.8.0

type ArchivedThreadQuery = model.ArchivedThreadQuery

type Attachment added in v0.4.0

type Attachment = model.Attachment

type AuditLog added in v0.8.0

type AuditLog = model.AuditLog

type AuditLogChange added in v0.6.1

type AuditLogChange = events.AuditLogChange

type AuditLogEntry added in v0.8.0

type AuditLogEntry = model.AuditLogEntry

type AuditLogEntryCreate added in v0.6.1

type AuditLogEntryCreate = events.AuditLogEntryCreate

type AuditLogOptions added in v0.6.1

type AuditLogOptions = events.AuditLogOptions

type AuditLogQuery added in v0.8.0

type AuditLogQuery = model.AuditLogQuery

type AuditLogWebhook added in v0.8.0

type AuditLogWebhook = model.AuditLogWebhook

type Ban added in v0.4.0

type Ban = model.Ban

type BanEntry added in v0.8.0

type BanEntry = model.BanEntry

type Bot added in v0.4.0

type Bot = bot.Bot

func New

func New(ctx context.Context, config Config) (*Bot, error)

type Button added in v0.4.0

type Button = model.Button

func DangerButton added in v0.4.0

func DangerButton(customID, label string) Button

func LinkButton added in v0.4.0

func LinkButton(url, label string) Button

func PrimaryButton added in v0.4.0

func PrimaryButton(customID, label string) Button

func SecondaryButton added in v0.4.0

func SecondaryButton(customID, label string) Button

func SuccessButton added in v0.4.0

func SuccessButton(customID, label string) Button

type Call added in v0.8.0

type Call = events.Call

type CallDelete added in v0.8.0

type CallDelete = events.CallDelete

type Channel

type Channel = model.Channel

type ChannelCreate added in v0.8.0

type ChannelCreate = model.ChannelCreate

type ChannelEdit added in v0.8.0

type ChannelEdit = model.ChannelEdit

type ChannelFollowerStats added in v0.8.0

type ChannelFollowerStats = model.ChannelFollowerStats

type ChannelLookup added in v0.4.0

type ChannelLookup = session.ChannelLookup

type ChannelMemberCount added in v0.8.0

type ChannelMemberCount = events.ChannelMemberCount

type ChannelMemberCountsUpdate added in v0.8.0

type ChannelMemberCountsUpdate = events.ChannelMemberCountsUpdate

type ChannelMention added in v0.8.0

type ChannelMention = model.ChannelMention

type ChannelPinsUpdate added in v0.6.1

type ChannelPinsUpdate = events.ChannelPinsUpdate

type ChannelPosition added in v0.8.0

type ChannelPosition = model.ChannelPosition

type ChannelRecipient added in v0.8.0

type ChannelRecipient = events.ChannelRecipient

type ChannelUpdateBulk added in v0.6.1

type ChannelUpdateBulk = events.ChannelUpdateBulk

type ClientSession added in v0.6.1

type ClientSession = events.ClientSession

type CloseError added in v0.3.0

type CloseError = gateway.CloseError

type CommandChoice added in v0.6.1

type CommandChoice = model.CommandChoice

type CommandData added in v0.6.1

type CommandData = model.CommandData

type CommandDataOption added in v0.6.1

type CommandDataOption = model.CommandDataOption

type CommandOption added in v0.6.1

type CommandOption = model.CommandOption

type ComponentData added in v0.4.0

type ComponentData = model.ComponentData

type Config

type Config = bot.Config

type CrosspostSource added in v0.8.0

type CrosspostSource = model.CrosspostSource

type CrosspostSourceGuild added in v0.8.0

type CrosspostSourceGuild = model.CrosspostSourceGuild

type CurrentMemberEdit added in v0.8.0

type CurrentMemberEdit = model.CurrentMemberEdit

type CustomStatus added in v0.4.0

type CustomStatus = model.CustomStatus

type DefaultReaction added in v0.8.0

type DefaultReaction = model.DefaultReaction

type Embed added in v0.2.0

type Embed = model.Embed

func NewEmbed added in v0.8.0

func NewEmbed() Embed

type EmbedAuthor added in v0.2.0

type EmbedAuthor = model.EmbedAuthor

type EmbedField added in v0.2.0

type EmbedField = model.EmbedField

type EmbedFooter added in v0.2.0

type EmbedFooter = model.EmbedFooter

type EmbedMedia added in v0.2.0

type EmbedMedia = model.EmbedMedia

type EmbedProvider added in v0.8.0

type EmbedProvider = model.EmbedProvider

type Emoji added in v0.4.0

type Emoji = model.Emoji

type EmojiBulkResult added in v0.8.0

type EmojiBulkResult = model.EmojiBulkResult

type EmojiCreate added in v0.8.0

type EmojiCreate = model.EmojiCreate

type Endpoints added in v0.4.0

type Endpoints = discovery.Endpoints

type EntranceSoundPlay added in v0.8.0

type EntranceSoundPlay = events.EntranceSoundPlay

type Event

type Event = gateway.Event

type EventHandler

type EventHandler = gateway.Handler

type EventListener added in v0.6.1

type EventListener = events.Listener

func Listen added in v0.6.1

func Listen[T any](fn func(context.Context, T) error) EventListener

type EventMux added in v0.6.1

type EventMux = events.Mux

func NewEventMux added in v0.6.1

func NewEventMux() *EventMux
Example
package main

import (
	"context"
	"encoding/json"
	"fmt"

	micup "github.com/yestefir/micup.go"
)

func main() {
	mux := micup.NewEventMux()
	mux.On(micup.EventMessageCreate, micup.Listen(func(ctx context.Context, m micup.MessageCreate) error {
		fmt.Println(m.Content)
		return nil
	}))
	event := micup.Event{Name: micup.EventMessageCreate, Data: json.RawMessage(`{"id":"1","channel_id":"2","content":"!ping"}`)}
	fmt.Println(mux.Handle(context.Background(), event))
}
Output:
!ping
<nil>

type EventRouter added in v1.0.1

type EventRouter = events.Router

func NewEventRouter added in v1.0.1

func NewEventRouter() *EventRouter
Example
package main

import (
	"context"
	"encoding/json"
	"fmt"

	micup "github.com/yestefir/micup.go"
)

func main() {
	router := micup.NewEventRouter()
	router.Command("queue add", func(ctx context.Context, i micup.Interaction) error {
		fmt.Println("add to queue")
		return nil
	})
	router.Component("page:*", func(ctx context.Context, i micup.Interaction) error {
		fmt.Println("change page", i.CustomID())
		return nil
	})

	add := micup.Interaction{
		Type: micup.InteractionTypeApplicationCommand,
		Data: json.RawMessage(`{"name":"queue","options":[{"type":1,"name":"add"}]}`),
	}
	page := micup.Interaction{
		Type: micup.InteractionTypeMessageComponent,
		Data: json.RawMessage(`{"custom_id":"page:3","component_type":2}`),
	}
	unknown := micup.Interaction{
		Type: micup.InteractionTypeApplicationCommand,
		Data: json.RawMessage(`{"name":"other"}`),
	}
	ctx := context.Background()
	fmt.Println(router.Handle(ctx, add))
	fmt.Println(router.Handle(ctx, page))
	fmt.Println(router.Handle(ctx, unknown) == micup.ErrNoRoute)
}
Output:
add to queue
<nil>
change page page:3
<nil>
true

type ExpressionFailure added in v0.8.0

type ExpressionFailure = model.ExpressionFailure

type ExpressionMetadata added in v0.8.0

type ExpressionMetadata = model.ExpressionMetadata

type FieldError added in v0.4.0

type FieldError = rest.FieldError

type File added in v0.4.0

type File = rest.File

type FollowedChannel added in v0.8.0

type FollowedChannel = model.FollowedChannel

type ForumPost added in v0.8.0

type ForumPost = model.ForumPost

type ForumPostData added in v0.8.0

type ForumPostData = model.ForumPostData

type ForumPostStart added in v0.8.0

type ForumPostStart = model.ForumPostStart

type ForumTag added in v0.8.0

type ForumTag = model.ForumTag

type GatewayConn added in v0.4.0

type GatewayConn = gateway.Conn

type GatewayError added in v0.4.0

type GatewayError = gateway.GatewayError

type GatewayInfo added in v0.8.0

type GatewayInfo = model.GatewayInfo

type GatewayOptions added in v0.4.0

type GatewayOptions = gateway.Options

type GatewayRollout added in v0.6.1

type GatewayRollout = events.GatewayRollout

type Guild

type Guild = model.Guild

type GuildBan added in v0.6.1

type GuildBan = events.GuildBan

type GuildCount added in v0.8.0

type GuildCount = events.GuildCount

type GuildCountsUpdate added in v0.8.0

type GuildCountsUpdate = events.GuildCountsUpdate

type GuildCreate added in v0.6.1

type GuildCreate = events.GuildCreate

type GuildDelete added in v0.6.1

type GuildDelete = events.GuildDelete

type GuildEdit added in v0.8.0

type GuildEdit = model.GuildEdit

type GuildEmojisUpdate added in v0.8.0

type GuildEmojisUpdate = events.GuildEmojisUpdate

type GuildMember added in v0.4.0

type GuildMember = events.GuildMember

type GuildMemberRemove added in v0.4.0

type GuildMemberRemove = events.GuildMemberRemove

type GuildMembers added in v0.5.0

type GuildMembers = session.GuildMembers

type GuildQuery added in v0.8.0

type GuildQuery = model.GuildQuery

type GuildStickersUpdate added in v0.8.0

type GuildStickersUpdate = events.GuildStickersUpdate

type GuildUpdate added in v0.6.1

type GuildUpdate = events.GuildUpdate

type ImageOptions added in v0.8.0

type ImageOptions = model.ImageOptions

type Interaction added in v0.2.0

type Interaction = model.Interaction

type InteractionGuild added in v0.6.1

type InteractionGuild = model.InteractionGuild

type InteractionHandler added in v1.0.1

type InteractionHandler = events.InteractionHandler

type Invite added in v0.6.1

type Invite = model.Invite

type InviteCreate added in v0.8.0

type InviteCreate = model.InviteCreate

type InviteDelete added in v0.6.1

type InviteDelete = events.InviteDelete

type KeptAttachment added in v0.8.0

type KeptAttachment = model.KeptAttachment

type Media added in v0.8.0

type Media = model.Media

type Member added in v0.4.0

type Member = model.Member

type MemberEdit added in v0.4.0

type MemberEdit = model.MemberEdit

type MemberListGroup added in v0.8.0

type MemberListGroup = events.MemberListGroup

type MemberListItem added in v0.8.0

type MemberListItem = events.MemberListItem

type MemberListMember added in v0.8.0

type MemberListMember = events.MemberListMember

type MemberListOperation added in v0.8.0

type MemberListOperation = events.MemberListOperation

type MemberListUpdate added in v0.8.0

type MemberListUpdate = events.MemberListUpdate

type MemberLookup added in v0.5.0

type MemberLookup = session.MemberLookup

type MemberQuery added in v0.4.0

type MemberQuery = model.MemberQuery

type MemberSearch added in v0.8.0

type MemberSearch = model.MemberSearch

type MemberSearchPage added in v0.8.0

type MemberSearchPage = model.MemberSearchPage

type MemberSearchResult added in v0.8.0

type MemberSearchResult = model.MemberSearchResult

type MemberSearchSupplemental added in v0.8.0

type MemberSearchSupplemental = model.MemberSearchSupplemental

type MembersChunk added in v0.6.1

type MembersChunk = events.MembersChunk

type MembersRateLimitedError added in v0.4.0

type MembersRateLimitedError = session.MembersRateLimitedError

type MembersRequest added in v0.4.0

type MembersRequest = model.MembersRequest

type Message

type Message = model.Message

type MessageCall added in v0.8.0

type MessageCall = model.MessageCall

type MessageCreate

type MessageCreate = events.MessageCreate

type MessageDelete added in v0.4.0

type MessageDelete = events.MessageDelete

type MessageDeleteBulk added in v0.4.0

type MessageDeleteBulk = events.MessageDeleteBulk

type MessageEdit added in v0.4.0

type MessageEdit = model.MessageEdit

type MessageForward added in v0.8.0

type MessageForward = model.MessageForward

type MessageOptions added in v0.2.0

type MessageOptions = model.MessageOptions

type MessageQuery added in v0.4.0

type MessageQuery = model.MessageQuery

type MessageReference added in v0.4.0

type MessageReference = model.MessageReference

type MessageSearch added in v0.8.0

type MessageSearch = model.MessageSearch

type MessageSearchResult added in v0.8.0

type MessageSearchResult = model.MessageSearchResult

type MessageSnapshot added in v0.8.0

type MessageSnapshot = model.MessageSnapshot

type MessageUpdate added in v0.4.0

type MessageUpdate = events.MessageUpdate
type Modal = model.Modal

type ModalData added in v0.7.0

type ModalData = model.ModalData

type MutualGuild added in v0.8.0

type MutualGuild = model.MutualGuild

type Optional added in v0.8.0

type Optional[T any] = model.Optional[T]

func Clear added in v0.8.0

func Clear[T any]() Optional[T]

func Set added in v0.8.0

func Set[T any](value T) Optional[T]

type PassiveUpdates added in v0.8.0

type PassiveUpdates = events.PassiveUpdates

type PermissionOverwrite added in v0.4.0

type PermissionOverwrite = model.PermissionOverwrite

type Permissions added in v0.4.0

type Permissions = model.Permissions

func ComputePermissions added in v0.4.0

func ComputePermissions(guildID, ownerID, userID string, roles map[string]Role, memberRoles []string, overwrites []PermissionOverwrite) Permissions

func ParsePermission added in v0.8.0

func ParsePermission(name string) (Permissions, bool)

type Pin added in v0.4.0

type Pin = model.Pin

type PinQuery added in v0.4.0

type PinQuery = model.PinQuery

type PinsPage added in v0.4.0

type PinsPage = model.PinsPage

type Presence added in v0.4.0

type Presence = model.Presence

type PresenceUpdate added in v0.6.1

type PresenceUpdate = events.PresenceUpdate

type PresenceUpdateBulk added in v0.8.0

type PresenceUpdateBulk = events.PresenceUpdateBulk

type ProfileBadge added in v0.8.0

type ProfileBadge = model.ProfileBadge

type ProfileDetails added in v0.8.0

type ProfileDetails = model.ProfileDetails

type RESTClient added in v0.4.0

type RESTClient = rest.Client

func NewREST added in v0.4.0

func NewREST(config RESTConfig) (*RESTClient, error)

type RESTConfig added in v0.4.0

type RESTConfig = rest.Config

type RateLimited added in v0.6.1

type RateLimited = events.RateLimited

type RateLimitedMeta added in v0.6.1

type RateLimitedMeta = events.RateLimitedMeta

type Reaction added in v0.4.0

type Reaction = model.Reaction

type ReactionAddMany added in v0.8.0

type ReactionAddMany = events.ReactionAddMany

type ReactionAddition added in v0.8.0

type ReactionAddition = events.ReactionAddition

type ReactionEvent added in v0.4.0

type ReactionEvent = events.ReactionEvent

type ReactionRemoveAll added in v0.6.1

type ReactionRemoveAll = events.ReactionRemoveAll

type ReactionRemoveEmoji added in v0.6.1

type ReactionRemoveEmoji = events.ReactionRemoveEmoji

type ReactionUsersPage added in v0.8.0

type ReactionUsersPage = model.ReactionUsersPage

type ReactionUsersQuery added in v0.8.0

type ReactionUsersQuery = model.ReactionUsersQuery

type Ready added in v0.6.1

type Ready = events.Ready

type ReadyApplication added in v0.6.1

type ReadyApplication = events.ReadyApplication

type RefreshedURL added in v0.8.0

type RefreshedURL = model.RefreshedURL

type Relationship added in v0.8.0

type Relationship = events.Relationship

type RelationshipRemove added in v0.8.0

type RelationshipRemove = events.RelationshipRemove

type RequestOption added in v0.4.0

type RequestOption = rest.RequestOption

func WithReason added in v0.4.0

func WithReason(reason string) RequestOption

type Resolved added in v0.6.1

type Resolved = model.Resolved

type Resume added in v0.4.0

type Resume = gateway.Resume

type Resumed added in v0.6.1

type Resumed = events.Resumed

type Role added in v0.4.0

type Role = model.Role

type RoleColors added in v0.6.1

type RoleColors = model.RoleColors

type RoleCreate added in v0.8.0

type RoleCreate = model.RoleCreate

type RoleDelete added in v0.4.0

type RoleDelete = events.RoleDelete

type RoleEdit added in v0.8.0

type RoleEdit = model.RoleEdit

type RoleEvent added in v0.4.0

type RoleEvent = events.RoleEvent

type RoleHoistPosition added in v0.8.0

type RoleHoistPosition = model.RoleHoistPosition

type RolePosition added in v0.8.0

type RolePosition = model.RolePosition

type RoleUpdateBulk added in v0.6.1

type RoleUpdateBulk = events.RoleUpdateBulk

type SelectDefault added in v0.7.0

type SelectDefault = model.SelectDefault

func DefaultChannel added in v0.7.0

func DefaultChannel(id string) SelectDefault

func DefaultRole added in v0.7.0

func DefaultRole(id string) SelectDefault

func DefaultUser added in v0.7.0

func DefaultUser(id string) SelectDefault

type SelectMenu added in v0.7.0

type SelectMenu = model.SelectMenu

func ChannelSelect added in v0.7.0

func ChannelSelect(customID string, channelTypes ...int) SelectMenu

func MentionableSelect added in v0.7.0

func MentionableSelect(customID string) SelectMenu

func RoleSelect added in v0.7.0

func RoleSelect(customID string) SelectMenu

func StringSelect added in v0.7.0

func StringSelect(customID string, options ...SelectOption) SelectMenu

func UserSelect added in v0.7.0

func UserSelect(customID string) SelectMenu

type SelectOption added in v0.7.0

type SelectOption = model.SelectOption

func NewSelectOption added in v0.7.0

func NewSelectOption(label, value string) SelectOption

type Session added in v0.3.0

type Session = session.Session

func NewSession added in v0.4.0

func NewSession(config SessionConfig, options SessionOptions) (*Session, error)

type SessionConfig added in v0.4.0

type SessionConfig = session.Config

type SessionOptions added in v0.3.0

type SessionOptions = session.Options

type SessionStartLimit added in v0.8.0

type SessionStartLimit = model.SessionStartLimit

type SessionsReplace added in v0.6.1

type SessionsReplace = events.SessionsReplace

type ShardManager added in v0.3.0

type ShardManager = shard.Manager

func NewShardManager added in v0.4.0

func NewShardManager(config SessionConfig, options ShardOptions) (*ShardManager, error)

type ShardOptions added in v0.4.0

type ShardOptions = shard.Options

type State added in v0.3.0

type State = state.Cache

func NewState added in v0.3.0

func NewState(botID string) *State

type Sticker added in v0.8.0

type Sticker = model.Sticker

type StickerBulkResult added in v0.8.0

type StickerBulkResult = model.StickerBulkResult

type StickerCreate added in v0.8.0

type StickerCreate = model.StickerCreate

type StickerEdit added in v0.8.0

type StickerEdit = model.StickerEdit

type StickerItem added in v0.8.0

type StickerItem = model.StickerItem

type Subscription added in v0.8.0

type Subscription = gateway.Subscription

type TextInput added in v0.7.0

type TextInput = model.TextInput

func ParagraphInput added in v0.7.0

func ParagraphInput(customID, label string) TextInput

func ShortInput added in v0.7.0

func ShortInput(customID, label string) TextInput

type ThreadCreate added in v0.8.0

type ThreadCreate = events.ThreadCreate

type ThreadDelete added in v0.8.0

type ThreadDelete = events.ThreadDelete

type ThreadEdit added in v0.8.0

type ThreadEdit = model.ThreadEdit

type ThreadList added in v0.8.0

type ThreadList = model.ThreadList

type ThreadListSync added in v0.8.0

type ThreadListSync = events.ThreadListSync

type ThreadMember added in v0.8.0

type ThreadMember = model.ThreadMember

type ThreadMemberListUpdate added in v0.8.0

type ThreadMemberListUpdate = events.ThreadMemberListUpdate

type ThreadMemberPresence added in v0.8.0

type ThreadMemberPresence = events.ThreadMemberPresence

type ThreadMemberQuery added in v0.8.0

type ThreadMemberQuery = model.ThreadMemberQuery

type ThreadMembersUpdate added in v0.8.0

type ThreadMembersUpdate = events.ThreadMembersUpdate

type ThreadMetadata added in v0.8.0

type ThreadMetadata = model.ThreadMetadata

type ThreadSearch added in v0.8.0

type ThreadSearch = model.ThreadSearch

type ThreadStart added in v0.8.0

type ThreadStart = model.ThreadStart

type TypingStart added in v0.4.0

type TypingStart = events.TypingStart

type Upload added in v0.4.0

type Upload = rest.Upload

type UploadedAttachment added in v0.4.0

type UploadedAttachment = model.UploadedAttachment

type User

type User = model.User

type UserProfile added in v0.8.0

type UserProfile = model.UserProfile

type UserProfileQuery added in v0.8.0

type UserProfileQuery = model.UserProfileQuery

type VanityURL added in v0.8.0

type VanityURL = model.VanityURL

type VoiceJoin added in v0.3.0

type VoiceJoin = session.VoiceJoin

type VoiceMove added in v0.4.0

type VoiceMove = state.VoiceMove

type VoiceRefusedError added in v0.4.0

type VoiceRefusedError = session.VoiceRefusedError

type VoiceServerUpdate

type VoiceServerUpdate = model.VoiceServerUpdate

type VoiceState

type VoiceState = model.VoiceState

type Webhook added in v0.4.0

type Webhook = model.Webhook

type WebhookEdit added in v0.8.0

type WebhookEdit = model.WebhookEdit

type WebhookMessage added in v0.4.0

type WebhookMessage = model.WebhookMessage

type WebhookSource added in v0.8.0

type WebhookSource = model.WebhookSource

type WebhooksUpdate added in v0.6.1

type WebhooksUpdate = events.WebhooksUpdate

Directories

Path Synopsis
examples
panel command
ping command
slash-echo command
voice-player command
src
bot

Jump to

Keyboard shortcuts

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