Documentation
¶
Overview ¶
Package micup is a standalone Go client for Micup bots, following the Fluxer API that Micup runs on.
One import gives you the Gateway, a state cache, the REST client, an interaction router and the typed event payloads. Voice lives in the separate github.com/yestefir/micup.go/voice package so bots without voice do not pull in LiveKit and WebRTC.
micup.go keeps platform transport separate from application behavior. It does not implement music search, queues, command syntax, persistence or worker coordination; those stay with your application. mitune.net, one of the largest music bots on Micup, runs on it.
Quick start ¶
Create a Bot from a token, route events through an EventMux and run a Session:
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, m micup.MessageCreate) error {
if m.Author.Bot || m.Content != "!ping" {
return nil
}
_, err := b.REST.SendMessage(ctx, m.ChannelID, "pong", m.ID)
return err
}))
s, err := b.NewSession(micup.SessionOptions{Handler: mux.Handle})
if err != nil {
log.Fatal(err)
}
err = s.Run(ctx)
Gateway ¶
A Session owns one Gateway connection. It resumes after a disconnect, replays unprocessed events, re-identifies on the same socket, can use zstd stream compression, accepts ignored events and presence, and paces commands below Micup's limits. Gateway commands cover member requests, guild and channel member counts, Lazy Request subscriptions and voice state updates.
Bots in many guilds use a shard manager instead of a single session:
m, err := b.NewShardManager(micup.ShardOptions{ShardCount: 4, Session: options})
Every Micup dispatch event, including threads, calls, emojis, stickers and member lists, has a typed payload. Listen decodes the payload for your handler, so you never unmarshal JSON yourself.
State ¶
The state cache tracks guilds with their settings, emojis and stickers, channels and threads with permission overwrites, roles, member roles and voice states. It answers permission and role hierarchy questions, and SessionOptions.TrackMembers keeps maintained member inventories.
REST ¶
The REST client covers messages (send, edit, forward, crosspost, delete, bulk delete, list and 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. It follows Micup's rate limit rules, returns Micup's error codes as typed errors and offers paging iterators for long lists.
Slash commands and components ¶
Register commands over REST and answer them with an EventRouter, which routes commands, autocomplete, components and modals by name or pattern:
router := micup.NewEventRouter()
router.Command("queue add", addToQueue)
router.Component("page:*", changePage)
mux := micup.NewEventMux()
mux.On(micup.EventInteractionCreate, router.Listener())
A router returns ErrNoRoute for interactions it has no handler for.
Helpers ¶
Helpers cover mentions, timestamps, markdown escaping, an embed builder, media URLs, snowflake times and permission names, plus optional log/slog logging.
Voice ¶
Session.JoinVoice performs the join handshake with fast refusal and permission checks. The voice package turns the resulting grant into a LiveKit room, publishes Opus audio, and offers a player with FFmpeg sources, pause, skip and volume. FFmpeg built with libopus is required to publish audio.
Requirements and further reading ¶
micup.go needs Go 1.26.8 or newer and a Micup bot token. The README and the guides in the docs directory of the repository describe setup, events, messages, components, commands, guilds, channels, formatting, voice, architecture, security and migration from older versions. Runnable bots are in the examples directory: ping, slash-echo, panel, guild-tag and voice-player.
Index ¶
- Constants
- Variables
- func AttachmentURL(filename string) string
- func CompareSnowflakes(a, b string) int
- func DecodeEvent(event Event) (any, error)
- func EmojiString(emoji Emoji) string
- func ErrorCode(err error) string
- func EscapeMarkdown(text string) string
- func EventAs[T any](event Event) (T, error)
- func FormatTimestamp(at time.Time, style string) string
- func ImageData(contentType string, data []byte) (string, error)
- func InviteURL(base, code string) (string, error)
- func IsErrorCode(err error, codes ...string) bool
- func IsForbidden(err error) bool
- func IsNotFound(err error) bool
- func KnownEvents() []string
- func MentionChannel(channelID string) string
- func MentionRole(roleID string) string
- func MentionUser(userID string) string
- func ParseSnowflake(id string) (uint64, error)
- func RunGateway(ctx context.Context, options GatewayOptions, handler EventHandler) error
- func ShardForGuild(guildID string, shardCount int) (int, error)
- func SnowflakeAt(at time.Time) string
- func SnowflakeTime(id string) (time.Time, error)
- func TokenID(token string) (string, bool)
- func ValidateSubscriptions(subscriptions map[string]Subscription) error
- type APIError
- type ActionRow
- type AllowedMentions
- type Application
- type ApplicationCommand
- type ApplicationCommandsUpdate
- type ArchivedThreadQuery
- type Attachment
- type AuditLog
- type AuditLogChange
- type AuditLogEntry
- type AuditLogEntryCreate
- type AuditLogOptions
- type AuditLogQuery
- type AuditLogWebhook
- type Ban
- type BanEntry
- type Bot
- type Button
- type Call
- type CallDelete
- type Channel
- type ChannelCreate
- type ChannelEdit
- type ChannelFollowerStats
- type ChannelLookup
- type ChannelMemberCount
- type ChannelMemberCountsUpdate
- type ChannelMention
- type ChannelPinsUpdate
- type ChannelPosition
- type ChannelRecipient
- type ChannelUpdateBulk
- type ClientSession
- type CloseError
- type CommandChoice
- type CommandData
- type CommandDataOption
- type CommandOption
- type ComponentData
- type Config
- type CrosspostSource
- type CrosspostSourceGuild
- type CurrentMemberEdit
- type CustomStatus
- type DefaultReaction
- type Embed
- type EmbedAuthor
- type EmbedField
- type EmbedFooter
- type EmbedMedia
- type EmbedProvider
- type Emoji
- type EmojiBulkResult
- type EmojiCreate
- type Endpoints
- type EntranceSoundPlay
- type Event
- type EventHandler
- type EventListener
- type EventMux
- type EventRouter
- type ExpressionFailure
- type ExpressionMetadata
- type FieldError
- type File
- type FollowedChannel
- type ForumPost
- type ForumPostData
- type ForumPostStart
- type ForumTag
- type GatewayConn
- type GatewayError
- type GatewayInfo
- type GatewayOptions
- type GatewayRollout
- type Guild
- type GuildBan
- type GuildCount
- type GuildCountsUpdate
- type GuildCreate
- type GuildDelete
- type GuildEdit
- type GuildEmojisUpdate
- type GuildMember
- type GuildMemberRemove
- type GuildMembers
- type GuildQuery
- type GuildStickersUpdate
- type GuildTagChange
- type GuildUpdate
- type ImageOptions
- type Interaction
- type InteractionGuild
- type InteractionHandler
- type Invite
- type InviteCreate
- type InviteDelete
- type InviteOptions
- type KeptAttachment
- type Media
- type Member
- type MemberEdit
- type MemberListGroup
- type MemberListItem
- type MemberListMember
- type MemberListOperation
- type MemberListUpdate
- type MemberLookup
- type MemberQuery
- type MemberSearch
- type MemberSearchPage
- type MemberSearchResult
- type MemberSearchSupplemental
- type MembersChunk
- type MembersRateLimitedError
- type MembersRequest
- type Message
- type MessageCall
- type MessageCreate
- type MessageDelete
- type MessageDeleteBulk
- type MessageEdit
- type MessageForward
- type MessageOptions
- type MessageQuery
- type MessageReference
- type MessageSearch
- type MessageSearchResult
- type MessageSnapshot
- type MessageUpdate
- type Modal
- type ModalData
- type MutualGuild
- type Optional
- type PassiveUpdates
- type PermissionOverwrite
- type Permissions
- type Pin
- type PinQuery
- type PinsPage
- type Presence
- type PresenceUpdate
- type PresenceUpdateBulk
- type ProfileBadge
- type ProfileDetails
- type PublicApplication
- type RESTClient
- type RESTConfig
- type RateLimited
- type RateLimitedMeta
- type Reaction
- type ReactionAddMany
- type ReactionAddition
- type ReactionEvent
- type ReactionRemoveAll
- type ReactionRemoveEmoji
- type ReactionUsersPage
- type ReactionUsersQuery
- type Ready
- type ReadyApplication
- type RefreshedURL
- type Relationship
- type RelationshipRemove
- type RequestOption
- type Resolved
- type Resume
- type Resumed
- type Role
- type RoleColors
- type RoleCreate
- type RoleDelete
- type RoleEdit
- type RoleEvent
- type RoleHoistPosition
- type RolePosition
- type RoleUpdateBulk
- type SelectDefault
- type SelectMenu
- type SelectOption
- type Session
- type SessionConfig
- type SessionOptions
- type SessionStartLimit
- type SessionsReplace
- type ShardManager
- type ShardOptions
- type State
- type Sticker
- type StickerBulkResult
- type StickerCreate
- type StickerEdit
- type StickerItem
- type Subscription
- type TextInput
- type ThreadCreate
- type ThreadDelete
- type ThreadEdit
- type ThreadList
- type ThreadListSync
- type ThreadMember
- type ThreadMemberListUpdate
- type ThreadMemberPresence
- type ThreadMemberQuery
- type ThreadMembersUpdate
- type ThreadMetadata
- type ThreadSearch
- type ThreadStart
- type TypingStart
- type Upload
- type UploadedAttachment
- type User
- type UserProfile
- type UserProfileQuery
- type VanityURL
- type VoiceJoin
- type VoiceMove
- type VoiceRefusedError
- type VoiceServerUpdate
- type VoiceState
- type Webhook
- type WebhookEdit
- type WebhookMessage
- type WebhookSource
- type WebhooksUpdate
Examples ¶
Constants ¶
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 )
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 )
const ( RelationshipFriend = events.RelationshipFriend RelationshipBlocked = events.RelationshipBlocked RelationshipIncomingRequest = events.RelationshipIncomingRequest RelationshipOutgoingRequest = events.RelationshipOutgoingRequest )
const ( CodeInvalidFormBody = rest.CodeInvalidFormBody CodeRateLimited = rest.CodeRateLimited CodeSlowmodeRateLimited = rest.CodeSlowmodeRateLimited CodeResourceLocked = rest.CodeResourceLocked 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 )
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 )
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 )
const ( FlagDebounceMessageReactions = gateway.FlagDebounceMessageReactions FlagChannelThreads = gateway.FlagChannelThreads FlagGuildVisits = gateway.FlagGuildVisits )
const ( StatusOnline = model.StatusOnline StatusIdle = model.StatusIdle StatusDND = model.StatusDND StatusInvisible = model.StatusInvisible StatusOffline = model.StatusOffline MaxCustomStatusText = model.MaxCustomStatusText MaxCustomStatusEmoji = model.MaxCustomStatusEmoji )
const ( VoiceChannelFull = gateway.VoiceChannelFull VoiceP2PConsentRequired = gateway.VoiceP2PConsentRequired )
const ( DefaultMinBackoff = session.DefaultMinBackoff DefaultMaxBackoff = session.DefaultMaxBackoff )
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 )
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 )
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 )
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 )
const ( MaxEmbeds = model.MaxEmbeds MaxAttachments = model.MaxAttachments MaxBulkDelete = model.MaxBulkDelete MaxMessagesPerPage = model.MaxMessagesPerPage MentionUsers = model.MentionUsers MentionRoles = model.MentionRoles MentionEveryone = model.MentionEveryone )
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 )
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 )
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 )
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 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 )
const ( ImagePNG = model.ImagePNG ImageJPEG = model.ImageJPEG ImageWebP = model.ImageWebP ImageGIF = model.ImageGIF ImageAVIF = model.ImageAVIF ElevatedPermissions = model.ElevatedPermissions )
const DefaultIdentifyInterval = shard.DefaultIdentifyInterval
const DefaultOrigin = discovery.DefaultOrigin
const MaxGuildsPerShard = bot.MaxGuildsPerShard
const SnowflakeEpoch = model.SnowflakeEpoch
const Version = bot.Version
Variables ¶
var ( ErrReconnectRequested = gateway.ErrReconnectRequested ErrGatewayClosed = gateway.ErrClosed )
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 )
var ( ErrShardNotOwned = shard.ErrNotOwned ErrShardManagerRunning = shard.ErrRunning )
var ErrNoRoute = events.ErrNoRoute
Functions ¶
func AttachmentURL ¶ added in v0.8.0
func CompareSnowflakes ¶ added in v0.8.0
func DecodeEvent ¶ added in v0.6.1
func EmojiString ¶ added in v0.4.0
func EscapeMarkdown ¶ added in v0.8.0
func FormatTimestamp ¶ added in v0.8.0
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 IsErrorCode ¶ added in v0.8.0
func IsForbidden ¶ added in v0.8.0
func IsNotFound ¶ added in v0.8.0
func KnownEvents ¶ added in v0.6.1
func KnownEvents() []string
func MentionChannel ¶ added in v0.8.0
func MentionRole ¶ added in v0.8.0
func MentionUser ¶ added in v0.8.0
func ParseSnowflake ¶ added in v0.8.0
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 SnowflakeAt ¶ added in v0.8.0
func ValidateSubscriptions ¶ added in v0.8.0
func ValidateSubscriptions(subscriptions map[string]Subscription) error
Types ¶
type ActionRow ¶ added in v0.4.0
func DisableButtons ¶ added in v0.4.0
func DisableComponents ¶ added in v0.7.0
func NewActionRow ¶ added in v0.4.0
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 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 Button ¶ added in v0.4.0
func DangerButton ¶ added in v0.4.0
func LinkButton ¶ added in v0.4.0
func PrimaryButton ¶ added in v0.4.0
func SecondaryButton ¶ added in v0.4.0
func SuccessButton ¶ added in v0.4.0
type CallDelete ¶ added in v0.8.0
type CallDelete = events.CallDelete
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 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 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 EmojiBulkResult ¶ added in v0.8.0
type EmojiBulkResult = model.EmojiBulkResult
type EmojiCreate ¶ added in v0.8.0
type EmojiCreate = model.EmojiCreate
type EntranceSoundPlay ¶ added in v0.8.0
type EntranceSoundPlay = events.EntranceSoundPlay
type EventHandler ¶
type EventListener ¶ added in v0.6.1
type EventMux ¶ added in v0.6.1
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
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 FollowedChannel ¶ added in v0.8.0
type FollowedChannel = model.FollowedChannel
type ForumPostData ¶ added in v0.8.0
type ForumPostData = model.ForumPostData
type ForumPostStart ¶ added in v0.8.0
type ForumPostStart = model.ForumPostStart
type GatewayConn ¶ added in v0.4.0
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 GatewayRollout ¶ added in v0.6.1
type GatewayRollout = events.GatewayRollout
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 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 GuildTagChange ¶ added in v1.1.0
type GuildTagChange = events.GuildTagChange
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 InviteCreate ¶ added in v0.8.0
type InviteCreate = model.InviteCreate
type InviteDelete ¶ added in v0.6.1
type InviteDelete = events.InviteDelete
type InviteOptions ¶ added in v1.1.0
type InviteOptions = bot.InviteOptions
type KeptAttachment ¶ added in v0.8.0
type KeptAttachment = model.KeptAttachment
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 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 MutualGuild ¶ added in v0.8.0
type MutualGuild = model.MutualGuild
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 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 PublicApplication ¶ added in v1.1.0
type PublicApplication = rest.PublicApplication
type RESTClient ¶ added in v0.4.0
func NewREST ¶ added in v0.4.0
func NewREST(config RESTConfig) (*RESTClient, error)
type RESTConfig ¶ added in v0.4.0
type RateLimited ¶ added in v0.6.1
type RateLimited = events.RateLimited
type RateLimitedMeta ¶ added in v0.6.1
type RateLimitedMeta = events.RateLimitedMeta
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 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 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 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
func NewSession ¶ added in v0.4.0
func NewSession(config SessionConfig, options SessionOptions) (*Session, error)
type SessionConfig ¶ added in v0.4.0
type SessionOptions ¶ added in v0.3.0
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
func NewShardManager ¶ added in v0.4.0
func NewShardManager(config SessionConfig, options ShardOptions) (*ShardManager, error)
type ShardOptions ¶ added in v0.4.0
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
func ParagraphInput ¶ added in v0.7.0
func ShortInput ¶ added in v0.7.0
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 UploadedAttachment ¶ added in v0.4.0
type UploadedAttachment = model.UploadedAttachment
type UserProfile ¶ added in v0.8.0
type UserProfile = model.UserProfile
type UserProfileQuery ¶ added in v0.8.0
type UserProfileQuery = model.UserProfileQuery
type VoiceRefusedError ¶ added in v0.4.0
type VoiceRefusedError = session.VoiceRefusedError
type VoiceServerUpdate ¶
type VoiceServerUpdate = model.VoiceServerUpdate
type VoiceState ¶
type VoiceState = model.VoiceState
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
|
|
|
guild-tag
command
|
|
|
panel
command
|
|
|
ping
command
|
|
|
slash-echo
command
|
|
|
voice-player
command
|
|
|
src
|
|
|
bot
Package bot is the entry point behind micup.New.
|
Package bot is the entry point behind micup.New. |
|
discovery
Package discovery resolves Micup's /.well-known endpoints and checks that discovered origins are safe to connect to.
|
Package discovery resolves Micup's /.well-known endpoints and checks that discovered origins are safe to connect to. |
|
events
Package events holds the typed payload for every Gateway dispatch event, the registry that decodes them, the event mux and the interaction router.
|
Package events holds the typed payload for every Gateway dispatch event, the registry that decodes them, the event mux and the interaction router. |
|
gateway
Package gateway implements a single Gateway connection: opcodes, close codes, event names, resume state, zstd stream compression and command pacing below Micup's limits.
|
Package gateway implements a single Gateway connection: opcodes, close codes, event names, resume state, zstd stream compression and command pacing below Micup's limits. |
|
internal/anonymize
command
|
|
|
model
Package model defines the domain types shared by REST and the Gateway: messages, channels, guilds, members, roles, embeds, components, commands, permissions and snowflakes, with helpers such as the embed builder and permission names.
|
Package model defines the domain types shared by REST and the Gateway: messages, channels, guilds, members, roles, embeds, components, commands, permissions and snowflakes, with helpers such as the embed builder and permission names. |
|
rest
Package rest is the authenticated Micup REST client.
|
Package rest is the authenticated Micup REST client. |
|
session
Package session runs a reconnecting, resuming Gateway session for one shard, maintains member inventories and performs the voice join handshake.
|
Package session runs a reconnecting, resuming Gateway session for one shard, maintains member inventories and performs the voice join handshake. |
|
shard
Package shard maps guilds to shards and runs several sessions as one manager.
|
Package shard maps guilds to shards and runs several sessions as one manager. |
|
state
Package state caches guilds, channels, threads, roles, members and voice states from Gateway events and answers permission and role hierarchy questions.
|
Package state caches guilds, channels, threads, roles, members and voice states from Gateway events and answers permission and role hierarchy questions. |
|
voice
Package voice publishes PCM audio to a LiveKit room as Opus through FFmpeg and provides a paced player.
|
Package voice publishes PCM audio to a LiveKit room as Opus through FFmpeg and provides a paced player. |
|
Package voice joins Micup voice channels' LiveKit rooms and publishes Opus audio.
|
Package voice joins Micup voice channels' LiveKit rooms and publishes Opus audio. |