Skip to content

discord #

Constants #

const locale_ko = Locale('ko')

Korean (한국어)

const locale_zh_tw = Locale('zh-TW')

Chinese, Taiwan (繁體中文)

const locale_ja = Locale('ja')

Japanese (日本語)

const locale_zh_cn = Locale('zh-CN')

Chinese, China (中文)

const locale_th = Locale('th')

Thai (ไทย)

const locale_hi = Locale('hi')

Hindi (हिन्दी)

const locale_uk = Locale('uk')

Ukrainian (Українська)

const locale_ru = Locale('ru')

Russian (Pусский)

const locale_bg = Locale('bg')

Bulgarian (български)

const locale_el = Locale('el')

Greek (Ελληνικά)

const locale_cs = Locale('cs')

Czech (Čeština)

const locale_tr = Locale('tr')

Turkish (Türkçe)

const locale_vi = Locale('vi')

Vietnamese (Tiếng Việt)

const locale_sv_se = Locale('sv-SE')

Swedish (Svenska)

const locale_fi = Locale('fi')

Finnish (Suomi)

const locale_ro = Locale('ro')

Romanian, Romania (Română)

const locale_pt_br = Locale('pt-BR')

Portuguese, Brazilian (Português do Brasil)

const locale_pl = Locale('pl')

Polish (Polski)

const locale_no = Locale('no')

Norweigan (Norsk)

const locale_nl = Locale('nl')

Dutch (Nederlands)

const locale_hu = Locale('hu')

Hungarian (Magyar)

const locale_lt = Locale('lt')

Lithuanian (Lietuviškai)

const locale_it = Locale('it')

Italian (Italiano)

const locale_hr = Locale('hr')

Croatian (Hrvatski)

const locale_fr = Locale('fr')

French (Français)

const locale_es_419 = Locale('es-419')

Spanish, LATAM (Español, LATAM)

const locale_es_es = Locale('es-ES')

Spanish (Español)

const locale_en_us = Locale('en-US')

English, US (English, US)

const locale_en_gb = Locale('en-GB')

English, UK (English, UK)

const locale_de = Locale('de')

German (Deutsch)

const locale_da = Locale('da')

Danish (Dansk)

const locale_id = Locale('id')

Indonesian (Bahasa Indonesia)

const sentinel_duration = time.infinite
const sentinel_image = Image(NoneFile{})
const sentinel_permissions = unsafe { Permissions(max_u64) }
const sentinel_snowflakes = []Snowflake{}
const sentinel_snowflake = Snowflake(0)
const sentinel_number = math.nan()

compare using math.is_nan(target)

const sentinel_string = 'darp'

Compare using target.str == sentinel_string.str

const sentinel_time = time.unix(0)
const sentinel_int = 1886544228

ASCII-encoded 'darp'

const sentinel_forum_tags = []ForumTag{}
const sentinel_default_reaction = DefaultReaction{
	emoji_id: sentinel_snowflake
}
const sentinel_sort_order_type = unsafe { SortOrderType(sentinel_int) }
const sentinel_permission_overwrites = []PermissionOverwrite{}
const team_member_role_admin = TeamMemberRole('admin')
const team_member_role_developer = TeamMemberRole('developer')
const team_member_role_read_only = TeamMemberRole('read_only')
const default_cdn_url = 'https://cdn.discordapp.com'
const cdn = new_cdn()
const default_user_agent ='DiscordBot (https://github.com/DarpHome/discord.v, 1.10.0) V ${@}'
const snowflake_epoch = u64(1420070400000)

fn bearer #

fn bearer(token string, config RESTConfig) REST

bearer accepts access token and returns REST that can be used to make requests

Note: token should not contain Bearer prefix

fn bot #

fn bot(token string, config BotConfig) GatewayClient

bot creates a new [GatewayClient] that can be used to listen events. Use launch to connect to gateway.

Note: token should not contain Bot prefix

fn build_multipart_with_files #

fn build_multipart_with_files(files []File, j json2.Any) (string, string)

fn bulk_delete_in_map #

fn bulk_delete_in_map[K, V](mut m map[K]V, a []K)

fn cache_add1 #

fn cache_add1[T](mut m1 map[Snowflake]T, max_size ?int, check fn (id1 Snowflake, o T) bool, id1 Snowflake, o T)

fn cache_add2 #

fn cache_add2[T](mut m1 map[Snowflake]map[Snowflake]T, max_size1 ?int, max_size2 ?int, check fn (id1 Snowflake, id2 Snowflake, o T) bool, id1 Snowflake, id2 Snowflake, o T)

fn compute_permissions #

fn compute_permissions(member GuildMember, channel Channel, guild Guild) Permissions

Overwrites can be used to apply certain permissions to roles or members on a channel-level. Applicable permissions are indicated by a T for text channels, V for voice channels, or S for stage channels in the table above. When using overwrites, there are cases where permission collisions could occur for a user; that is to say, the user may have certain overwrites with permissions that contradict each other or their guild-level role permissions. With this in mind, permissions are applied to users in the following hierarchy:1. Base permissions given to @everyone are applied at a guild level2. Permissions allowed to a user by their roles are applied at a guild level3. Overwrites that deny permissions for @everyone are applied at a channel level4. Overwrites that allow permissions for @everyone are applied at a channel level5. Overwrites that deny permissions for specific roles are applied at a channel level6. Overwrites that allow permissions for specific roles are applied at a channel level7. Member-specific overwrites that deny permissions are applied at a channel level8. Member-specific overwrites that allow permissions are applied at a channel levelMore at https://discord.com/developers/docs/topics/permissions#permission-overwrites...

fn extract_id_from_token #

fn extract_id_from_token(token string) !Snowflake

fn format_iso8601 #

fn format_iso8601(t time.Time) string

2015-04-26T06:26:56.936000+00:00

fn is_sentinel #

fn is_sentinel[T](target T) bool

is_sentinel reports whether target is sentinel

fn maybe_map #

fn maybe_map[T, X](a []T, f fn (T) !X) ![]X

fn maybe_map_map #

fn maybe_map_map[T, U, X, Y](m map[T]U, f fn (T, U) !(X, Y)) !map[X]Y

fn milliseconds_as_time #

fn milliseconds_as_time(ts i64) time.Time

fn multipart_form_body #

fn multipart_form_body(files map[string][]http.FileData) (string, string)

fn new_cdn #

fn new_cdn(params NewCDNParams) CDN

fn new_rest #

fn new_rest(token string, config RESTConfig) REST

fn new_rpc #

fn new_rpc(file io.ReaderWriter) !RPC

fn null #

fn null[T]() NullOr[T]

we are not going to support JavaScript

fn oauth2_app #

fn oauth2_app(client_id Snowflake, client_secret string, config RESTConfig) REST

oauth2_app accepts client ID and secret and returns REST with Basic token

fn some #

fn some[T](val T) NullOr[T]

fn verify_request #

fn verify_request(public_key ed25519.PublicKey, req http.Request) bool

fn Action.parse #

fn Action.parse(j json2.Any) !Action

fn ActionMetadata.parse #

fn ActionMetadata.parse(j json2.Any) !ActionMetadata

fn ActionRow.internal_parse #

fn ActionRow.internal_parse(j map[string]json2.Any) !ActionRow

fn ActionRow.parse #

fn ActionRow.parse(j json2.Any) !ActionRow

fn Activity.parse #

fn Activity.parse(j json2.Any) !Activity

fn ActivityAssets.parse #

fn ActivityAssets.parse(j json2.Any) !ActivityAssets

fn ActivityButton.parse #

fn ActivityButton.parse(j json2.Any) !ActivityButton

fn ActivityEmoji.parse #

fn ActivityEmoji.parse(j json2.Any) !ActivityEmoji

fn ActivityParty.parse #

fn ActivityParty.parse(j json2.Any) !ActivityParty

fn ActivitySecrets.parse #

fn ActivitySecrets.parse(j json2.Any) !ActivitySecrets

fn ActivityTimestamps.parse #

fn ActivityTimestamps.parse(j json2.Any) !ActivityTimestamps

fn Application.parse #

fn Application.parse(j json2.Any) !Application

fn ApplicationCommand.parse #

fn ApplicationCommand.parse(j json2.Any) !ApplicationCommand

fn ApplicationCommandData.parse #

fn ApplicationCommandData.parse(j json2.Any) !ApplicationCommandData

fn ApplicationCommandInteractionDataOption.parse #

fn ApplicationCommandInteractionDataOption.parse(j json2.Any) !ApplicationCommandInteractionDataOption

fn ApplicationCommandInteractionDataOptionValue.parse #

fn ApplicationCommandInteractionDataOptionValue.parse(j json2.Any) !ApplicationCommandInteractionDataOptionValue

fn ApplicationCommandOption.parse #

fn ApplicationCommandOption.parse(j json2.Any) !ApplicationCommandOption

fn ApplicationCommandOptionChoice.parse #

fn ApplicationCommandOptionChoice.parse(j json2.Any) !ApplicationCommandOptionChoice

fn ApplicationCommandPermission.parse #

fn ApplicationCommandPermission.parse(j json2.Any) !ApplicationCommandPermission

fn ApplicationCommandPermissionsUpdateEvent.parse #

fn ApplicationCommandPermissionsUpdateEvent.parse(j json2.Any, base BaseEvent) !ApplicationCommandPermissionsUpdateEvent

fn ApplicationRoleConnection.parse #

fn ApplicationRoleConnection.parse(j json2.Any) !ApplicationRoleConnection

fn ApplicationRoleConnectionMetadata.parse #

fn ApplicationRoleConnectionMetadata.parse(j json2.Any) !ApplicationRoleConnectionMetadata

fn Attachment.parse #

fn Attachment.parse(j json2.Any) !Attachment

fn AuditEntryInfo.parse #

fn AuditEntryInfo.parse(j json2.Any) !AuditEntryInfo

fn AuditLog.parse #

fn AuditLog.parse(j json2.Any) !AuditLog

fn AuditLogChange.parse #

fn AuditLogChange.parse(j json2.Any) !AuditLogChange

fn AuditLogEntry.parse #

fn AuditLogEntry.parse(j json2.Any) !AuditLogEntry

fn AutoModerationActionExecutionEvent.parse #

fn AutoModerationActionExecutionEvent.parse(j json2.Any, base BaseEvent) !AutoModerationActionExecutionEvent

fn AutoModerationRule.parse #

fn AutoModerationRule.parse(j json2.Any) !AutoModerationRule

fn AutoModerationRuleCreateEvent.parse #

fn AutoModerationRuleCreateEvent.parse(j json2.Any, base BaseEvent) !AutoModerationRuleCreateEvent

fn AutoModerationRuleDeleteEvent.parse #

fn AutoModerationRuleDeleteEvent.parse(j json2.Any, base BaseEvent) !AutoModerationRuleDeleteEvent

fn AutoModerationRuleUpdateEvent.parse #

fn AutoModerationRuleUpdateEvent.parse(j json2.Any, base BaseEvent) !AutoModerationRuleUpdateEvent

fn AvatarDecorationData.parse #

fn AvatarDecorationData.parse(j json2.Any) !AvatarDecorationData

fn Ban.parse #

fn Ban.parse(j json2.Any) !Ban

fn BulkBanResponse.parse #

fn BulkBanResponse.parse(j json2.Any) !BulkBanResponse

fn Button.internal_parse #

fn Button.internal_parse(j map[string]json2.Any) !Button

fn Button.parse #

fn Button.parse(j json2.Any) !Button

fn CDNAttachment.parse #

fn CDNAttachment.parse(url string) !CDNAttachment

fn Channel.parse #

fn Channel.parse(j json2.Any) !Channel

fn ChannelCreateEvent.parse #

fn ChannelCreateEvent.parse(j json2.Any, base BaseEvent) !ChannelCreateEvent

fn ChannelDeleteEvent.parse #

fn ChannelDeleteEvent.parse(j json2.Any, base BaseEvent) !ChannelDeleteEvent

fn ChannelMention.parse #

fn ChannelMention.parse(j json2.Any) !ChannelMention

fn ChannelPinsUpdateEvent.parse #

fn ChannelPinsUpdateEvent.parse(j json2.Any, base BaseEvent) !ChannelPinsUpdateEvent

fn ChannelSelect.internal_parse #

fn ChannelSelect.internal_parse(j map[string]json2.Any) !ChannelSelect

fn ChannelSelect.parse #

fn ChannelSelect.parse(j json2.Any) !ChannelSelect

fn ChannelUpdateEvent.parse #

fn ChannelUpdateEvent.parse(j json2.Any, base BaseEvent) !ChannelUpdateEvent

fn ClientStatus.parse #

fn ClientStatus.parse(j json2.Any) !ClientStatus

fn Component.parse #

fn Component.parse(j json2.Any) !Component

fn ComponentEmoji.parse #

fn ComponentEmoji.parse(j json2.Any) !ComponentEmoji

fn Connection.parse #

fn Connection.parse(j json2.Any) !Connection

fn DefaultReaction.parse #

fn DefaultReaction.parse(j json2.Any) !DefaultReaction

fn DefaultValue.parse #

fn DefaultValue.parse(j json2.Any) !DefaultValue

fn Embed.parse #

fn Embed.parse(j json2.Any) !Embed

fn EmbedAuthor.parse #

fn EmbedAuthor.parse(j json2.Any) !EmbedAuthor

fn EmbedField.parse #

fn EmbedField.parse(j json2.Any) !EmbedField

fn EmbedFooter.parse #

fn EmbedFooter.parse(j json2.Any) !EmbedFooter

fn EmbedImage.parse #

fn EmbedImage.parse(j json2.Any) !EmbedImage

fn EmbedProvider.parse #

fn EmbedProvider.parse(j json2.Any) !EmbedProvider

fn EmbedThumbnail.parse #

fn EmbedThumbnail.parse(j json2.Any) !EmbedThumbnail

fn EmbedVideo.parse #

fn EmbedVideo.parse(j json2.Any) !EmbedVideo

fn Emoji.parse #

fn Emoji.parse(j json2.Any) !Emoji

fn Entitlement.parse #

fn Entitlement.parse(j json2.Any) !Entitlement

fn EntitlementCreateEvent.parse #

fn EntitlementCreateEvent.parse(j json2.Any, base BaseEvent) !EntitlementCreateEvent

fn EntitlementDeleteEvent.parse #

fn EntitlementDeleteEvent.parse(j json2.Any, base BaseEvent) !EntitlementDeleteEvent

fn EntitlementUpdateEvent.parse #

fn EntitlementUpdateEvent.parse(j json2.Any, base BaseEvent) !EntitlementUpdateEvent

fn FollowedChannel.parse #

fn FollowedChannel.parse(j json2.Any) !FollowedChannel

fn ForumTag.parse #

fn ForumTag.parse(j json2.Any) !ForumTag

fn GatewayConfiguration.parse #

fn GatewayConfiguration.parse(j json2.Any) !GatewayConfiguration

fn GatewayIntents.all #

fn GatewayIntents.all() GatewayIntents

fn GatewayIntents.all_privileged #

fn GatewayIntents.all_privileged() GatewayIntents

fn GatewayIntents.all_unprivileged #

fn GatewayIntents.all_unprivileged() GatewayIntents

fn Guild.internal_parse #

fn Guild.internal_parse(j map[string]json2.Any) !Guild

fn Guild.parse #

fn Guild.parse(j json2.Any) !Guild

fn Guild2.internal_parse #

fn Guild2.internal_parse(j map[string]json2.Any) !Guild2

fn Guild2.parse #

fn Guild2.parse(j json2.Any) !Guild2

fn GuildApplicationCommandPermissions.parse #

fn GuildApplicationCommandPermissions.parse(j json2.Any) !GuildApplicationCommandPermissions

fn GuildAuditLogEntryCreateEvent.parse #

fn GuildAuditLogEntryCreateEvent.parse(j json2.Any, base BaseEvent) !GuildAuditLogEntryCreateEvent

fn GuildBanAddEvent.parse #

fn GuildBanAddEvent.parse(j json2.Any, base BaseEvent) !GuildBanAddEvent

fn GuildBanRemoveEvent.parse #

fn GuildBanRemoveEvent.parse(j json2.Any, base BaseEvent) !GuildBanRemoveEvent

fn GuildCreateEvent.parse #

fn GuildCreateEvent.parse(j json2.Any, base BaseEvent) !GuildCreateEvent

fn GuildDeleteEvent.parse #

fn GuildDeleteEvent.parse(j json2.Any, base BaseEvent) !GuildDeleteEvent

fn GuildEmojisUpdateEvent.parse #

fn GuildEmojisUpdateEvent.parse(j json2.Any, base BaseEvent) !GuildEmojisUpdateEvent

fn GuildIntegrationsUpdateEvent.parse #

fn GuildIntegrationsUpdateEvent.parse(j json2.Any, base BaseEvent) !GuildIntegrationsUpdateEvent

fn GuildMember.parse #

fn GuildMember.parse(j json2.Any) !GuildMember

fn GuildMember2.parse #

fn GuildMember2.parse(j json2.Any) !GuildMember2

fn GuildMemberAddEvent.parse #

fn GuildMemberAddEvent.parse(j json2.Any, base BaseEvent) !GuildMemberAddEvent

fn GuildMemberRemoveEvent.parse #

fn GuildMemberRemoveEvent.parse(j json2.Any, base BaseEvent) !GuildMemberRemoveEvent

fn GuildMemberUpdateEvent.parse #

fn GuildMemberUpdateEvent.parse(j json2.Any, base BaseEvent) !GuildMemberUpdateEvent

fn GuildMembersChunkEvent.parse #

fn GuildMembersChunkEvent.parse(j json2.Any, base BaseEvent) !GuildMembersChunkEvent

fn GuildOnboarding.parse #

fn GuildOnboarding.parse(j json2.Any) !GuildOnboarding

fn GuildPreview.parse #

fn GuildPreview.parse(j json2.Any) !GuildPreview

fn GuildRoleCreateEvent.parse #

fn GuildRoleCreateEvent.parse(j json2.Any, base BaseEvent) !GuildRoleCreateEvent

fn GuildRoleDeleteEvent.parse #

fn GuildRoleDeleteEvent.parse(j json2.Any, base BaseEvent) !GuildRoleDeleteEvent

fn GuildRoleUpdateEvent.parse #

fn GuildRoleUpdateEvent.parse(j json2.Any, base BaseEvent) !GuildRoleUpdateEvent

fn GuildScheduledEvent.parse #

fn GuildScheduledEvent.parse(j json2.Any) !GuildScheduledEvent

fn GuildScheduledEventCreateEvent.parse #

fn GuildScheduledEventCreateEvent.parse(j json2.Any, base BaseEvent) !GuildScheduledEventCreateEvent

fn GuildScheduledEventDeleteEvent.parse #

fn GuildScheduledEventDeleteEvent.parse(j json2.Any, base BaseEvent) !GuildScheduledEventDeleteEvent

fn GuildScheduledEventEntityMetadata.parse #

fn GuildScheduledEventEntityMetadata.parse(j json2.Any) !GuildScheduledEventEntityMetadata

fn GuildScheduledEventUpdateEvent.parse #

fn GuildScheduledEventUpdateEvent.parse(j json2.Any, base BaseEvent) !GuildScheduledEventUpdateEvent

fn GuildScheduledEventUser.parse #

fn GuildScheduledEventUser.parse(j json2.Any) !GuildScheduledEventUser

fn GuildScheduledEventUserAddEvent.parse #

fn GuildScheduledEventUserAddEvent.parse(j json2.Any, base BaseEvent) !GuildScheduledEventUserAddEvent

fn GuildScheduledEventUserRemoveEvent.parse #

fn GuildScheduledEventUserRemoveEvent.parse(j json2.Any, base BaseEvent) !GuildScheduledEventUserRemoveEvent

fn GuildStickersUpdateEvent.parse #

fn GuildStickersUpdateEvent.parse(j json2.Any, base BaseEvent) !GuildStickersUpdateEvent

fn GuildTemplate.parse #

fn GuildTemplate.parse(j json2.Any) !GuildTemplate

fn GuildUpdateEvent.parse #

fn GuildUpdateEvent.parse(j json2.Any, base BaseEvent) !GuildUpdateEvent

fn GuildVanityUrl.parse #

fn GuildVanityUrl.parse(j json2.Any) !GuildVanityUrl

fn GuildWidget.parse #

fn GuildWidget.parse(j json2.Any) !GuildWidget

fn GuildWidgetSettings.parse #

fn GuildWidgetSettings.parse(j json2.Any) !GuildWidgetSettings

fn InstallParams.parse #

fn InstallParams.parse(j json2.Any) !InstallParams

fn Integration.parse #

fn Integration.parse(j json2.Any) !Integration

fn Integration2.parse #

fn Integration2.parse(j json2.Any) !Integration2

fn IntegrationAccount.parse #

fn IntegrationAccount.parse(j json2.Any) !IntegrationAccount

fn IntegrationApplication.parse #

fn IntegrationApplication.parse(j json2.Any) !IntegrationApplication

fn IntegrationCreateEvent.parse #

fn IntegrationCreateEvent.parse(j json2.Any, base BaseEvent) !IntegrationCreateEvent

fn IntegrationDeleteEvent.parse #

fn IntegrationDeleteEvent.parse(j json2.Any, base BaseEvent) !IntegrationDeleteEvent

fn IntegrationUpdateEvent.parse #

fn IntegrationUpdateEvent.parse(j json2.Any, base BaseEvent) !IntegrationUpdateEvent

fn Interaction.parse #

fn Interaction.parse(j json2.Any) !Interaction

fn InteractionCreateEvent.parse #

fn InteractionCreateEvent.parse(j json2.Any, base BaseEvent) !InteractionCreateEvent

fn Invite.parse #

fn Invite.parse(j json2.Any) !Invite

fn InviteCreateEvent.parse #

fn InviteCreateEvent.parse(j json2.Any, base BaseEvent) !InviteCreateEvent

fn InviteDeleteEvent.parse #

fn InviteDeleteEvent.parse(j json2.Any, base BaseEvent) !InviteDeleteEvent

fn InviteMetadata.parse #

fn InviteMetadata.parse(j json2.Any) !InviteMetadata

fn ListThreadsResponse.parse #

fn ListThreadsResponse.parse(j json2.Any) !ListThreadsResponse

fn MentionableSelect.internal_parse #

fn MentionableSelect.internal_parse(j map[string]json2.Any) !MentionableSelect

fn MentionableSelect.parse #

fn MentionableSelect.parse(j json2.Any) !MentionableSelect

fn Message.parse #

fn Message.parse(j json2.Any) !Message

fn Message2.parse #

fn Message2.parse(j json2.Any) !Message2

fn MessageActivity.parse #

fn MessageActivity.parse(j json2.Any) !MessageActivity

fn MessageComponentData.parse #

fn MessageComponentData.parse(j json2.Any) !MessageComponentData

fn MessageCreateEvent.parse #

fn MessageCreateEvent.parse(j json2.Any, base BaseEvent) !MessageCreateEvent

fn MessageDeleteBulkEvent.parse #

fn MessageDeleteBulkEvent.parse(j json2.Any, base BaseEvent) !MessageDeleteBulkEvent

fn MessageDeleteEvent.parse #

fn MessageDeleteEvent.parse(j json2.Any, base BaseEvent) !MessageDeleteEvent

fn MessageInteraction.parse #

fn MessageInteraction.parse(j json2.Any) !MessageInteraction

fn MessageReactionAddEvent.parse #

fn MessageReactionAddEvent.parse(j json2.Any, base BaseEvent) !MessageReactionAddEvent

fn MessageReactionRemoveAllEvent.parse #

fn MessageReactionRemoveAllEvent.parse(j json2.Any, base BaseEvent) !MessageReactionRemoveAllEvent

fn MessageReactionRemoveEmojiEvent.parse #

fn MessageReactionRemoveEmojiEvent.parse(j json2.Any, base BaseEvent) !MessageReactionRemoveEmojiEvent

fn MessageReactionRemoveEvent.parse #

fn MessageReactionRemoveEvent.parse(j json2.Any, base BaseEvent) !MessageReactionRemoveEvent

fn MessageReference.parse #

fn MessageReference.parse(j json2.Any) !MessageReference

fn MessageUpdateEvent.parse #

fn MessageUpdateEvent.parse(j json2.Any, base BaseEvent) !MessageUpdateEvent

fn ModalSubmitData.parse #

fn ModalSubmitData.parse(j json2.Any) !ModalSubmitData

fn Number.parse #

fn Number.parse(j json2.Any) !Number

fn OnboardingPrompt.parse #

fn OnboardingPrompt.parse(j json2.Any) !OnboardingPrompt

fn PartialApplication.parse #

fn PartialApplication.parse(j json2.Any) !PartialApplication

fn PartialChannel.parse #

fn PartialChannel.parse(j json2.Any) !PartialChannel

fn PartialEmoji.parse #

fn PartialEmoji.parse(j json2.Any) !PartialEmoji

fn PartialGuild.parse #

fn PartialGuild.parse(j json2.Any) !PartialGuild

fn PartialGuildMember.parse #

fn PartialGuildMember.parse(j json2.Any) !PartialGuildMember

fn PartialIntegration.parse #

fn PartialIntegration.parse(j json2.Any) !PartialIntegration

fn PartialMessage.parse #

fn PartialMessage.parse(j json2.Any) !PartialMessage

fn PartialUser.parse #

fn PartialUser.parse(j json2.Any) !PartialUser

fn PermissionOverwrite.parse #

fn PermissionOverwrite.parse(j json2.Any) !PermissionOverwrite

fn Permissions.all #

fn Permissions.all() Permissions

fn Permissions.all_except #

fn Permissions.all_except(permissions Permissions) Permissions

fn Permissions.parse #

fn Permissions.parse(j json2.Any) !Permissions

fn Presence.parse #

fn Presence.parse(j json2.Any) !Presence

fn PresenceUpdateEvent.parse #

fn PresenceUpdateEvent.parse(j json2.Any, base BaseEvent) !PresenceUpdateEvent

fn PromptOption.parse #

fn PromptOption.parse(j json2.Any) !PromptOption

fn REST.delete_webhook_with_token #

fn REST.delete_webhook_with_token(webhook_id Snowflake, webhook_token string, params ReasonParam) !

Same as above, except this call does not require authentication.

fn REST.do_request #

fn REST.do_request(rest &REST, method http.Method, route string, options RequestOptions) !http.Response

fn REST.edit_webhook_with_token #

fn REST.edit_webhook_with_token(webhook_id Snowflake, webhook_token string, params EditWebhookParams) !Webhook

Same as above, except this call does not require authentication, does not accept a channel_id parameter in the body, and does not return a user in the webhook object.

fn REST.execute_webhook #

fn REST.execute_webhook(webhook_id Snowflake, webhook_token string, params ExecuteWebhookParams) !&Message

Returns a message or 204 No Content depending on the wait query parameter. > i Note that when sending a message, you must provide a value for at least one of content, embeds, components, or files. > i If the webhook channel is a forum or media channel, you must provide either thread_id in the query string params, or thread_name in the JSON/form params. If thread_id is provided, the message will send in that thread. If thread_name is provided, a thread with that name will be created in the channel. > ! Discord may strip certain characters from message content, like invalid unicode characters or characters which cause unexpected message formatting. If you are passing user-generated strings into message content, consider sanitizing the data to prevent unexpected behavior and using allowed_mentions to prevent unexpected mentions. pub fn (rest &REST) execute_webhook(webhook_id Snowflake, webhook_token string, params ExecuteWebhookParams) !&Message {

fn Reaction.parse #

fn Reaction.parse(j json2.Any) !Reaction

fn ReactionCountDetails.parse #

fn ReactionCountDetails.parse(j json2.Any) !ReactionCountDetails

fn ReadyEvent.parse #

fn ReadyEvent.parse(j json2.Any, base BaseEvent) !ReadyEvent

fn Resolved.parse #

fn Resolved.parse(j json2.Any) !Resolved

fn ResumedEvent.parse #

fn ResumedEvent.parse(j json2.Any, base BaseEvent) !ResumedEvent

fn Role.parse #

fn Role.parse(j json2.Any) !Role

fn RoleSelect.internal_parse #

fn RoleSelect.internal_parse(j map[string]json2.Any) !RoleSelect

fn RoleSelect.parse #

fn RoleSelect.parse(j json2.Any) !RoleSelect

fn RoleSubscriptionData.parse #

fn RoleSubscriptionData.parse(j json2.Any) !RoleSubscriptionData

fn RoleTags.parse #

fn RoleTags.parse(j json2.Any) !RoleTags

fn SelectOption.parse #

fn SelectOption.parse(j json2.Any) !SelectOption

fn SessionStartLimit.parse #

fn SessionStartLimit.parse(j json2.Any) !SessionStartLimit

fn Sku.parse #

fn Sku.parse(j json2.Any) !Sku

fn Snowflake.from #

fn Snowflake.from(t time.Time) Snowflake

fn Snowflake.now #

fn Snowflake.now() Snowflake

fn Snowflake.parse #

fn Snowflake.parse(j json2.Any) !Snowflake

fn StageInstance.parse #

fn StageInstance.parse(j json2.Any) !StageInstance

fn StageInstanceCreateEvent.parse #

fn StageInstanceCreateEvent.parse(j json2.Any, base BaseEvent) !StageInstanceCreateEvent

fn StageInstanceDeleteEvent.parse #

fn StageInstanceDeleteEvent.parse(j json2.Any, base BaseEvent) !StageInstanceDeleteEvent

fn StageInstanceUpdateEvent.parse #

fn StageInstanceUpdateEvent.parse(j json2.Any, base BaseEvent) !StageInstanceUpdateEvent

fn Status.parse #

fn Status.parse(j json2.Any) !Status

fn Sticker.parse #

fn Sticker.parse(j json2.Any) !Sticker

fn StickerItem.parse #

fn StickerItem.parse(j json2.Any) !StickerItem

fn StickerPack.parse #

fn StickerPack.parse(j json2.Any) !StickerPack

fn StringSelect.internal_parse #

fn StringSelect.internal_parse(j map[string]json2.Any) !StringSelect

fn StringSelect.parse #

fn StringSelect.parse(j json2.Any) !StringSelect

fn Team.parse #

fn Team.parse(j json2.Any) !Team

fn TeamMember.parse #

fn TeamMember.parse(j json2.Any) !TeamMember

fn TextInput.internal_parse #

fn TextInput.internal_parse(j map[string]json2.Any) !TextInput

fn TextInput.parse #

fn TextInput.parse(j json2.Any) !TextInput

fn ThreadCreateEvent.parse #

fn ThreadCreateEvent.parse(j json2.Any, base BaseEvent) !ThreadCreateEvent

fn ThreadDeleteEvent.parse #

fn ThreadDeleteEvent.parse(j json2.Any, base BaseEvent) !ThreadDeleteEvent

fn ThreadListSyncEvent.parse #

fn ThreadListSyncEvent.parse(j json2.Any, base BaseEvent) !ThreadListSyncEvent

fn ThreadMember.parse #

fn ThreadMember.parse(j json2.Any) !ThreadMember

fn ThreadMember2.parse #

fn ThreadMember2.parse(j json2.Any) !ThreadMember2

fn ThreadMemberUpdateEvent.parse #

fn ThreadMemberUpdateEvent.parse(j json2.Any, base BaseEvent) !ThreadMemberUpdateEvent

fn ThreadMetadata.parse #

fn ThreadMetadata.parse(j json2.Any) !ThreadMetadata

fn ThreadUpdateEvent.parse #

fn ThreadUpdateEvent.parse(j json2.Any, base BaseEvent) !ThreadUpdateEvent

fn TriggerMetadata.parse #

fn TriggerMetadata.parse(j json2.Any) !TriggerMetadata

fn TypingStartEvent.parse #

fn TypingStartEvent.parse(j json2.Any, base BaseEvent) !TypingStartEvent

fn UnavailableGuild.parse #

fn UnavailableGuild.parse(j json2.Any) !UnavailableGuild

fn User.parse #

fn User.parse(j json2.Any) !User

fn UserSelect.internal_parse #

fn UserSelect.internal_parse(j map[string]json2.Any) !UserSelect

fn UserSelect.parse #

fn UserSelect.parse(j json2.Any) !UserSelect

fn UserUpdateEvent.parse #

fn UserUpdateEvent.parse(j json2.Any, base BaseEvent) !UserUpdateEvent

fn VoiceRegion.parse #

fn VoiceRegion.parse(j json2.Any) !VoiceRegion

fn VoiceServerUpdateEvent.parse #

fn VoiceServerUpdateEvent.parse(j json2.Any, base BaseEvent) !VoiceServerUpdateEvent

fn VoiceState.parse #

fn VoiceState.parse(j json2.Any) !VoiceState

fn VoiceStateUpdateEvent.parse #

fn VoiceStateUpdateEvent.parse(j json2.Any, base BaseEvent) !VoiceStateUpdateEvent

fn Webhook.parse #

fn Webhook.parse(j json2.Any) !Webhook

fn WebhooksUpdateEvent.parse #

fn WebhooksUpdateEvent.parse(j json2.Any, base BaseEvent) !WebhooksUpdateEvent

fn WelcomeChannel.parse #

fn WelcomeChannel.parse(j json2.Any) !WelcomeChannel

fn WelcomeScreen.parse #

fn WelcomeScreen.parse(j json2.Any) !WelcomeScreen

interface Component #

interface Component {
	is_component()
	build() json2.Any
}

ignore is_component(), it is used to differ interfaces

interface EditChannelParams #

interface EditChannelParams {
	reason ?string
	is_edit_channel_params()
	build() json2.Any
}

interface HTTPClient #

interface HTTPClient {
	is_http_client()
	perform(http.Request) !http.Response
}

interface IInteractionResponse #

interface IInteractionResponse {
	is_interaction_response()
	get_files() ?[]File
	build() json2.Any
}

interface Image #

interface Image {
	data []u8
	is_image()
	content_type() string
	build() string
}

interface InteractionResponseData #

interface InteractionResponseData {
	is_interaction_response_data()
	get_files() ?[]File
	build() json2.Any
}

type ApplicationCommandInteractionDataOptionValue #

type ApplicationCommandInteractionDataOptionValue = bool | f64 | int | string

fn (ApplicationCommandInteractionDataOptionValue) as_string #

fn (v ApplicationCommandInteractionDataOptionValue) as_string() string

fn (ApplicationCommandInteractionDataOptionValue) as_int #

fn (v ApplicationCommandInteractionDataOptionValue) as_int() int

fn (ApplicationCommandInteractionDataOptionValue) as_f64 #

fn (v ApplicationCommandInteractionDataOptionValue) as_f64() f64

fn (ApplicationCommandInteractionDataOptionValue) as_bool #

fn (v ApplicationCommandInteractionDataOptionValue) as_bool() bool

type ApplicationCommandOptionChoiceValue #

type ApplicationCommandOptionChoiceValue = f64 | int | string

type ArrayOrSnowflake #

type ArrayOrSnowflake = Snowflake | []Snowflake

fn (ArrayOrSnowflake) build #

fn (aos ArrayOrSnowflake) build() json2.Any

type Check #

type Check[T] = fn (T) bool

type ConnectionService #

type ConnectionService = string

fn (EventChannel[T]) close #

fn (mut a EventChannel[T]) close()

Closes an event channel

fn (EventChannel[T]) receive #

fn (mut a EventChannel[T]) receive() ?T

receive waits for event and returns it. After it returned event, you should call close() on it to release resources. If timeout is exceeded, it returns none

fn (EventController[T]) emit #

fn (mut ec EventController[T]) emit(e T, options EmitOptions)

emit broadcasts passed object to all listeners

fn (EventController[T]) wait #

fn (mut ec EventController[T]) wait(params EventWaitParams[T]) EventChannel[T]

wait returns EventChannel that can be used to receive events > ! Do not use that directly in events, please take a reference using mut controller := &events.creator.events.on_x

fn (EventController[T]) override #

fn (mut ec EventController[T]) override(listener EventListener[T]) EventController[T]

override removes all listeners and inserts listener

fn (EventController[T]) listen #

fn (mut ec EventController[T]) listen(listener EventListener[T]) EventController[T]

listen adds function to listener list

type EventListener #

type EventListener[T] = fn (T) !

type GuildFeature #

type GuildFeature = string

type Locale #

type Locale = string

type Nonce #

type Nonce = int | string

fn (NullOr[T]) is_present #

fn (no NullOr[T]) is_present[T]() bool

fn (NullOr[T]) value #

fn (no NullOr[T]) value[T]() T

type Number #

type Number = f64 | int

fn (Number) build #

fn (n Number) build() json2.Any

type Snowflake #

type Snowflake = u64

fn (Snowflake) raw_timestamp #

fn (s Snowflake) raw_timestamp() u64

fn (Snowflake) timestamp #

fn (s Snowflake) timestamp() time.Time

fn (Snowflake) build #

fn (s Snowflake) build() json2.Any

fn (Snowflake) from_json #

fn (mut s Snowflake) from_json(f json2.Any)

fn (Snowflake) str #

fn (s Snowflake) str() string

fn (Snowflake) json_str #

fn (s Snowflake) json_str() string

type TeamMemberRole #

type TeamMemberRole = string

fn ([]Component) flatten #

fn (r []Component) flatten() []Component

fn ([]Component) find_where #

fn (cs []Component) find_where(f fn (Component) bool) ?Component

fn ([]Component) find #

fn (cs []Component) find[T](f fn (T) bool) ?T

enum ActionType #

enum ActionType {
	// blocks a member's message and prevents it from being posted. A custom explanation can be specified and shown to members whenever their message is blocked.
	block_message      = 1
	// logs user content to a specified channel
	send_alert_message
	// timeout user for a specified duration
	timeout
}

enum ActivityFlags #

@[flag]
enum ActivityFlags {
	instance
	join
	spectate
	join_request
	sync
	play
	party_privacy_frineds
	party_privacy_voice_channel
	embedded
}

enum ActivityType #

enum ActivityType {
	// Playing {name}: "Playing Rocket League"
	game      = 0
	// Streaming {details}: "Streaming Rocket League"
	streaming
	// Listening to {name}: "Listening to Spotify"
	listening
	// Watching {name}: "Watching YouTube Together"
	watching
	// {emoji} {state}: ":smiley: I am cool"
	custom
	// Competing in {name}: "Competing in Arena World Champions"
	competing
}

enum AllowedMentionType #

enum AllowedMentionType {
	// Controls role mentions
	roles
	// Controls user mentions
	users
	// Controls @everyone and @here mentions
	everyone
}

fn (AllowedMentionType) build #

fn (amt AllowedMentionType) build() string

enum ApplicationCommandOptionType #

enum ApplicationCommandOptionType {
	sub_command       = 1
	sub_command_group
	string
	// Any integer between -2^53 and 2^53
	integer
	boolean
	user
	// Includes all channel types + categories
	channel
	role
	// Includes users and roles
	mentionable
	// Any double between -2^53 and 2^53
	number
	attachment
}

pub type LocaleMapping = map[Locale]string

enum ApplicationCommandPermissionType #

enum ApplicationCommandPermissionType {
	role    = 1
	user
	channel
}

Application Command Permission Type

enum ApplicationCommandType #

enum ApplicationCommandType {
	// Slash commands; a text-based command that shows up when a user types `/`
	chat_input = 1
	// A UI-based command that shows up when you right click or tap on a user
	user
	// A UI-based command that shows up when you right click or tap on a message
	message
}

enum ApplicationFlags #

@[flag]
enum ApplicationFlags {
	reserved_0
	reserved_1
	reserved_2
	reserved_3
	reserved_4
	reserved_5
	// Indicates if an app uses the Auto Moderation API
	application_auto_moderation_rule_create_badge
	reserved_7
	reserved_8
	reserved_9
	reserved_10
	reserved_11
	// Intent required for bots in **100 or more servers** to receive `presence_update` events
	gateway_presence
	// Intent required for bots in under 100 to receive `presence_update` events, found on the **Bot** page in your app's settings
	gateway_presence_limited
	// Intent required for bots in **100 or more servers** to receive member-related events like `guild_member_add`. See the list of member-related events under `GUILD_MEMBERS`
	gateway_guild_members
	// Intent required for bots in under 100 servers to receive member-related events like `guild_member_add`, found on the **Bot** page in your app's settings. See the list of member-related events under GUILD_MEMBERS
	gateway_guild_members_limited
	// Indicates unusual growth of an app that prevents verification
	verification_pending_guild_limit
	// Indicates if an app is embedded within the Discord client (currently unavailable publicly)
	embedded
	// Intent required for bots in **100 or more servers** to receive message content
	gateway_message_content
	// Intent required for bots in under 100 servers to receive message content, found on the **Bot** page in your app's settings
	gateway_message_content_limited
	reserved_20
	reserved_21
	reserved_22
	// Indicates if an app has registered global application commands
	application_command_badge
}

enum ApplicationRoleConnectionMetadataType #

enum ApplicationRoleConnectionMetadataType {
	// the metadata value (`integer`) is less than or equal to the guild's configured value (`integer`)
	integer_less_than_or_equal     = 1
	// the metadata value (`integer`) is greater than or equal to the guild's configured value (`integer`)
	integer_greater_than_or_equal
	// the metadata value (`integer`) is equal to the guild's configured value (`integer`)
	integer_equal
	// the metadata value (`integer`) is not equal to the guild's configured value (`integer`)
	integer_not_equal
	// the metadata value (`ISO8601 string`) is less than or equal to the guild's configured value (`integer`; `days before current date`)
	datetime_less_than_or_equal
	// the metadata value (`ISO8601 string`) is greater than or equal to the guild's configured value (`integer`; `days before current date`)
	datetime_greater_than_or_equal
	// the metadata value (`integer`) is equal to the guild's configured value (`integer`; `1`)
	boolean_equal
	// the metadata value (`integer`) is not equal to the guild's configured value (`integer`; `1`)
	boolean_not_equal
}

enum AttachmentFlags #

@[flag]
enum AttachmentFlags {
	reserved_0
	reserved_1
	// this attachment has been edited using the remix feature on mobile
	is_remix
}

enum AuditLogEvent #

enum AuditLogEvent {
	// Server settings were updated
	guild_update                                = 1
	// Channel was created
	channel_create                              = 10
	// Channel settings were updated
	channel_update
	// Channel was deleted
	channel_delete
	// Permission overwrite was added to a channel
	channel_overwrite_create
	// Permission overwrite was updated for a channel
	channel_overwrite_update
	// Permission overwrite was deleted from a channel
	channel_overwrite_delete
	// Member was removed from server
	member_kick                                 = 20
	// Members were pruned from server
	member_prune
	// Member was banned from server
	member_ban_add
	// Server ban was lifted for a member
	member_ban_remove
	// Member was updated in server
	member_update
	// Member was added or removed from a role
	member_role_update
	// Member was moved to a different voice channel
	member_move
	// Member was disconnected from a voice channel
	member_disconnect
	// Bot user was added to server
	bot_add
	// Role was created
	role_create                                 = 30
	// Role was edited
	role_update
	// Role was deleted
	role_delete
	// Server invite was created
	invite_create                               = 40
	// Server invite was updated
	invite_update
	// Server invite was deleted
	invite_delete
	// Webhook was created
	webhook_create
	// Webhook properties or channel were updated
	webhook_update
	// Webhook was deleted
	webhook_delete
	// Emoji was created
	emoji_create
	// Emoji name was updated
	emoji_update
	// Emoji was deleted
	emoji_delete
	// Single message was deleted
	message_delete                              = 72
	// Multiple messages were deleted
	message_bulk_delete
	// Message was pinned to a channel
	message_pin
	// Message was unpinned from a channel
	message_unpin
	// App was added to server
	integration_create                          = 80
	// App was updated (as an example, its scopes were updated)
	integration_update
	// App was removed from server
	integration_delete
	// Stage instance was created (stage channel becomes live)
	stage_instance_create
	// Stage instance details were updated
	stage_instance_update
	// Stage instance was deleted (stage channel no longer live)
	stage_instance_delete
	// Sticker was created
	sticker_create                              = 90
	// Sticker details were updated
	sticker_update
	// Sticker was deleted
	sticker_delete
	// Event was created
	guild_scheduled_event_create                = 100
	// Event was updated
	guild_scheduled_event_update
	// Event was cancelled
	guild_scheduled_event_delete
	// Thread was created in a channel
	thread_create                               = 110
	// Thread was updated
	thread_update
	// Thread was deleted
	thread_delete
	// Permissions were updated for a command
	application_command_permission_update       = 121
	// Auto Moderation rule was created
	auto_moderation_rule_create                 = 140
	// Auto Moderation rule was updated
	auto_moderation_rule_update
	// Auto Moderation rule was deleted
	auto_moderation_rule_delete
	// Message was blocked by Auto Moderation
	auto_moderation_block_message
	// Message was flagged by Auto Moderation
	auto_moderation_flag_to_channel
	// Member was timed out by Auto Moderation
	auto_moderation_user_communication_disabled
	// Creator monetization request was created
	creator_monetization_request_created        = 150
	// Creator monetization terms were accepted
	creator_monetization_terms_accepted
	// Guild Onboarding Question was created
	onboarding_question_create                  = 163
	// Guild Onboarding Question was updated
	onboarding_question_update
	// Guild Onboarding was updated
	onboarding_update                           = 167
	// Guild Server Guide was created
	server_guide_create                         = 190
	// Guild Server Guide was updated
	server_guide_update
}

The table below lists audit log events and values (the action_type field) that your app may receive. The Object Changed column notes which object's values may be included in the entry. Though there are exceptions, possible keys in the changes array typically correspond to the object's fields. The descriptions and types for those fields can be found in the linked documentation for the object. If no object is noted, there won't be a changes array in the entry, though other fields like the target_id still exist and many have fields in the options array.

enum ButtonStyle #

enum ButtonStyle {
	// blurple
	primary   = 1
	// grey
	secondary = 2
	// green
	success   = 3
	// red
	danger    = 4
	// grey, navigates to a URL
	link      = 5
}

fn (ButtonStyle) build #

fn (bs ButtonStyle) build() json2.Any

enum ChannelFlags #

@[flag]
enum ChannelFlags {
	reserved_0
	// this thread is pinned to the top of its parent `.guild_forum` or `.guild_media` channel
	pinned
	reserved_2
	reserved_3
	// whether a tag is required to be specified when creating a thread in a `.guild_forum` or a `.guild_media` channel. Tags are specified in the `applied_tags` field.
	require_tag
	reserved_5
	reserved_6
	reserved_7
	reserved_8
	reserved_9
	reserved_10
	reserved_11
	reserved_12
	reserved_13
	reserved_14
	hide_media_download_options
}

enum ChannelType #

enum ChannelType {
	// unknown type
	unknown             = -1
	// a text channel within a server
	guild_text          = 0
	// a direct message between users
	dm
	// a voice channel within a server
	guild_voice
	// a direct message between multiple users
	group_dm
	// an organizational category that contains up to 50 channels
	guild_category
	// a channel that users can follow and crosspost into their own server (formerly news channels)
	guild_announcement
	// a temporary sub-channel within a GUILD_ANNOUNCEMENT channel
	announcement_thread = 10
	// a temporary sub-channel within a GUILD_TEXT or GUILD_FORUM channel
	public_thread
	// a temporary sub-channel within a GUILD_TEXT channel that is only viewable by those invited and those with the MANAGE_THREADS permission
	private_thread
	// a voice channel for hosting events with an audience
	guild_stage_voice
	// the channel in a hub containing the listed servers
	guild_directory
	// Channel that can only contain threads
	guild_forum
	// Channel that can only contain threads, similar to GUILD_FORUM channels
	guild_media
}

enum ComponentType #

enum ComponentType {
	// Container for other components
	action_row         = 1
	// Button object
	button             = 2
	// Select menu for picking from defined text options
	string_select      = 3
	// Text input object
	text_input         = 4
	// Select menu for users
	user_select        = 5
	// Select menu for roles
	role_select        = 6
	// Select menu for mentionables (users *and roles*)
	mentionable_select = 7
	// Select menu for channels
	channel_select     = 8
}

fn (ComponentType) build #

fn (ct ComponentType) build() json2.Any

enum DefaultValueType #

enum DefaultValueType {
	user
	role
	channel
}

enum EntitlementType #

enum EntitlementType {
	// Entitlement was purchased as an app subscription
	application_subscription = 8
}

enum EventType #

enum EventType {
	// when a member sends or edits a message in the guild
	message_send = 1
}

Indicates in what event context a rule should be checked.

enum ExplicitContentFilterLevel #

enum ExplicitContentFilterLevel {
	// media content will not be scanned
	disabled
	// media content sent by members without roles will be scanned
	members_without_roles
	// media content sent by all members will be scanned
	all_members
}

enum ForumLayoutType #

enum ForumLayoutType {
	// No default has been set for forum channel
	not_set
	// Display posts as a list
	list_view
	// Display posts as a collection of tiles
	gallery_view
}

enum GatewayClientSettings #

@[flag]
enum GatewayClientSettings {
	ignore_unknown_events
	dont_process
	dont_cut_debug
	dont_process_guild_events
	no_info_block
	dont_spawn_events
}

enum GatewayIntents #

@[flag]
enum GatewayIntents {
	guilds
	guild_members
	guild_moderation
	guild_emojis_and_stickers
	guild_integrations
	guild_webhooks
	guild_invites
	guild_voice_states
	guild_presences
	guild_messages
	guild_message_reactions
	guild_message_typing
	direct_messages
	direct_message_reactions
	direct_message_typing
	message_content
	guild_scheduled_events
	reserved_17
	reserved_18
	reserved_19
	auto_moderation_configuration
	auto_moderation_execution
}

enum GatewayOpcode #

enum GatewayOpcode {
	// An event was dispatched.
	dispatch              = 0
	// Fired periodically by the client to keep the connection alive.
	heartbeat
	// Starts a new session during the initial handshake.
	identify
	// Update the client's presence.
	update_presence
	// Used to join/leave or move between voice channels.
	voice_state_update
	// Resume a previous session that was disconnected.
	resume                = 6
	// You should attempt to reconnect and resume immediately.
	reconnect
	// Request information about offline guild members in a large guild.
	request_guild_members
	// The session has been invalidated. You should reconnect and identify/resume accordingly.
	invalid_session
	// Sent immediately after connecting, contains the `heartbeat_interval` to use.
	hello
	// Sent in response to receiving a heartbeat to acknowledge that it has been received.
	heartbeat_ack
}

enum GuildMemberFlags #

@[flag]
enum GuildMemberFlags {
	// Member has left and rejoined the guild
	did_rejoin
	// Member has completed onboarding
	completed_onboarding
	// Member is exempt from guild verification requirements
	bypasses_verification
	// Member has started onboarding
	started_onboarding
}

enum GuildScheduledEventEntityType #

enum GuildScheduledEventEntityType {
	stage_instance = 1
	voice
	external
}

enum GuildScheduledEventPrivacyLevel #

enum GuildScheduledEventPrivacyLevel {
	// the scheduled event is only accessible to guild members
	guild_only = 2
}

enum GuildScheduledEventStatus #

enum GuildScheduledEventStatus {
	scheduled = 1
	active
	completed
	canceled
}

enum ImageFormat #

enum ImageFormat {
	png
	jpg
	jpeg
	webp
	lottie
	gif
}

enum IntegrationExpireBehavior #

enum IntegrationExpireBehavior {
	remove_role
	kick
}

enum InteractionResponseType #

enum InteractionResponseType {
	// ACK a `Ping`
	pong                                    = 1
	// respond to an interaction with a message
	channel_message_with_source             = 4
	// ACK an interaction and edit a response later, the user sees a loading state
	deferred_channel_message_with_source
	// for components, ACK an interaction and edit the original message later; the user does not see a loading state
	deferred_update_message
	// for components, edit the message the component was attached to
	update_message
	// respond to an autocomplete interaction with suggested choices
	application_command_autocomplete_result
	// respond to an interaction with a popup modal
	modal
	// respond to an interaction with an upgrade button, only available for apps with monetization enabled
	premium_required
}

enum InteractionType #

enum InteractionType {
	ping                             = 1
	application_command
	message_component
	application_command_autocomplete
	modal_submit
}

enum InviteTargetType #

enum InviteTargetType {
	stream               = 1
	embedded_application
}

enum InviteType #

enum InviteType {
	guild
	group_dm
	friend
}

enum KeywordPresetType #

enum KeywordPresetType {
	// words that may be considered forms of swearing or cursing
	profanity      = 1
	// words that refer to sexually explicit behavior or activity
	sexual_content
	// personal insults or words that may be considered hate speech
	slurs
}

enum MFALevel #

enum MFALevel {
	// guild has no MFA/2FA requirement for moderation actions
	none_
	// guild has a 2FA requirement for moderation actions
	elevated
}

enum MembershipState #

enum MembershipState {
	invited  = 1
	accepted
}

enum MessageActivityType #

enum MessageActivityType {
	join         = 1
	spectate
	listen
	join_request
}

enum MessageFlags #

@[flag]
enum MessageFlags {
	crossposted
	is_crosspost
	suppress_embeds
	source_message_deleted
	urgent
	has_thread
	ephemeral
	loading
	failed_to_mention_some_roles_in_thread
	reserved_9
	reserved_10
	reserved_11
	suppress_notifications
	is_voice_message
}

enum MessageNotificationsLevel #

enum MessageNotificationsLevel {
	// members will receive notifications for all messages by default
	all_messages
	// members will receive notifications only for messages that @mention them by default
	only_mentions
}

enum MessageType #

enum MessageType {
	default
	recipient_add
	recipient_remove
	call
	channel_name_change
	channel_icon_change
	channel_pinned_message
	user_join
	guild_boost
	guild_boost_tier_1
	guild_boost_tier_2
	guild_boost_tier_3
	channel_follow_add
	guild_discovery_disqualified                = 14
	guild_discovery_requalified
	guild_discovery_grace_period_inital_warning
	guild_discovery_grace_period_final_warning
	thread_created
	reply
	chat_input_command
	thread_starter_message
	guild_invite_reminder
	context_menu_command
	auto_moderation_action
	role_subscription_purchase
	interaction_premium_upsell
	stage_start
	stage_end
	stage_speaker
	stage_topic                                 = 31
	guild_application_premium_subscription
}

enum NSFWLevel #

enum NSFWLevel {
	default
	explicit
	safe
	age_restricted
}

enum OnboardingMode #

enum OnboardingMode {
	// Counts only Default Channels towards constraints
	onboarding_default
	// Counts Default Channels and Questions towards constraints
	onboarding_advanced
}

Defines the criteria used to satisfy Onboarding constraints that are required for enabling.

enum OwnerType #

enum OwnerType {
	// for a guild subscription
	guild = 1
	// for a user subscription
	user
}

enum PermissionOverwriteType #

enum PermissionOverwriteType {
	role
	member
}

enum Permissions #

@[flag]
enum Permissions as u64 {
	// Allows creation of instant invites
	create_instant_invite
	// Allows kicking members
	kick_members
	// Allows banning members
	ban_members
	// Allows all permissions and bypasses channel permission overwrites
	administrator
	// Allows management and editing of channels
	manage_channels
	// Allows management and editing of the guild
	manage_guild
	// Allows for the addition of reactions to messages
	add_reactions
	// Allows for viewing of audit logs
	view_audit_log
	// Allows for using priority speaker in a voice channel
	priority_speaker
	// Allows the user to go live
	stream
	// Allows guild members to view a channel, which includes reading messages in text channels and joining voice channels
	view_channel
	// Allows for sending messages in a channel and creating threads in a forum (does not allow sending messages in threads)
	send_messages
	// Allows for sending of `/tts` messages
	send_tts_messages
	// Allows for deletion of other users messages
	manage_messages
	// Links sent by users with this permission will be auto-embedded
	embed_links
	// Allows for uploading images and files
	attach_files
	// Allows for reading of message history
	read_message_history
	// Allows for using the `@everyone` tag to notify all users in a channel, and the `@here` tag to notify all online users in a channel
	mention_everyone
	// Allows the usage of custom emojis from other servers
	use_external_emojis
	// Allows for viewing guild insights
	view_guild_insights
	// Allows for joining of a voice channel
	connect
	// Allows for speaking in a voice channel
	speak
	// Allows for muting members in a voice channel
	mute_members
	// Allows for deafening of members in a voice channel
	deafen_members
	// Allows for moving of members between voice channels
	move_members
	// Allows for using voice-activity-detection in a voice channel
	use_vad
	// Allows for modification of own nickname
	change_nickname
	// Allows for modification of other users nicknames
	manage_nicknames
	// Allows management and editing of roles
	manage_roles
	// Allows management and editing of webhooks
	manage_webhooks
	// Allows for editing and deleting emojis, stickers, and soundboard sounds created by all users
	manage_guild_expressions
	// Allows members to use application commands, including slash commands and context menu commands.
	use_application_commands
	// Allows for requesting to speak in stage channels. (This permission is under active development and may be changed or removed.)
	request_to_speak
	// Allows for editing and deleting scheduled events created by all users
	manage_events
	// Allows for deleting and archiving threads, and viewing all private threads
	manage_threads
	// Allows for creating public and announcement threads
	create_public_threads
	// Allows for creating private threads
	create_private_threads
	// Allows the usage of custom stickers from other servers
	use_external_stickers
	// Allows for sending messages in threads
	send_messages_in_threads
	// Allows for using Activities (applications with the `EMBEDDED` flag) in a voice channel
	use_embedded_activities
	// Allows for timing out users to prevent them from sending or reacting to messages in chat and threads, and from speaking in voice and stage channels
	moderate_members
	// Allows for viewing role subscription insights
	view_creator_monetization_analytics
	// Allows for using soundboard in a voice channel
	use_soundboard
	// Allows for creating emojis, stickers, and soundboard sounds, and editing and deleting those created by the current user
	create_guild_expressions
	// Allows for creating scheduled events, and editing and deleting those created by the current user
	create_events
	// Allows the usage of custom soundboard sounds from other servers
	use_external_sounds
	// Allows sending voice messages
	send_voice_messages
}

enum PremiumTier #

enum PremiumTier {
	// guild has not unlocked any Server Boost perks
	none_
	// guild has unlocked Server Boost level 1 perks
	tier_1
	// guild has unlocked Server Boost level 2 perks
	tier_2
	// guild has unlocked Server Boost level 3 perks
	tier_3
}

enum PremiumType #

enum PremiumType {
	// None
	none_
	// Nitro Classic
	nitro_classic
	// Nitro
	nitro
	// Nitro Basic
	nitro_basic
}

enum PrivacyLevel #

enum PrivacyLevel {
	// The Stage instance is visible to only guild members.
	guild_only = 2
}

enum PromptType #

enum PromptType {
	multiple_choice
	dropdown
}

enum ReactionType #

enum ReactionType {
	normal
	burst
}

enum RoleFlags #

@[flag]
enum RoleFlags {
	// role can be selected by members in an onboarding prompt
	in_prompt
}

enum SkuFlags #

@[flags]
enum SkuFlags {
	reserved_0
	reserved_1
	// SKU is available for purchase
	available
	reserved_3
	reserved_4
	reserved_5
	reserved_6
	// Recurring SKU that can be purchased by a user and applied to a single server. Grants access to every user in that server.
	guild_subscription
	// Recurring SKU purchased by a user for themselves. Grants access to the purchasing user in every server.
	user_subscription
}

enum SkuType #

enum SkuType {
	// Represents a recurring subscription
	subscription       = 5
	// System-generated group for each SUBSCRIPTION SKU created
	subscription_group
}

enum SortOrderType #

enum SortOrderType {
	// Sort forum posts by activity
	latest_activity
	// Sort forum posts by creation time (from most recent to oldest)
	creation_date
}

enum Status #

enum Status {
	// Online (Green)
	online
	// Do Not Disturb (Red)
	dnd
	// AFK (Yellow)
	idle
	// Invisible and shown as offline (Gray)
	invisible
	// Offline (Gray)
	offline
}

fn (Status) build #

fn (s Status) build() string

enum StickerFormatType #

enum StickerFormatType {
	png
	apng
	lottie
	gif
}

enum StickerType #

enum StickerType {
	standard
	guild
}

enum SystemChannelFlags #

@[flag]
enum SystemChannelFlags {
	// Suppress member join notifications
	suppress_join_notifications
	// Suppress server boost notifications
	suppress_premium_subscriptions
	// Suppress server setup tips
	suppress_guild_reminder_notifications
	// Hide member join sticker reply buttons
	suppress_join_notification_replies
	// Suppress role subscription purchase and renewal notifications
	suppress_role_subscription_purchase_notifications
	// Hide role subscription sticker reply buttons
	suppress_role_subscription_purchase_notifications_replies
}

enum TextInputStyle #

enum TextInputStyle {
	// Single-line input
	short     = 1
	// Multi-line input
	paragraph = 2
}

fn (TextInputStyle) build #

fn (tis TextInputStyle) build() json2.Any

enum TriggerType #

enum TriggerType {
	// check if content contains words from a user defined list of keywords
	keyword        = 1
	// check if content represents generic spam
	spam           = 3
	// check if content contains words from internal pre-defined wordsets
	keyword_preset
	// check if content contains more unique mentions than allowed
	mention_spam
}

Characterizes the type of content which can trigger the rule.

enum UserFlags #

@[flag]
enum UserFlags {
	// Discord Employee
	staff
	// Partnered Server Owner
	partner
	// HypeSquad Events Member
	hypesquad
	// Bug Hunter Level 1
	bug_hunter_level_1
	reserved_4
	reserved_5
	// House Bravery Member
	hypesquad_online_house_1
	// House Brilliance Member
	hypesquad_online_house_2
	// House Balance Member
	hypesquad_online_house_3
	// Early Nitro Supporter
	premium_early_supporter
	// User is a team
	team_pseudo_user
	reserved_11
	reserved_12
	reserved_13
	// Bug Hunter Level 2
	bug_hunter_level_2
	reserved_15
	// Verified Bot
	verified_bot
	// Early Verified Bot Developer
	verified_developer
	// Moderator Programs Alumni
	certified_moderator
	// Bot uses only HTTP interactions and is shown in the online member list
	bot_http_interactions
	reserved_20
	reserved_21
	// User is an Active Developer
	active_developer
}

enum VerificationLevel #

enum VerificationLevel {
	// unrestricted
	none_
	// must have verified email on account
	low
	// must be registered on Discord for longer than 5 minutes
	medium
	// must be a member of the server for longer than 10 minutes
	high
	// must have a verified phone number
	very_high
}

enum VideoQualityMode #

enum VideoQualityMode {
	// Discord chooses the quality for optimal performance
	auto = 1
	// 720p
	full
}

enum Visibility #

enum Visibility {
	// invisible to everyone except the user themselves
	none_
	// visible to everyone
	everyone
}

enum WebhookType #

enum WebhookType {
	// Incoming Webhooks can post messages to channels with a generated token
	incoming         = 1
	// Channel Follower Webhooks are internal webhooks used with Channel Following to post new messages into channels
	channel_follower
	// Application webhooks are webhooks used with Interactions
	application
}

struct Action #

struct Action {
pub:
	// the type of action
	typ ActionType
	// additional metadata needed during execution for this specific action type
	metadata ?ActionMetadata
}

fn (Action) build #

fn (a Action) build() json2.Any

struct ActionMetadata #

struct ActionMetadata {
pub:
	// channel to which user content should be logged
	channel_id ?Snowflake
	// timeout duration in seconds
	duration_seconds ?time.Duration
	// additional explanation that will be shown to members whenever their message is blocked
	custom_message ?string
}

fn (ActionMetadata) build #

fn (am ActionMetadata) build() json2.Any

struct ActionRow #

struct ActionRow {
pub:
	components []Component
}

An Action Row is a non-interactive container component for other types of components. It has a sub-array of components of other types.- You can have up to 5 Action Rows per message

  • An Action Row cannot contain another Action Row

fn (ActionRow) build #

fn (ar ActionRow) build() json2.Any

struct Activity #

struct Activity {
pub:
	// Activity's name
	name string
	// Activity type
	typ ActivityType @[required]
	// Stream URL, is validated when type is 1
	url ?NullOr[string]
	// Unix timestamp (in milliseconds) of when the activity was added to the user's session
	created_at time.Time
	// Unix timestamps for start and/or end of the game
	timestamps ?ActivityTimestamps
	// Application ID for the game
	application_id ?Snowflake
	// What the player is currently doing
	details ?NullOr[string]
	// User's current party status, or text used for a custom status
	state ?NullOr[string]
	// Emoji used for a custom status
	emoji ?NullOr[ActivityEmoji]
	// Information for the current party of the player
	party ?ActivityParty
	// Images for the presence and their hover texts
	assets ?ActivityAssets
	// Secrets for Rich Presence joining and spectating
	secrets ?ActivitySecrets
	// Whether or not the activity is an instanced game session
	instance ?bool
	// Activity flags `OR`d together, describes what the payload includes
	flags ?ActivityFlags
	// Custom buttons shown in the Rich Presence (max 2)
	buttons ?[]ActivityButton
}

fn (Activity) build #

fn (a Activity) build() json2.Any

struct ActivityAssets #

struct ActivityAssets {
pub:
	// See [Activity Asset Image](https://discord.com/developers/docs/topics/gateway-events#activity-object-activity-asset-image)
	large_image ?string
	// Text displayed when hovering over the large image of the activity
	large_text ?string
	// // See [Activity Asset Image](https://discord.com/developers/docs/topics/gateway-events#activity-object-activity-asset-image)
	small_image ?string
	// Text displayed when hovering over the small image of the activity
	small_text ?string
}

struct ActivityButton #

struct ActivityButton {
pub:
	// Text shown on the button (1-32 characters)
	label string
	// URL opened when clicking the button (1-512 characters)
	url string
}

struct ActivityEmoji #

struct ActivityEmoji {
pub:
	// Name of the emoji
	name string
	// ID of the emoji
	id ?Snowflake
	// Whether the emoji is animated
	animated ?bool
}

struct ActivityParty #

struct ActivityParty {
pub:
	// ID of the party
	id ?string
	// Used to show the party's current size
	current_size ?int
	// Used to show the party's maximum size
	max_size ?int
}

struct ActivitySecrets #

struct ActivitySecrets {
pub:
	// Secret for joining a party
	join ?string
	// Secret for spectating a game
	spectate ?string
	// Secret for a specific instanced match
	match_ ?string
}

struct ActivityTimestamps #

struct ActivityTimestamps {
pub:
	// Unix time (in milliseconds) of when the activity started
	start ?time.Time
	// Unix time (in milliseconds) of when the activity ends
	end ?time.Time
}

struct AddGuildMemberParams #

@[params]
struct AddGuildMemberParams {
pub mut:
	// an oauth2 access token granted with the `guilds.join` to the bot's application for the user you want to add to the guild
	access_token string @[required]
	// value to set user's nickname to
	nick ?string
	// array of role ids the member is assigned
	roles ?[]Snowflake
	// whether the user is muted in voice channels
	mute ?bool
	// whether the user is deafened in voice channels
	deaf ?bool
}

fn (AddGuildMemberParams) build #

fn (params AddGuildMemberParams) build() json2.Any

struct AllowedMentions #

struct AllowedMentions {
pub:
	// An array of allowed mention types to parse from the content.
	parse ?[]AllowedMentionType
	// Array of role_ids to mention (Max size of 100)
	roles ?[]Snowflake
	// Array of user_ids to mention (Max size of 100)
	users ?[]Snowflake
	// For replies, whether to mention the author of the message being replied to (default false)
	replied_user ?bool
}

fn (AllowedMentions) build #

fn (am AllowedMentions) build() json2.Any

struct ApngImage #

struct ApngImage {
pub:
	data []u8 @[required]
}

fn (ApngImage) content_type #

fn (_ ApngImage) content_type() string

fn (ApngImage) build #

fn (af ApngImage) build() string

struct Application #

struct Application {
pub:
	// ID of the app
	id Snowflake
	// Name of the app
	name string
	// Icon hash of the app
	icon ?string
	// Description of the app
	description string
	// List of RPC origin URLs, if RPC is enabled
	rpc_origins ?[]string
	// When `false`, only the app owner can add the app to guilds
	bot_public bool
	// When `true`, the app's bot will only join upon completion of the full OAuth2 code grant flow
	bot_require_code_grant bool
	// Partial user object for the bot user associated with the app
	bot ?User
	// URL of the app's Terms of Service
	terms_of_service_url ?string
	// URL of the app's Privacy Policy
	privacy_policy_url ?string
	// Partial user object for the owner of the app
	owner ?User
	// Key for verification in interactions and the GameSDK's GetTicket
	verify_key []u8
	// If the app belongs to a team, this will be a list of the members of that team
	team ?Team
	// Guild associated with the app. For example, a developer support server.
	guild_id ?Snowflake
	// Partial object of the associated guild
	guild ?PartialGuild
	// If this app is a game sold on Discord, this field will be the id of the "Game SKU" that is created, if exists
	primary_sku_id ?Snowflake
	// If this app is a game sold on Discord, this field will be the URL slug that links to the store page
	slug ?string
	// App's default rich presence invite cover image hash
	cover_image ?string
	// App's public flags
	flags ?ApplicationFlags
	// Approximate count of guilds the app has been added to
	approximate_guild_count ?int
	// Array of redirect URIs for the app
	redirect_uris ?[]string
	// Interactions endpoint URL for the app
	interactions_endpoint_url ?string
	// Role connection verification URL for the app
	role_connections_verification_url ?string
	// List of tags describing the content and functionality of the app. Max of 5 tags.
	tags ?[]string
	// Settings for the app's default in-app authorization link, if enabled
	install_params ?InstallParams
	// Default custom authorization URL for the app, if enabled
	custom_install_url ?string
}

struct ApplicationCommand #

struct ApplicationCommand {
pub:
	// Unique ID of command
	id Snowflake
	// Type of command, defaults to 1
	typ ApplicationCommandType = .chat_input
	// ID of the parent application
	application_id Snowflake
	// Guild ID of the command, if not global
	guild_id ?Snowflake
	// Name of command, 1-32 characters
	name string
	// Localization dictionary for `name` field. Values follow the same restrictions as `name`
	name_localizations ?map[Locale]string
	// Description for `.chat_input` commands, 1-100 characters. Empty string for `.user` and `.message` commands
	description string
	// Localization dictionary for `description` field. Values follow the same restrictions as `description`
	description_localizations ?map[Locale]string
	// Parameters for the command, max of 25
	options ?[]ApplicationCommandOption
	// Set of permissions represented as a bit set
	default_member_permissions ?Permissions
	// Indicates whether the command is available in DMs with the app, only for globally-scoped commands. By default, commands are visible.
	dm_permission ?bool
	// Indicates whether the command is age-restricted, defaults to `false`
	nsfw ?bool
}

struct ApplicationCommandData #

struct ApplicationCommandData {
pub:
	// the ID of the invoked command
	id Snowflake
	// the name of the invoked command
	name string
	// the type of the invoked command
	typ ApplicationCommandType
	// converted users + roles + channels + attachments
	resolved ?Resolved
	// the params + values from the user
	options ?[]ApplicationCommandInteractionDataOption
	// the id of the guild the command is registered to
	guild_id ?Snowflake
	// id of the user or message targeted by a user or message command
	target_id ?Snowflake
}

fn (ApplicationCommandData) get #

fn (acd ApplicationCommandData) get(option string) ?ApplicationCommandInteractionDataOptionValue

struct ApplicationCommandInteractionDataOption #

struct ApplicationCommandInteractionDataOption {
pub:
	// Name of the parameter
	name string
	// Value of application command option type
	typ ApplicationCommandOptionType
	// Value of the option resulting from user input
	value ?ApplicationCommandInteractionDataOptionValue
	// Present if this option is a group or subcommand
	options ?[]ApplicationCommandInteractionDataOption
	// true if this option is the currently focused option for autocomplete
	focused ?bool
}

struct ApplicationCommandOption #

struct ApplicationCommandOption {
pub:
	// Type of option
	typ ApplicationCommandOptionType @[required]
	// 1-32 character name
	name string @[required]
	// Localization dictionary for the `name` field. Values follow the same restrictions as `name`
	name_localizations ?map[Locale]string
	// 1-100 character description
	description string @[required]
	// Localization dictionary for the `description` field. Values follow the same restrictions as `description`
	description_localizations ?map[Locale]string
	// If the parameter is required or optional--default `false`
	required ?bool
	// Choices for `.string`, `.integer`, and `.number` types for the user to pick from, max 25
	choices ?[]ApplicationCommandOptionChoice
	// If the option is a subcommand or subcommand group type, these nested options will be the parameters
	options ?[]ApplicationCommandOption
	// If the option is a channel type, the channels shown will be restricted to these types
	channel_types ?[]ChannelType
	// If the option is an `.integer` or `.number` type, the minimum value permitted
	min_value ?Number
	// If the option is an `.integer` or `.number` type, the maximum value permitted
	max_value ?Number
	// For option type `.string`, the minimum allowed length (minimum of `0`, maximum of `6000`)
	min_length ?int
	// For option type `.string`, the maximum allowed length (minimum of `1`, maximum of `6000`)
	max_length ?int
	// If autocomplete interactions are enabled for this `.string`, `.integer`, or `.number` type option
	autocomplete ?bool
}

fn (ApplicationCommandOption) build #

fn (aco ApplicationCommandOption) build() json2.Any

struct ApplicationCommandOptionChoice #

struct ApplicationCommandOptionChoice {
pub:
	// 1-100 character choice name
	name string @[required]
	// Localization dictionary for the `name` field. Values follow the same restrictions as `name`
	name_localizations ?map[Locale]string
	// Value for the choice, up to 100 characters if string
	value ApplicationCommandOptionChoiceValue @[required]
}

fn (ApplicationCommandOptionChoice) build #

fn (acoc ApplicationCommandOptionChoice) build() json2.Any

struct ApplicationCommandPermission #

struct ApplicationCommandPermission {
pub:
	// ID of the role, user, or channel. It can also be a permission constant
	id Snowflake
	// role (`.role`), user (`.user`), or channel (`.channel`)
	typ ApplicationCommandPermissionType
	// `true` to allow, `false`, to disallow
	permission bool
}

fn (ApplicationCommandPermission) build #

fn (acp ApplicationCommandPermission) build() json2.Any

struct ApplicationCommandPermissionsUpdateEvent #

struct ApplicationCommandPermissionsUpdateEvent {
	BaseEvent
pub:
	permissions GuildApplicationCommandPermissions
}

struct ApplicationRoleConnection #

struct ApplicationRoleConnection {
pub:
	// the vanity name of the platform a bot has connected (max 50 characters)
	platform_name ?string
	// the username on the platform a bot has connected (max 100 characters)
	platform_username ?string
	// object mapping [application role connection metadata](#ApplicationRoleConnectionMetadata) keys to their string-ified value (max 100 characters) for the user on the platform a bot has connected
	metadata map[string]string
}

struct ApplicationRoleConnectionMetadata #

struct ApplicationRoleConnectionMetadata {
pub:
	// type of metadata value
	typ ApplicationRoleConnectionMetadataType
	// dictionary key for the metadata field (must be `a-z`, `0-9`, or `_` characters; 1-50 characters)
	key string
	// name of the metadata field (1-100 characters)
	name string
	// translations of the name
	name_localizations ?map[Locale]string
	// description of the metadata field (1-200 characters)
	description string
	// translations of the description
	description_localizations ?map[Locale]string
}

struct Attachment #

struct Attachment {
pub:
	// attachment id
	id Snowflake
	// name of file attached
	filename string
	// description for the file (max 1024 characters)
	description ?string
	// the attachment's media type
	content_type ?string
	// size of file in bytes
	size int
	// source url of file
	url string
	// a proxied url of file
	proxy_url string
	// height of file (if image)
	height ?int
	// width of file (if image)
	width ?int
	// whether this attachment is ephemeral
	ephemeral ?bool
	// the duration of the audio file (currently for voice messages)
	duration_secs ?time.Duration
	// base64 encoded bytearray representing a sampled waveform (currently for voice messages)
	waveform ?[]u8
	// attachment flags combined as a bitfield
	flags ?AttachmentFlags
}

struct AuditEntryInfo #

struct AuditEntryInfo {
pub:
	// ID of the app whose permissions were targeted
	application_id ?Snowflake
	// Name of the Auto Moderation rule that was triggered
	auto_moderation_rule_name ?string
	// Trigger type of the Auto Moderation rule that was triggered
	auto_moderation_rule_trigger_type ?string
	// Channel in which the entities were targeted
	channel_id ?Snowflake
	// Number of entities that were targeted
	count ?string
	// Number of days after which inactive members were kicked
	delete_member_days ?string
	// ID of the overwritten entity
	id ?Snowflake
	// Number of members removed by the prune
	members_removed ?string
	// ID of the message that was targeted
	message_id ?Snowflake
	// Name of the role if type is "0" (not present if type is "1")
	role_name ?string
	// Type of overwritten entity - role ("0") or member ("1")
	typ ?string
	// The type of integration which performed the action
	integration_type ?string
}

struct AuditLog #

struct AuditLog {
pub:
	// List of application commands referenced in the audit log
	application_commands []ApplicationCommand
	// List of audit log entries, sorted from most to least recent
	audit_log_entries []AuditLogEntry
	// List of auto moderation rules referenced in the audit log
	auto_moderation_rules []AutoModerationRule
	// List of guild scheduled events referenced in the audit log
	guild_scheduled_events []GuildScheduledEvent
	// List of partial integration objects
	integrations []PartialIntegration
	// List of threads referenced in the audit log
	threads []Channel
	// List of users referenced in the audit log
	users []User
	// List of webhooks referenced in the audit log
	webhooks []Webhook
}

When an administrative action is performed in a guild, an entry is added to its audit log. Viewing audit logs requires the .view_audit_log permission and can be fetched by apps using the GET /guilds/{guild.id}/audit-logs endpoint, or seen by users in the guild's Server Settings. All audit log entries are stored for 45 days. When an app is performing an eligible action using the APIs, it can pass an reason param to indicate why the action was taken. More information is in the audit log entry section.

struct AuditLogChange #

struct AuditLogChange {
pub:
	// New value of the key
	new_value ?json2.Any
	// Old value of the key
	old_value ?json2.Any
	// Name of the changed entity, with a few exceptions
	key string
}

struct AuditLogEntry #

struct AuditLogEntry {
pub:
	// ID of the affected entity (webhook, user, role, etc.)
	target_id ?string
	// Changes made to the `target_id`
	changes ?[]AuditLogChange
	// User or app that made the changes
	user_id ?Snowflake
	// ID of the entry
	id Snowflake
	// Type of action that occurred
	action_type AuditLogEvent
	// Additional info for certain event types
	options ?AuditEntryInfo
	// Reason for the change (1-512 characters)
	reason ?string
}

Each audit log entry represents a single administrative action (or event), indicated by action_type. Most entries contain one to many changes in the changes array that affected an entity in Discord—whether that's a user, channel, guild, emoji, or something else. The information (and structure) of an entry's changes will be different depending on its type. For example, in .member_role_update events there is only one change: a member is either added or removed from a specific role. However, in .channel_create events there are many changes, including (but not limited to) the channel's name, type, and permission overwrites added. More details are in the change object section. Apps can specify why an administrative action is being taken by passing an X-Audit-Log-Reason request header, which will be stored as the audit log entry's reason field. The X-Audit-Log-Reason header supports 1-512 URL-encoded UTF-8 characters. Reasons are visible to users in the client and to apps when fetching audit log entries with the API.

struct AutoModerationActionExecutionEvent #

struct AutoModerationActionExecutionEvent {
	BaseEvent
pub:
	// ID of the guild in which action was executed
	guild_id Snowflake
	// Action which was executed
	action Action
	// ID of the rule which action belongs to
	rule_id Snowflake
	// Trigger type of rule which was triggered
	rule_trigger_type TriggerType
	// ID of the user which generated the content which triggered the rule
	channel_id ?Snowflake
	// ID of any user message which content belongs to
	message_id ?Snowflake
	// ID of any system auto moderation messages posted as a result of this action
	alert_system_message_id ?Snowflake
	// User-generated text content
	content string
	// Word or phrase configured in the rule that triggered the rule
	matched_keyword ?string
	// Substring in content that triggered the rule
	matched_content ?string
}

struct AutoModerationRule #

struct AutoModerationRule {
pub:
	// the id of this rule
	id Snowflake
	// the id of the guild which this rule belongs to
	guild_id Snowflake
	// the rule name
	name string
	// the user which first created this rule
	creator_id Snowflake
	// the rule event type
	event_type EventType
	// the rule trigger type
	trigger_type TriggerType
	// the rule trigger metadata
	trigger_metadata TriggerMetadata
	// the actions which will execute when the rule is triggered
	actions []Action
	// whether the rule is enabled
	enabled bool
	// the role ids that should not be affected by the rule (Maximum of 20)
	exempt_roles []Snowflake
	// the channel ids that should not be affected by the rule (Maximum of 50)
	exempt_channels []Snowflake
}

struct AutoModerationRuleCreateEvent #

struct AutoModerationRuleCreateEvent {
	BaseEvent
pub:
	rule AutoModerationRule
}

struct AutoModerationRuleDeleteEvent #

struct AutoModerationRuleDeleteEvent {
	BaseEvent
pub:
	rule AutoModerationRule
}

struct AutoModerationRuleUpdateEvent #

struct AutoModerationRuleUpdateEvent {
	BaseEvent
pub:
	rule AutoModerationRule
}

struct AutocompleteInteractionResponse #

struct AutocompleteInteractionResponse {
	AutocompleteResponseData
}

fn (AutocompleteInteractionResponse) get_files #

fn (air AutocompleteInteractionResponse) get_files() ?[]File

fn (AutocompleteInteractionResponse) build #

fn (air AutocompleteInteractionResponse) build() json2.Any

struct AutocompleteResponseData #

struct AutocompleteResponseData {
pub mut:
	// autocomplete choices (max of 25 choices)
	choices []ApplicationCommandOptionChoice @[required]
}

fn (AutocompleteResponseData) is_interaction_response_data #

fn (_ AutocompleteResponseData) is_interaction_response_data()

fn (AutocompleteResponseData) get_files #

fn (_ AutocompleteResponseData) get_files() ?[]File

fn (AutocompleteResponseData) build #

fn (ard AutocompleteResponseData) build() json2.Any

struct AvatarDecorationData #

struct AvatarDecorationData {
pub:
	asset  string
	sku_id Snowflake
}

struct Ban #

struct Ban {
pub:
	// the reason for the ban
	reason ?string
	// the banned user
	user User
}

struct BaseEvent #

struct BaseEvent {
pub mut:
	creator &GatewayClient
}

struct BeginGuildPruneParams #

@[params]
struct BeginGuildPruneParams {
pub mut:
	// number of days to prune (1-30)
	days ?int
	// whether `pruned` is returned, discouraged for large guilds
	compute_prune_count ?bool
	// role(s) to include
	with_roles []Snowflake
	// reason for the prune
	reason ?string
}

fn (BeginGuildPruneParams) build #

fn (params BeginGuildPruneParams) build() json2.Any

struct BotConfig #

@[params]
struct BotConfig {
	RESTConfig
pub:
	cache           Cache
	debug           bool
	intents         GatewayIntents
	properties      Properties
	large_threshold ?int
	presence        ?UpdatePresenceParams
	read_timeout    ?time.Duration
	settings        GatewayClientSettings
	write_timeout   ?time.Duration
}

struct BulkBanResponse #

struct BulkBanResponse {
pub:
	// list of user ids, that were successfully banned
	banned_users ?[]Snowflake
	// list of user ids, that were not banned
	failed_users ?[]Snowflake
}

struct BulkGuildBanParams #

@[params]
struct BulkGuildBanParams {
pub mut:
	reason   ?string
	user_ids []Snowflake @[required]
	// number of seconds to delete messages for, between 0 and 604800 (7 days)
	delete_message_seconds ?time.Duration
}

fn (BulkGuildBanParams) build #

fn (params BulkGuildBanParams) build() json2.Any

struct Button #

struct Button {
pub:
	// A button style, default is `.secondary`
	style ButtonStyle = .secondary
	// Text that appears on the button; max 80 characters
	label ?string
	// `name`, `id`, and `animated`
	emoji ?ComponentEmoji
	// Developer-defined identifier for the button; max 100 characters
	custom_id ?string
	// URL for link-style buttons
	url ?string
	// Whether the button is disabled (defaults to false)
	disabled ?bool
}

Buttons are interactive components that render in messages. They can be clicked by users, and send an interaction to your app when clicked.

  • Buttons must be sent inside an Action Row
  • An Action Row can contain up to 5 buttons
  • An Action Row containing buttons cannot also contain any select menu components

Buttons come in a variety of styles to convey different types of actions. These styles also define what fields are valid for a button.

  • Non-link buttons must have a custom_id, and cannot have a url
  • Link buttons must have a url, and cannot have a custom_id
  • Link buttons do not send an interaction to your app when clicked

fn (Button) build #

fn (b Button) build() json2.Any

struct CDN #

struct CDN {
pub:
	base string
}

fn (CDN) custom_emoji #

fn (c CDN) custom_emoji(emoji_id Snowflake, params CDNGetParams) string

fn (CDN) guild_icon #

fn (c CDN) guild_icon(guild_id Snowflake, guild_icon string, params CDNGetParams) string

fn (CDN) guild_splash #

fn (c CDN) guild_splash(guild_id Snowflake, guild_icon string, params CDNGetParams) string

fn (CDN) guild_discovery_splash #

fn (c CDN) guild_discovery_splash(guild_id Snowflake, guild_icon string, params CDNGetParams) string

fn (CDN) guild_banner #

fn (c CDN) guild_banner(guild_id Snowflake, guild_banner string, params CDNGetParams) string

fn (CDN) user_banner #

fn (c CDN) user_banner(user_id Snowflake, user_banner string, params CDNGetParams) string

fn (CDN) default_user_avatar #

fn (c CDN) default_user_avatar(index int) string

fn (CDN) user_avatar #

fn (c CDN) user_avatar(user_id Snowflake, user_avatar string, params CDNGetParams) string

fn (CDN) guild_member_avatar #

fn (c CDN) guild_member_avatar(guild_id Snowflake, user_id Snowflake, member_avatar string, params CDNGetParams) string

fn (CDN) user_avatar_decoration #

fn (c CDN) user_avatar_decoration(user_id Snowflake, user_avatar_decoration string, params CDNGetParams) string

fn (CDN) application_icon #

fn (c CDN) application_icon(application_id Snowflake, icon string, params CDNGetParams) string

fn (CDN) application_cover #

fn (c CDN) application_cover(application_id Snowflake, cover_image string, params CDNGetParams) string

fn (CDN) application_asset #

fn (c CDN) application_asset(application_id Snowflake, asset_id string, params CDNGetParams) string

fn (CDN) achievement_icon #

fn (c CDN) achievement_icon(application_id Snowflake, achievement_id string, icon_hash string, params CDNGetParams) string

fn (CDN) store_page_asset #

fn (c CDN) store_page_asset(application_id Snowflake, asset_id string, params CDNGetParams) string

fn (CDN) sticker_pack_banner #

fn (c CDN) sticker_pack_banner(application_id Snowflake, sticker_pack_banner_asset_id Snowflake, params CDNGetParams) string

fn (CDN) team_icon #

fn (c CDN) team_icon(team_id Snowflake, team_icon string, params CDNGetParams) string

fn (CDN) sticker #

fn (c CDN) sticker(sticker_id Snowflake, params CDNGetParams) string

fn (CDN) role_icon #

fn (c CDN) role_icon(role_id Snowflake, role_icon string, params CDNGetParams) string

fn (CDN) guild_scheduled_event_cover #

fn (c CDN) guild_scheduled_event_cover(scheduled_event_id Snowflake, scheduled_event_cover_image string, params CDNGetParams) string

fn (CDN) guild_member_banner #

fn (c CDN) guild_member_banner(guild_id Snowflake, user_id Snowflake, member_banner string, params CDNGetParams) string

struct CDNAttachment #

struct CDNAttachment {
	// Timestamp indicating when an attachment CDN URL will expire
	expires_on time.Time
	// Timestamp indicating when the URL was issued
	issued_at time.Time
	// Unique signature that remains valid until the URL's expiration
	unique_signature []u8
}

struct CDNGetParams #

@[params]
struct CDNGetParams {
pub mut:
	format ?ImageFormat
	size   ?int
}

fn (CDNGetParams) build #

fn (params CDNGetParams) build() string

struct Cache #

struct Cache {
pub:
	guilds_check    fn (guild_id Snowflake, guild Guild) bool = unsafe { nil }
	guilds_max_size ?int = 0

	roles_check     fn (guild_id Snowflake, role_id Snowflake, role Role) bool = unsafe { nil }
	roles_max_size1 ?int = 0
	roles_max_size2 ?int = 0

	emojis_check     fn (guild_id Snowflake, emoji_id Snowflake, emoji Emoji) bool = unsafe { nil }
	emojis_max_size1 ?int = 0
	emojis_max_size2 ?int = 0

	stickers_check     fn (guild_id Snowflake, sticker_id Snowflake, sticker Sticker) bool = unsafe { nil }
	stickers_max_size1 ?int = 0
	stickers_max_size2 ?int = 0

	auto_moderation_rules_check     fn (guild_id Snowflake, rule_id Snowflake, rule AutoModerationRule) bool = unsafe { nil }
	auto_moderation_rules_max_size1 ?int = 0
	auto_moderation_rules_max_size2 ?int = 0

	voice_states_check     fn (guild_id Snowflake, user_id Snowflake, state VoiceState) bool = unsafe { nil }
	voice_states_max_size1 ?int = 0
	voice_states_max_size2 ?int = 0

	members_check     fn (guild_id Snowflake, user_id Snowflake, member GuildMember) bool = unsafe { nil }
	members_max_size1 ?int = 0
	members_max_size2 ?int = 0

	channels_check    fn (channel_id Snowflake, channel Channel) bool = unsafe { nil }
	channels_max_size ?int = 0

	messages_check     fn (channel_id Snowflake, message_id Snowflake, message Message) bool = unsafe { nil }
	messages_max_size1 ?int = 0
	messages_max_size2 ?int = 0

	threads_check     fn (guild_id Snowflake, thread_id Snowflake, thread Channel) bool = unsafe { nil }
	threads_max_size1 ?int = 0
	threads_max_size2 ?int = 0

	presences_check     fn (guild_id Snowflake, user_id Snowflake, presence Presence) bool = unsafe { nil }
	presences_max_size1 ?int = 0
	presences_max_size2 ?int = 0

	stage_instances_check     fn (guild_id Snowflake, instance_id Snowflake, instance StageInstance) bool = unsafe { nil }
	stage_instances_max_size1 ?int = 0
	stage_instances_max_size2 ?int = 0

	guild_scheduled_events_check     fn (guild_id Snowflake, event_id Snowflake, event GuildScheduledEvent) bool = unsafe { nil }
	guild_scheduled_events_max_size1 ?int = 0
	guild_scheduled_events_max_size2 ?int = 0

	entitlements_check     fn (owner_id Snowflake, entitlement_id Snowflake, entitlement Entitlement) bool = unsafe { nil }
	entitlements_max_size1 ?int = 0
	entitlements_max_size2 ?int = 0

	users_check    fn (user_id Snowflake, user User) bool = unsafe { nil }
	users_max_size ?int
pub mut:
	// {guild_id -> guild}
	guilds map[Snowflake]Guild
	// {guild_id -> {role_id -> role}}
	roles map[Snowflake]map[Snowflake]Role
	// {guild_id -> {emoji_id -> emoji}}
	emojis map[Snowflake]map[Snowflake]Emoji
	// {guild_id -> {sticker_id -> sticker}}
	stickers map[Snowflake]map[Snowflake]Sticker
	// {guild_id -> {rule_id -> rule}}
	auto_moderation_rules map[Snowflake]map[Snowflake]AutoModerationRule
	// {guild_id -> {user_id -> state}}
	voice_states map[Snowflake]map[Snowflake]VoiceState
	// {guild_id -> {user_id -> member}}
	members map[Snowflake]map[Snowflake]GuildMember
	// {channel_id -> channel}
	channels map[Snowflake]Channel
	// {channel_id -> {message_id -> message}}
	messages map[Snowflake]map[Snowflake]Message
	// {guild_id -> {channel_id -> thread}}
	threads map[Snowflake]map[Snowflake]Channel
	// {guild_id -> {user_id -> presence}}
	presences map[Snowflake]map[Snowflake]Presence
	// {guild_id -> {channel_id -> instance}}
	stage_instances map[Snowflake]map[Snowflake]StageInstance
	// {guild_id -> {guild_scheduled_event_id -> guild_scheduled_event}}
	guild_scheduled_events map[Snowflake]map[Snowflake]GuildScheduledEvent
	// {owner_id (user_id | guild_id) -> {entitlement_id -> entitlement}}
	entitlements map[Snowflake]map[Snowflake]Entitlement
	// {user_id -> user}
	users map[Snowflake]User
}

fn (Cache) get_guild #

fn (cache &Cache) get_guild(guild_id Snowflake) ?Guild

fn (Cache) get_role #

fn (cache &Cache) get_role(guild_id Snowflake, role_id Snowflake) ?Role

fn (Cache) get_emoji #

fn (cache &Cache) get_emoji(guild_id Snowflake, emoji_id Snowflake) ?Emoji

fn (Cache) get_sticker #

fn (cache &Cache) get_sticker(guild_id Snowflake, sticker_id Snowflake) ?Sticker

fn (Cache) get_voice_state #

fn (cache &Cache) get_voice_state(guild_id Snowflake, user_id Snowflake) ?VoiceState

fn (Cache) get_member #

fn (cache &Cache) get_member(guild_id Snowflake, user_id Snowflake) ?GuildMember

fn (Cache) get_channel #

fn (cache &Cache) get_channel(channel_id Snowflake) ?Channel

fn (Cache) get_message #

fn (cache &Cache) get_message(channel_id Snowflake, message_id Snowflake) ?Message

fn (Cache) get_thread #

fn (cache &Cache) get_thread(guild_id Snowflake, thread_id Snowflake) ?Channel

fn (Cache) get_presence #

fn (cache &Cache) get_presence(guild_id Snowflake, user_id Snowflake) ?Presence

fn (Cache) get_stage_instance #

fn (cache &Cache) get_stage_instance(guild_id Snowflake, channel_id Snowflake) ?StageInstance

fn (Cache) get_guild_scheduled_event #

fn (cache &Cache) get_guild_scheduled_event(guild_id Snowflake, guild_scheduled_event_id Snowflake) ?GuildScheduledEvent

fn (Cache) get_entitlement #

fn (cache &Cache) get_entitlement(owner_id Snowflake, entitlement_id Snowflake) ?Entitlement

fn (Cache) get_user #

fn (cache &Cache) get_user(user_id Snowflake) ?User

struct Channel #

struct Channel {
pub:
	// the id of this channel
	id Snowflake
	// the type of channel
	typ ChannelType
	// the id of the guild (may be missing for some channel objects received over gateway guild dispatches)
	guild_id ?Snowflake
	// sorting position of the channel
	position ?int
	// explicit permission overwrites for members and roles
	permission_overwrites ?[]PermissionOverwrite
	// the name of the channel (1-100 characters)
	name string
	// the channel topic (0-4096 characters for GUILD_FORUM and GUILD_MEDIA channels, 0-1024 characters for all others)
	topic ?string
	// whether the channel is nsfw
	nsfw ?bool
	// the id of the last message sent in this channel (or thread for GUILD_FORUM or GUILD_MEDIA channels) (may not point to an existing or valid message or thread)
	last_message_id ?Snowflake
	// the bitrate (in bits) of the voice channel
	bitrate ?int
	// the user limit of the voice channel
	user_limit ?int
	// amount of seconds a user has to wait before sending another message (0-21600); bots, as well as users with the permission manage_messages or manage_channel, are unaffected
	rate_limit_per_user ?time.Duration
	// the recipients of the DM
	recipients ?[]User
	// icon hash of the group DM
	icon ?string
	// id of the creator of the group DM or thread
	owner_id ?Snowflake
	// application id of the group DM creator if it is bot-created
	application_id ?Snowflake
	// for group DM channels: whether the channel is managed by an application via the gdm.join OAuth2 scope
	managed ?bool
	// for guild channels: id of the parent category for a channel (each parent category can contain up to 50 channels), for threads: id of the text channel this thread was created
	parent_id ?Snowflake
	// when the last pinned message was pinned. This may be null in events such as GUILD_CREATE when a message is not pinned.
	last_pin_timestamp ?time.Time
	// voice region id for the voice channel, automatic when set to null
	rtc_region ?string
	// the camera video quality mode of the voice channel, 1 when not present
	video_quality_mode ?VideoQualityMode
	// number of messages (not including the initial message or deleted messages) in a thread.
	message_count ?int
	// an approximate count of users in a thread, stops counting at 50
	member_count ?int
	// thread-specific fields not needed by other channels
	thread_metadata ?ThreadMetadata
	// thread member object for the current user, if they have joined the thread, only included on certain API endpoints
	member ?ThreadMember
	// default duration, copied onto newly created threads, in minutes, threads will stop showing in the channel list after the specified period of inactivity, can be set to: 60, 1440, 4320, 10080
	default_auto_archive_duration ?time.Duration
	// computed permissions for the invoking user in the channel, including overwrites, only included when part of the resolved data received on a slash command interaction. This does not include implicit permissions, which may need to be checked separately
	permissions ?Permissions
	// channel flags combined as a bitfield
	flags ?ChannelFlags
	// number of messages ever sent in a thread, it's similar to message_count on message creation, but will not decrement the number when a message is deleted
	total_message_sent ?int
	// the set of tags that can be used in a GUILD_FORUM or a GUILD_MEDIA channel
	available_tags ?[]ForumTag
	// the IDs of the set of tags that have been applied to a thread in a GUILD_FORUM or a GUILD_MEDIA channel
	applied_tags ?[]Snowflake
	// the emoji to show in the add reaction button on a thread in a GUILD_FORUM or a GUILD_MEDIA channel
	default_reaction_emoji ?DefaultReaction
	// the initial rate_limit_per_user to set on newly created threads in a channel. this field is copied to the thread at creation time and does not live update.
	default_thread_rate_limit_per_user ?time.Duration
	// the default sort order type used to order posts in GUILD_FORUM and GUILD_MEDIA channels. Defaults to null, which indicates a preferred sort order hasn't been set by a channel admin
	default_sort_order ?SortOrderType
	// the default forum layout view used to display posts in GUILD_FORUM channels. Defaults to 0, which indicates a layout view has not been set by a channel admin
	default_forum_layout ?ForumLayoutType
}

fn (Channel) get_overwrite #

fn (c Channel) get_overwrite(id Snowflake) ?PermissionOverwrite

struct ChannelCreateEvent #

struct ChannelCreateEvent {
	BaseEvent
pub:
	channel Channel
}

struct ChannelDeleteEvent #

struct ChannelDeleteEvent {
	BaseEvent
pub:
	channel Channel
}

struct ChannelMention #

struct ChannelMention {
pub:
	// id of the channel
	id Snowflake
	// id of the guild containing the channel
	guild_id Snowflake
	// the type of channel
	typ ChannelType
	// the name of the channel
	name string
}

struct ChannelPinsUpdateEvent #

struct ChannelPinsUpdateEvent {
	BaseEvent
pub:
	// ID of the guild
	guild_id ?Snowflake
	// ID of the channel
	channel_id Snowflake
	// Time at which the most recent pinned message was pinned
	last_pin_timestamp ?time.Time
}

struct ChannelSelect #

struct ChannelSelect {
pub:
	// ID for the select menu; max 100 characters
	custom_id string @[required]
	// List of channel types to include in the channel select component
	channel_types ?[]ChannelType
	// Placeholder text if nothing is selected; max 150 characters
	placeholder ?string
	// List of default values for auto-populated select menu components; number of default values must be in the range defined by `min_values` and `max_values`
	default_values ?[]Snowflake
	// Minimum number of items that must be chosen (defaults to 1); min 0, max 25
	min_values ?int
	// Maximum number of items that can be chosen (defaults to 1); max 25
	max_values ?int
	// Whether select menu is disabled (defaults to `false`)
	disabled ?bool
}

fn (ChannelSelect) build #

fn (cs ChannelSelect) build() json2.Any

struct ChannelUpdateEvent #

struct ChannelUpdateEvent {
	BaseEvent
pub:
	channel Channel
}

struct ClientStatus #

struct ClientStatus {
pub:
	// User's status set for an active desktop (Windows, Linux, Mac) application session
	desktop ?Status
	// User's status set for an active mobile (iOS, Android) application session
	mobile ?Status
	// User's status set for an active web (browser, bot user) application session
	web ?Status
}

struct ComponentEmoji #

struct ComponentEmoji {
pub:
	id       ?Snowflake
	name     string     @[required]
	animated bool
}

fn (ComponentEmoji) build #

fn (ce ComponentEmoji) build() json2.Any

struct Connection #

struct Connection {
pub:
	// id of the connection account
	id string
	// the username of the connection account
	name string
	// the service of this connection
	typ ConnectionService
	// whether the connection is revoked
	revoked ?bool
	// an array of partial [server integrations](#PartialIntegration)
	integrations ?[]PartialIntegration
	// whether the connection is verified
	verified bool
	// whether friend sync is enabled for this connection
	friend_sync bool
	// whether activities related to this connection will be shown in presence updates
	show_activity bool
	// whether this connection has a corresponding third party OAuth2 token
	two_way_link bool
	// visibility of this connection
	visibility Visibility
}

The connection object that the user has attached.

struct CreateApplicationCommandParams #

@[params]
struct CreateApplicationCommandParams {
pub:
	// Name of command, 1-32 characters
	name string
	// Localization dictionary for the `name` field. Values follow the same restrictions as `name`
	name_localizations ?map[Locale]string
	// 1-100 character description for `.chat_input` commands
	description ?string
	// Localization dictionary for the `description` field. Values follow the same restrictions as `description`
	description_localizations ?map[Locale]string
	// the parameters for the command
	options ?[]ApplicationCommandOption
	// Set of permissions represented as a bit set
	default_member_permissions ?Permissions
	// Indicates whether the command is available in DMs with the app, only for globally-scoped commands. By default, commands are visible.
	dm_permission ?bool
	// Type of command, defaults `.chat_input` if not set
	typ ?ApplicationCommandType
	// Indicates whether the command is age-restricted
	nsfw ?bool
}

fn (CreateApplicationCommandParams) build #

fn (params CreateApplicationCommandParams) build() json2.Any

struct CreateAutoModerationRuleParams #

@[params]
struct CreateAutoModerationRuleParams {
pub mut:
	reason ?string
	// the rule name
	name string @[required]
	// the event type
	event_type EventType @[required]
	// the trigger type
	trigger_type TriggerType @[required]
	// the trigger metadata
	trigger_metadata ?TriggerMetadata
	// the actions which will execute when the rule is triggered
	actions []Action @[required]
	// whether the rule is enabled (False by default)
	enabled ?bool
	// the role ids that should not be affected by the rule (Maximum of 20)
	exempt_roles ?[]Snowflake
	// the channel ids that should not be affected by the rule (Maximum of 50)
	exempt_channels ?[]Snowflake
}

fn (CreateAutoModerationRuleParams) build #

fn (params CreateAutoModerationRuleParams) build() json2.Any

struct CreateGroupDMParams #

@[params]
struct CreateGroupDMParams {
pub mut:
	// access tokens of users that have granted your app the `gdm.join` scope
	access_tokens []string @[required]
	// a dictionary of user ids to their respective nicknames
	nicks map[Snowflake]string @[required]
}

fn (CreateGroupDMParams) build #

fn (params CreateGroupDMParams) build() json2.Any

struct CreateGuildBanParams #

@[params]
struct CreateGuildBanParams {
pub mut:
	reason ?string
	// number of seconds to delete messages for, between 0 and 604800 (7 days)
	delete_message_seconds ?time.Duration
}

fn (CreateGuildBanParams) build #

fn (params CreateGuildBanParams) build() json2.Any

struct CreateGuildChannelParams #

@[params]
struct CreateGuildChannelParams {
pub mut:
	name string @[required]
	// the type of channel
	typ ?ChannelType = unsafe { ChannelType(discord.sentinel_int) }
	// channel topic (0-1024 characters)
	topic ?string = discord.sentinel_string
	// the bitrate (in bits) of the voice or stage channel; min 8000
	bitrate ?int = discord.sentinel_int
	// the user limit of the voice channel
	user_limit ?int = discord.sentinel_int
	// amount of seconds a user has to wait before sending another message (0-21600); bots, as well as users with the permission `.manage_messages` or `.manage_channel`, are unaffected
	rate_limit_per_user ?time.Duration = discord.sentinel_duration
	// sorting position of the channel
	position ?int = discord.sentinel_int
	// the channel's permission overwrites
	permission_overwrites ?[]PermissionOverwrite = discord.sentinel_permission_overwrites
	// id of the parent category for a channel
	parent_id ?Snowflake = discord.sentinel_snowflake
	// whether the channel is nsfw
	nsfw ?bool
	// channel voice region id of the voice or stage channel, automatic when set to null
	rtc_region ?string = discord.sentinel_string
	// the camera video quality mode of the voice channel
	video_quality_mode ?VideoQualityMode = unsafe { VideoQualityMode(discord.sentinel_int) }
	// the default duration that the clients use (not the API) for newly created threads in the channel, in minutes, to automatically archive the thread after recent activity
	default_auto_archive_duration ?time.Duration = discord.sentinel_duration
	// emoji to show in the add reaction button on a thread in a `.guild_forum` or a `.guild_media` channel
	default_reaction_emoji ?DefaultReaction = discord.sentinel_default_reaction
	// set of tags that can be used in a `.guild_forum` or a `.guild_media` channel
	available_tags ?[]ForumTag = discord.sentinel_forum_tags
	// the default sort order type used to order posts in `.guild_forum` and `.guild_media`  channels
	default_sort_order ?SortOrderType = unsafe { SortOrderType(discord.sentinel_int) }
	// the default forum layout view used to display posts in `.guild_forum` channels
	default_forum_layout ?ForumLayoutType = unsafe { ForumLayoutType(discord.sentinel_int) }
	// the initial `rate_limit_per_user` to set on newly created threads in a channel. this field is copied to the thread at creation time and does not live update.
	default_thread_rate_limit_per_user ?time.Duration = discord.sentinel_duration
	reason                             ?string
}

fn (CreateGuildChannelParams) build #

fn (params CreateGuildChannelParams) build() json2.Any

struct CreateGuildEmojiParams #

@[params]
struct CreateGuildEmojiParams {
pub mut:
	reason ?string
	// name of the emoji
	name string @[required]
	// the 128x128 emoji image
	image Image @[required]
	// roles allowed to use this emoji
	roles ?[]Snowflake
}

fn (CreateGuildEmojiParams) build #

fn (params CreateGuildEmojiParams) build() json2.Any

struct CreateGuildFromGuildTemplateParams #

@[params]
struct CreateGuildFromGuildTemplateParams {
pub mut:
	// name of the guild (2-100 characters)
	name string @[required]
	// base64 128x128 image for the guild icon
	icon ?Image
}

fn (CreateGuildFromGuildTemplateParams) build #

fn (params CreateGuildFromGuildTemplateParams) build() json2.Any

struct CreateGuildParams #

@[params]
struct CreateGuildParams {
pub mut:
	name                          string                      @[required]
	icon                          ?Image
	verification_level            ?VerificationLevel
	default_message_notifications ?MessageNotificationsLevel
	explicit_content_filter       ?ExplicitContentFilterLevel
	roles                         ?[]Role
	channels                      ?[]PartialChannel
	afk_channel_id                ?int
	afk_timeout                   ?time.Duration
	system_channel_id             ?int
	system_channel_flags          ?SystemChannelFlags
}

fn (CreateGuildParams) build #

fn (params CreateGuildParams) build() json2.Any

struct CreateGuildRoleParams #

@[params]
struct CreateGuildRoleParams {
pub mut:
	reason ?string
	// name of the role, max 100 characters
	name ?string
	// bitwise value of the enabled/disabled permissions
	permissions ?Permissions
	// RGB color value
	color ?int
	// whether the role should be displayed separately in the sidebar
	hoist ?bool
	// the role's icon image (if the guild has the `ROLE_ICONS` feature)
	icon ?Image = discord.sentinel_image
	// the role's unicode emoji as a standard emoji (if the guild has the `ROLE_ICONS` feature)
	unicode_emoji ?string = discord.sentinel_string
	// whether the role should be mentionable
	mentionable ?bool
}

https://discord.com/developers/docs/resources/guild#create-guild-role-json-params

fn (CreateGuildRoleParams) build #

fn (params CreateGuildRoleParams) build() json2.Any

struct CreateGuildScheduledEventParams #

@[params]
struct CreateGuildScheduledEventParams {
pub mut:
	reason ?string
	// the channel id of the scheduled event.
	channel_id ?Snowflake
	// the entity metadata of the scheduled event
	entity_metadata ?GuildScheduledEventEntityMetadata
	// the name of the scheduled event
	name string @[required]
	// the privacy level of the scheduled event
	privacy_level GuildScheduledEventPrivacyLevel = .guild_only
	// the time to schedule the scheduled event
	scheduled_start_time time.Time @[required]
	// the time when the scheduled event is scheduled to end
	scheduled_end_time ?time.Time
	// the description of the scheduled event
	description ?string
	// the entity type of the scheduled event
	entity_type GuildScheduledEventEntityType @[required]
	// the cover image of the scheduled event
	image ?Image
}

fn (CreateGuildScheduledEventParams) build #

fn (params CreateGuildScheduledEventParams) build() json2.Any

struct CreateGuildStickerParams #

@[params]
struct CreateGuildStickerParams {
pub mut:
	reason ?string
	// name of the sticker (2-30 characters)
	name string @[required]
	// description of the sticker (empty or 2-100 characters)
	description string
	// autocomplete/suggestion tags for the sticker (max 200 characters)
	tags string @[required]
	// the sticker file to upload, must be a PNG, APNG, GIF, or Lottie JSON file, max 512 KiB
	file Image @[required]
}

fn (CreateGuildStickerParams) build #

fn (params CreateGuildStickerParams) build() map[string][]http.FileData

struct CreateGuildTemplateParams #

@[params]
struct CreateGuildTemplateParams {
pub mut:
	// name of the template (1-100 characters)
	name string @[required]
	// description for the template (0-120 characters)
	description ?string = discord.sentinel_string
}

fn (CreateGuildTemplateParams) build #

fn (params CreateGuildTemplateParams) build() json2.Any

struct CreateInviteParams #

@[params]
struct CreateInviteParams {
pub mut:
	// duration of invite in seconds before expiry, or 0 for never. between 0 and 604800 (7 days)
	max_age ?time.Duration
	// max number of uses or 0 for unlimited. between 0 and 100
	max_uses ?int
	// whether this invite only grants temporary membership
	temporary ?bool
	// if true, don't try to reuse a similar invite (useful for creating many unique one time use invites)
	unique ?bool
	// the type of target for this voice channel invite
	target_type ?InviteTargetType
	// the id of the user whose stream to display for this invite, required if target_type is 1, the user must be streaming in the channel
	target_user_id ?Snowflake
	// the id of the embedded application to open for this invite, required if target_type is 2, the application must have the EMBEDDED flag
	target_application_id ?Snowflake
}

fn (CreateInviteParams) build #

fn (params CreateInviteParams) build() json2.Any

struct CreateMessageParams #

@[params]
struct CreateMessageParams {
pub mut:
	// Message contents (up to 2000 characters)
	content ?string
	// Can be used to verify a message was sent (up to 25 characters). Value will appear in the Message Create event.
	nonce ?Nonce
	// `true` if this is a TTS message
	tts ?bool
	// Up to 10 embeds (up to 6000 characters)
	embeds ?[]Embed
	// Allowed mentions for the message
	allowed_mentions ?AllowedMentions
	// Include to make your message a reply
	message_reference ?MessageReference
	// Components to include with the message
	components ?[]Component
	// IDs of up to 3 stickers in the server to send in the message
	sticker_ids ?[]Snowflake
	// Contents of the file being sent. See Uploading Files
	files ?[]File
	// Message flags combined as a bitfield (only SUPPRESS_EMBEDS and SUPPRESS_NOTIFICATIONS can be set)
	flags ?MessageFlags
	// If `true` and nonce is present, it will be checked for uniqueness in the past few minutes. If another message was created by the same author with the same nonce, that message will be returned and no new message will be created.
	enforce_nonce ?bool
}

fn (CreateMessageParams) build #

fn (params CreateMessageParams) build() json2.Any

struct CreateStageInstanceParams #

@[params]
struct CreateStageInstanceParams {
pub mut:
	reason ?string
	// The id of the Stage channel
	channel_id Snowflake @[required]
	// The topic of the Stage instance (1-120 characters)
	topic string @[required]
	// The privacy level of the Stage instance (default GUILD_ONLY)
	privacy_level ?PrivacyLevel
	// Notify @everyone that a Stage instance has started
	send_start_notification ?bool
	// The guild scheduled event associated with this Stage instance
	guild_scheduled_event_id ?Snowflake
}

fn (CreateStageInstanceParams) build #

fn (params CreateStageInstanceParams) build() json2.Any

struct CreateTestEntitlementParams #

@[params]
struct CreateTestEntitlementParams {
pub mut:
	// ID of the SKU to grant the entitlement to
	sku_id Snowflake @[required]
	// ID of the guild or user to grant the entitlement to
	owner_id Snowflake @[required]
	// `.guild` for a guild subscription, `.user` for a user subscription
	owner_type OwnerType @[required]
}

fn (CreateTestEntitlementParams) build #

fn (params CreateTestEntitlementParams) build() json2.Any

struct CreateWebhookParams #

@[params]
struct CreateWebhookParams {
pub mut:
	reason ?string
	// name of the webhook (1-80 characters)
	name string @[required]
	// image for the default webhook avatar
	avatar ?Image = discord.sentinel_image
}

fn (CreateWebhookParams) build #

fn (params CreateWebhookParams) build() json2.Any

struct DefaultReaction #

struct DefaultReaction {
pub:
	// the id of a guild's custom emoji
	emoji_id ?Snowflake
	// the unicode character of the emoji
	emoji_name ?string
}

fn (DefaultReaction) build #

fn (dr DefaultReaction) build() json2.Any

fn (DefaultReaction) is_sentinel #

fn (dr DefaultReaction) is_sentinel() bool

struct DefaultValue #

struct DefaultValue {
pub:
	// ID of a user, role, or channel
	id Snowflake @[required]
	// Type of value that `id` represents. Either `.user`, `.role`, or `.channel`
	typ DefaultValueType @[required]
}

fn (DefaultValue) build #

fn (dv DefaultValue) build() json2.Any

struct DeleteWebhookMessageParams #

@[params]
struct DeleteWebhookMessageParams {
pub mut:
	// id of the thread the message is in
	thread_id ?Snowflake
}

fn (DeleteWebhookMessageParams) build_query_values #

fn (params DeleteWebhookMessageParams) build_query_values() urllib.Values

struct DispatchEvent #

struct DispatchEvent {
	BaseEvent
pub:
	name string
	data json2.Any
}

struct EditApplicationCommandParams #

@[params]
struct EditApplicationCommandParams {
pub:
	// Name of command, 1-32 characters
	name ?string
	// Localization dictionary for the `name` field. Values follow the same restrictions as `name`
	name_localizations ?map[Locale]string
	// 1-100 character description
	description ?string
	// Localization dictionary for the `description` field. Values follow the same restrictions as `description`
	description_localizations ?map[Locale]string
	// the parameters for the command
	options ?[]ApplicationCommandOption
	// Set of permissions represented as a bit set
	default_member_permissions ?Permissions = discord.sentinel_permissions
	// Indicates whether the command is available in DMs with the app, only for globally-scoped commands. By default, commands are visible.
	dm_permission ?bool
	// Indicates whether the command is age-restricted
	nsfw ?bool
}

fn (EditApplicationCommandParams) build #

fn (params EditApplicationCommandParams) build() json2.Any

struct EditApplicationCommandPermissionsParams #

@[params]
struct EditApplicationCommandPermissionsParams {
pub:
	// Permissions for the command in the guild
	permissions []ApplicationCommandPermission
}

fn (EditApplicationCommandPermissionsParams) build #

fn (params EditApplicationCommandPermissionsParams) build() json2.Any

struct EditApplicationParams #

@[params]
struct EditApplicationParams {
pub mut:
	// Default custom authorization URL for the app, if enabled
	custom_install_url ?string
	// Description of the app
	description ?string
	// Role connection verification URL for the app
	role_connections_verification_url ?string = discord.sentinel_string
	// Settings for the app's default in-app authorization link, if enabled
	install_params ?InstallParams
	// App's public flags
	flags ?ApplicationFlags
	// Icon for the app
	icon ?Image = discord.sentinel_image
	// Default rich presence invite cover image for the app
	cover_image ?Image = discord.sentinel_image
	// Interactions endpoint URL for the app
	interactions_endpoint_url ?string = discord.sentinel_string
	// List of tags describing the content and functionality of the app (max of 20 characters per tag). Max of 5 tags.
	tags ?[]string
}

fn (EditApplicationParams) build #

fn (params EditApplicationParams) build() json2.Any

struct EditAutoModerationRuleParams #

@[params]
struct EditAutoModerationRuleParams {
pub mut:
	reason ?string
	// the rule name
	name ?string
	// the event type
	event_type ?EventType
	// the trigger type
	trigger_type ?TriggerType
	// the trigger metadata
	trigger_metadata ?TriggerMetadata
	// the actions which will execute when the rule is triggered
	actions ?[]Action
	// whether the rule is enabled (False by default)
	enabled ?bool
	// the role ids that should not be affected by the rule (Maximum of 20)
	exempt_roles ?[]Snowflake
	// the channel ids that should not be affected by the rule (Maximum of 50)
	exempt_channels ?[]Snowflake
}

fn (EditAutoModerationRuleParams) build #

fn (params EditAutoModerationRuleParams) build() json2.Any

struct EditChannelPermissionsParams #

@[params]
struct EditChannelPermissionsParams {
pub mut:
	reason ?string
	// the bitwise value of all allowed permissions (default `0`)
	allow ?Permissions = discord.sentinel_permissions
	// the bitwise value of all disallowed permissions (default `0`)
	deny ?Permissions = discord.sentinel_permissions
	// 0 for a role or 1 for a member
	typ PermissionOverwriteType @[required]
}

fn (EditChannelPermissionsParams) build #

fn (params EditChannelPermissionsParams) build() json2.Any

struct EditCurrentMemberParams #

@[params]
struct EditCurrentMemberParams {
pub mut:
	reason ?string
	// value to set user's nickname to
	nick ?string = discord.sentinel_string
}

fn (EditCurrentMemberParams) build #

fn (params EditCurrentMemberParams) build() json2.Any

struct EditCurrentUserVoiceStateParams #

@[params]
struct EditCurrentUserVoiceStateParams {
pub mut:
	// the id of the channel the user is currently in
	channel_id ?Snowflake
	// toggles the user's suppress state
	suppress ?bool
	// sets the user's request to speak
	request_to_speak_timestamp ?time.Time = discord.sentinel_time
}

fn (EditCurrentUserVoiceStateParams) build #

fn (params EditCurrentUserVoiceStateParams) build() json2.Any

struct EditForumTag #

struct EditForumTag {
pub:
	// the id of the tag
	id Snowflake
	// the name of the tag (0-20 characters)
	name ?string
	// whether this tag can only be added to or removed from threads by a member with the MANAGE_THREADS permission
	moderated ?bool
	// the id of a guild's custom emoji
	emoji_id ?Snowflake = discord.sentinel_snowflake
	// the unicode character of the emoji
	emoji_name ?string = discord.sentinel_string
}

fn (EditForumTag) build #

fn (eft EditForumTag) build() json2.Any

struct EditGroupDMChannelParams #

@[params]
struct EditGroupDMChannelParams {
pub:
	reason ?string
	// 1-100 character channel name
	name ?string
	icon ?Image
}

fn (EditGroupDMChannelParams) build #

fn (params EditGroupDMChannelParams) build() json2.Any

struct EditGuildChannelParams #

@[params]
struct EditGuildChannelParams {
pub mut:
	reason ?string
	// 1-100 character channel name
	name ?string
	// the type of channel; only conversion between text and announcement is supported and only in guilds with the "NEWS" feature
	typ ?ChannelType
	// the position of the channel in the left-hand listing
	position ?int = discord.sentinel_int
	// 0-1024 character channel topic (0-4096 characters for GUILD_FORUM and GUILD_MEDIA channels)	
	topic ?string = discord.sentinel_string
	// whether the channel is nsfw
	nsfw ?bool
	// amount of seconds a user has to wait before sending another message (0-21600); bots, as well as users with the permission manage_messages or manage_channel, are unaffected
	rate_limit_per_user ?time.Duration = discord.sentinel_duration
	// the bitrate (in bits) of the voice or stage channel; min 8000
	bitrate ?int = discord.sentinel_int
	// the user limit of the voice or stage channel, max 99 for voice channels and 10,000 for stage channels (0 refers to no limit)
	user_limit ?int = discord.sentinel_int
	// channel or category-specific permissions
	permission_overwrites ?[]PermissionOverwrite = discord.sentinel_permission_overwrites
	// id of the new parent category for a channel
	parent_id ?Snowflake = discord.sentinel_snowflake
	// channel voice region id, automatic when set to none
	rtc_region ?string = discord.sentinel_string
	// the camera video quality mode of the voice channel
	video_quality_mode ?VideoQualityMode
	// the default duration that the clients use (not the API) for newly created threads in the channel, in minutes, to automatically archive the thread after recent activity
	default_auto_archive_duration ?time.Duration = discord.sentinel_duration
	// channel flags combined as a bitfield. Currently only REQUIRE_TAG (1 << 4) is supported by GUILD_FORUM and GUILD_MEDIA channels. HIDE_MEDIA_DOWNLOAD_OPTIONS (1 << 15) is supported only by GUILD_MEDIA channels
	flags ?ChannelFlags
	// the set of tags that can be used in a GUILD_FORUM or a GUILD_MEDIA channel; limited to 20
	available_tags ?[]EditForumTag
	// the emoji to show in the add reaction button on a thread in a GUILD_FORUM or a GUILD_MEDIA channel
	default_reaction_emoji ?DefaultReaction = discord.sentinel_default_reaction
	// the initial rate_limit_per_user to set on newly created threads in a channel. this field is copied to the thread at creation time and does not live update.
	default_thread_rate_limit_per_user ?time.Duration
	// the default sort order type used to order posts in GUILD_FORUM and GUILD_MEDIA channels
	default_sort_order ?SortOrderType = discord.sentinel_sort_order_type
	// the default forum layout type used to display posts in GUILD_FORUM channels
	default_forum_layout ?ForumLayoutType
}

fn (EditGuildChannelParams) build #

fn (params EditGuildChannelParams) build() json2.Any

struct EditGuildChannelPositionsParams #

struct EditGuildChannelPositionsParams {
pub mut:
	// channel id
	id Snowflake @[required]
	// sorting position of the channel
	position ?int = discord.sentinel_int
	// syncs the permission overwrites with the new parent, if moving to a new category
	lock_permissions ?bool
	// the new parent ID for the channel that is moved
	parent_id ?Snowflake = discord.sentinel_snowflake
}

fn (EditGuildChannelPositionsParams) build #

fn (params EditGuildChannelPositionsParams) build() json2.Any

struct EditGuildEmojiParams #

@[params]
struct EditGuildEmojiParams {
pub:
	reason ?string
	// name of the emoji
	name ?string
	// roles allowed to use this emoji
	roles ?[]Snowflake = discord.sentinel_snowflakes
}

fn (EditGuildEmojiParams) build #

fn (params EditGuildEmojiParams) build() json2.Any

struct EditGuildMemberParams #

@[params]
struct EditGuildMemberParams {
pub mut:
	reason ?string
	// value to set user's nickname to
	nick ?string = discord.sentinel_string
	// array of role ids the member is assigned
	roles ?[]Snowflake = discord.sentinel_snowflakes
	// whether the user is muted in voice channels. Will throw a 400 error if the user is not in a voice channel
	mute ?bool
	// whether the user is deafened in voice channels. Will throw a 400 error if the user is not in a voice channel
	deaf ?bool
	// id of channel to move user to (if they are connected to voice)
	channel_id ?Snowflake = discord.sentinel_snowflake
	// when the user's timeout will expire and the user will be able to communicate in the guild again (up to 28 days in the future), set to `none` to remove timeout. Will throw a 403 error if the user has the `administrator` permission or is the owner of the guild
	communication_disabled_until ?time.Time = discord.sentinel_time
	// guild member flags
	flags ?GuildMemberFlags = unsafe { GuildMemberFlags(discord.sentinel_int) }
}

fn (EditGuildMemberParams) build #

fn (params EditGuildMemberParams) build() json2.Any

struct EditGuildOnboardingParams #

@[params]
struct EditGuildOnboardingParams {
pub mut:
	reason ?string
	// Prompts shown during onboarding and in customize community
	prompts ?[]OnboardingPrompt
	// Channel IDs that members get opted into automatically
	default_channel_ids ?[]Snowflake
	// Whether onboarding is enabled in the guild
	enabled ?bool
	// Current mode of onboarding
	mode ?OnboardingMode
}

fn (EditGuildOnboardingParams) build #

fn (params EditGuildOnboardingParams) build() json2.Any

struct EditGuildParams #

@[params]
struct EditGuildParams {
pub mut:
	// guild name
	name ?string
	// verification level
	verification_level ?VerificationLevel = unsafe { VerificationLevel(discord.sentinel_int) }
	// default message notification level
	default_message_notifications ?MessageNotificationsLevel = unsafe { MessageNotificationsLevel(discord.sentinel_int) }
	// explicit content filter level
	explicit_content_filter ?ExplicitContentFilterLevel = unsafe { ExplicitContentFilterLevel(discord.sentinel_int) }
	// id for afk channel
	afk_channel_id ?Snowflake = discord.sentinel_snowflake
	// afk timeout in seconds, can be set to: 60, 300, 900, 1800, 3600
	afk_timeout ?time.Duration
	// base64 1024x1024 png/jpeg/gif image for the guild icon (can be animated gif when the server has the ANIMATED_ICON feature)
	icon ?Image = discord.sentinel_image
	// user id to transfer guild ownership to (must be owner)
	owner_id ?Snowflake
	// base64 16:9 png/jpeg image for the guild splash (when the server has the INVITE_SPLASH feature)
	splash ?Image = discord.sentinel_image
	// base64 16:9 png/jpeg image for the guild discovery splash (when the server has the DISCOVERABLE feature)
	discovery_splash ?Image = discord.sentinel_image
	// base64 16:9 png/jpeg image for the guild banner (when the server has the BANNER feature; can be animated gif when the server has the ANIMATED_BANNER feature)
	banner ?Image = discord.sentinel_image
	// the id of the channel where guild notices such as welcome messages and boost events are posted
	system_channel_id ?Snowflake = discord.sentinel_snowflake
	// system channel flags
	system_channel_flags ?SystemChannelFlags
	// the id of the channel where Community guilds display rules and/or guidelines
	rules_channel_id ?Snowflake = discord.sentinel_snowflake
	// the id of the channel where admins and moderators of Community guilds receive notices from Discord
	public_updates_channel_id ?Snowflake = discord.sentinel_snowflake
	// the preferred locale of a Community guild used in server discovery and notices from Discord; defaults to "en-US"
	preferred_locale ?string = discord.sentinel_string
	// enabled guild features
	features ?[]GuildFeature
	// the description for the guild
	description ?string = discord.sentinel_string
	// whether the guild's boost progress bar should be enabled
	premium_progress_bar_enabled ?bool
	// the id of the channel where admins and moderators of Community guilds receive safety alerts from Discord
	safety_alerts_channel_id ?Snowflake = discord.sentinel_snowflake
	reason                   ?string
}

fn (EditGuildParams) build #

fn (params EditGuildParams) build() json2.Any

struct EditGuildRoleParams #

@[params]
struct EditGuildRoleParams {
pub mut:
	reason ?string
	// name of the role, max 100 characters
	name ?string = discord.sentinel_string
	// bitwise value of the enabled/disabled permissions
	permissions ?Permissions = discord.sentinel_permissions
	// RGB color value
	color ?int = discord.sentinel_int
	// whether the role should be displayed separately in the sidebar
	hoist ?bool
	// the role's icon image (if the guild has the ROLE_ICONS feature)
	icon ?Image = discord.sentinel_image
	// the role's unicode emoji as a standard emoji (if the guild has the ROLE_ICONS feature)
	unicode_emoji ?string = discord.sentinel_string
	// whether the role should be mentionable
	mentionable ?bool
}

fn (EditGuildRoleParams) build #

fn (params EditGuildRoleParams) build() json2.Any

struct EditGuildRolePositionsParams #

struct EditGuildRolePositionsParams {
pub mut:
	// role
	id Snowflake @[required]
	// sorting position of the role
	position ?int = discord.sentinel_int
}

fn (EditGuildRolePositionsParams) build #

fn (params EditGuildRolePositionsParams) build() json2.Any

struct EditGuildScheduledEventParams #

@[params]
struct EditGuildScheduledEventParams {
pub mut:
	reason ?string
	// the channel id of the scheduled event, set to `none` if changing entity type to `.external`
	channel_id ?Snowflake = discord.sentinel_snowflake
	// the entity metadata of the scheduled event
	entity_metadata ?GuildScheduledEventEntityMetadata
	// sentinel
	// the name of the scheduled event
	name ?string
	// the privacy level of the scheduled event
	privacy_level ?GuildScheduledEventPrivacyLevel
	// the time to schedule the scheduled event
	scheduled_start_time ?time.Time
	// the time when the scheduled event is scheduled to end
	scheduled_end_time ?time.Time
	// the description of the scheduled event
	description ?string
	// the entity type of the scheduled event
	entity_type ?GuildScheduledEventEntityType
	// the status of the scheduled event
	status ?GuildScheduledEventStatus
	// the cover image of the scheduled event
	image ?Image = discord.sentinel_image
}

fn (EditGuildScheduledEventParams) build #

fn (params EditGuildScheduledEventParams) build() json2.Any

struct EditGuildStickerParams #

@[params]
struct EditGuildStickerParams {
pub mut:
	reason ?string
	// name of the sticker (2-30 characters)
	name ?string
	// description of the sticker (2-100 characters)
	description ?string = discord.sentinel_string
	// autocomplete/suggestion tags for the sticker (max 200 characters)
	tags ?string
}

fn (EditGuildStickerParams) build #

fn (params EditGuildStickerParams) build() json2.Any

struct EditGuildTemplateParams #

@[params]
struct EditGuildTemplateParams {
pub mut:
	// name of the template (1-100 characters)
	name ?string
	// description for the template (0-120 characters)
	description ?string = discord.sentinel_string
}

fn (EditGuildTemplateParams) build #

fn (params EditGuildTemplateParams) build() json2.Any

struct EditGuildWelcomeScreenParams #

@[params]
struct EditGuildWelcomeScreenParams {
pub mut:
	reason ?string
	// whether the welcome screen is enabled
	enabled ?bool
	// channels linked in the welcome screen and their display options
	welcome_channels ?[]WelcomeChannel
	// the server description to show in the welcome screen
	description ?string = discord.sentinel_string
}

fn (EditGuildWelcomeScreenParams) build #

fn (params EditGuildWelcomeScreenParams) build() json2.Any

struct EditGuildWidgetParams #

@[params]
struct EditGuildWidgetParams {
pub mut:
	reason ?string
	// whether the widget is enabled
	enabled ?bool
	// the widget channel id
	channel_id ?Snowflake = discord.sentinel_snowflake
}

fn (EditGuildWidgetParams) build #

fn (params EditGuildWidgetParams) build() json2.Any

struct EditMessageParams #

@[params]
struct EditMessageParams {
pub mut:
	// Message contents (up to 2000 characters)
	content ?string = discord.sentinel_string
	// Up to 10 embeds (up to 6000 characters)
	embeds ?[]Embed
	// Edit the flags of a message (only SUPPRESS_EMBEDS can currently be set/unset)
	flags ?MessageFlags
	// Allowed mentions for the message
	allowed_mentions ?AllowedMentions
	// Components to include with the message
	components ?[]Component
	// Contents of the file being sent/edited. See Uploading Files
	files ?[]File
}

fn (EditMessageParams) build #

fn (params EditMessageParams) build() json2.Any

struct EditMyUserParams #

@[params]
struct EditMyUserParams {
pub mut:
	// user's username, if changed may cause the user's discriminator to be randomized.
	username ?string
	// if passed, modifies the user's avatar
	avatar ?Image = discord.sentinel_image
	// if passed, modifies the user's banner
	banner ?Image = discord.sentinel_image
}

fn (EditMyUserParams) build #

fn (params EditMyUserParams) build() json2.Any

struct EditStageInstanceParams #

@[params]
struct EditStageInstanceParams {
pub mut:
	reason ?string
	// The topic of the Stage instance (1-120 characters)
	topic ?string
	// The privacy level of the Stage instance
	privacy_level ?PrivacyLevel
}

fn (EditStageInstanceParams) build #

fn (params EditStageInstanceParams) build() json2.Any

struct EditThreadChannelParams #

@[params]
struct EditThreadChannelParams {
pub mut:
	reason ?string
	// 1-100 character channel name
	name ?string
	// whether the thread is archived
	archived ?bool
	// the thread will stop showing in the channel list after auto_archive_duration minutes of inactivity, can be set to: 60, 1440, 4320, 10080
	auto_archive_duration ?time.Duration = discord.sentinel_duration
	// whether the thread is locked; when a thread is locked, only users with MANAGE_THREADS can unarchive it
	locked ?bool
	// whether non-moderators can add other non-moderators to a thread; only available on private threads
	invitable ?bool
	// amount of seconds a user has to wait before sending another message (0-21600); bots, as well as users with the permission manage_messages, manage_thread, or manage_channel, are unaffected
	rate_limit_per_user ?int = discord.sentinel_int
	// channel flags combined as a bitfield; PINNED can only be set for threads in forum and media channels
	flags ?ChannelFlags
	// the IDs of the set of tags that have been applied to a thread in a GUILD_FORUM or a GUILD_MEDIA channel; limited to 5
	applied_tags ?[]Snowflake
}

fn (EditThreadChannelParams) build #

fn (params EditThreadChannelParams) build() json2.Any

struct EditUserVoiceStateParams #

@[params]
struct EditUserVoiceStateParams {
pub mut:
	// the id of the channel the user is currently in
	channel_id ?Snowflake
	// toggles the user's suppress state
	suppress ?bool
}

fn (EditUserVoiceStateParams) build #

fn (params EditUserVoiceStateParams) build() json2.Any

struct EditWebhookMessageParams #

@[params]
struct EditWebhookMessageParams {
pub mut:
	// id of the thread the message is in
	thread_id ?Snowflake
	// the message contents (up to 2000 characters)
	content ?string
	// embedded `rich` content
	embeds ?[]Embed
	// allowed mentions for the message
	allowed_mentions ?AllowedMentions
	// the components to include with the message
	components ?[]Component
	// the contents of the file being sent/edited, attached files to keep and possible descriptions for new files
	files ?[]File
}

fn (EditWebhookMessageParams) build #

fn (params EditWebhookMessageParams) build() json2.Any

fn (EditWebhookMessageParams) build_query_values #

fn (params EditWebhookMessageParams) build_query_values() urllib.Values

struct EditWebhookParams #

@[params]
struct EditWebhookParams {
pub mut:
	reason ?string
	// the default name of the webhook
	name ?string
	// image for the default webhook avatar
	avatar ?Image = discord.sentinel_image
	// the new channel id this webhook should be moved to
	channel_id ?Snowflake
}

fn (EditWebhookParams) build #

fn (params EditWebhookParams) build() json2.Any

struct Embed #

struct Embed {
pub:
	// title of embed
	title ?string
	// type of embed (always "rich" for webhook embeds)
	typ ?string
	// description of embed
	description ?string
	// url of embed
	url ?string
	// timestamp of embed content
	timestamp ?time.Time
	// color code of the embed
	color ?int
	// footer information
	footer ?EmbedFooter
	// image information
	image ?EmbedImage
	// thumbnail information
	thumbnail ?EmbedThumbnail
	// video information
	video ?EmbedVideo
	// provider information
	provider ?EmbedProvider
	// author information
	author ?EmbedAuthor
	// fields information
	fields ?[]EmbedField
}

fn (Embed) build #

fn (e Embed) build() json2.Any

struct EmbedAuthor #

struct EmbedAuthor {
pub:
	// name of author
	name string
	// url of author (only supports http(s))
	url ?string
	// url of author icon (only supports http(s) and attachments)
	icon_url ?string
	// a proxied url of author icon
	proxy_icon_url ?string
}

fn (EmbedAuthor) build #

fn (ea EmbedAuthor) build() json2.Any

struct EmbedField #

struct EmbedField {
pub:
	// name of the field
	name string
	// value of the field
	value string
	// whether or not this field should display inline
	inline ?bool
}

fn (EmbedField) build #

fn (ef EmbedField) build() json2.Any

struct EmbedFooter #

struct EmbedFooter {
pub:
	// footer text
	text string
	// url of footer icon (only supports http(s) and attachments)
	icon_url ?string
	// a proxied url of footer icon
	proxy_icon_url ?string
}

fn (EmbedFooter) build #

fn (ef EmbedFooter) build() json2.Any

struct EmbedImage #

struct EmbedImage {
pub:
	// source url of image (only supports http(s) and attachments)
	url string
	// a proxied url of the image
	proxy_url ?string
	// height of image
	height ?int
	// width of image
	width ?int
}

fn (EmbedImage) build #

fn (ei EmbedImage) build() json2.Any

struct EmbedProvider #

struct EmbedProvider {
pub:
	// name of provider
	name string
	// url of provider
	url ?string
}

fn (EmbedProvider) build #

fn (ep EmbedProvider) build() json2.Any

struct EmbedThumbnail #

struct EmbedThumbnail {
pub:
	// source url of thumbnail (only supports http(s) and attachments)
	url string
	// a proxied url of the thumbnail
	proxy_url ?string
	// height of thumbnail
	height ?int
	// width of thumbnail
	width ?int
}

fn (EmbedThumbnail) build #

fn (et EmbedThumbnail) build() json2.Any

struct EmbedVideo #

struct EmbedVideo {
pub:
	// source url of video
	url ?string
	// a proxied url of the video
	proxy_url ?string
	// height of video
	height ?int
	// width of video
	width ?int
}

fn (EmbedVideo) build #

fn (ev EmbedVideo) build() json2.Any

struct EmitOptions #

@[params]
struct EmitOptions {
pub:
	error_handler ?fn (int, IError)
}

struct Emoji #

struct Emoji {
pub:
	id             ?Snowflake
	name           ?string
	roles          ?[]Snowflake
	user           ?User
	require_colons ?bool
	managed        ?bool
	animated       ?bool
	available      ?bool
}

struct Entitlement #

struct Entitlement {
pub:
	// ID of the entitlement
	id Snowflake
	// ID of the SKU
	sku_id Snowflake
	// ID of the parent application
	application_id Snowflake
	// ID of the user that is granted access to the entitlement's sku
	user_id ?Snowflake
	// Type of entitlement
	typ EntitlementType
	// Whether entitlement was deleted
	deleted bool
	// Start date at which the entitlement is valid. Not present when using test entitlements.
	starts_at ?time.Time
	// Date at which the entitlement is no longer valid. Not present when using test entitlements.
	ends_at ?time.Time
	// ID of the guild that is granted access to the entitlement's sku
	guild_id ?Snowflake
}

fn (Entitlement) get_owner #

fn (e Entitlement) get_owner() ?Snowflake

struct EntitlementCreateEvent #

struct EntitlementCreateEvent {
	BaseEvent
pub:
	entitlement Entitlement
}

struct EntitlementDeleteEvent #

struct EntitlementDeleteEvent {
	BaseEvent
pub:
	entitlement Entitlement
}

struct EntitlementUpdateEvent #

struct EntitlementUpdateEvent {
	BaseEvent
pub:
	entitlement Entitlement
}

struct EventChannel #

struct EventChannel[T] {
	id      int
	timeout ?time.Duration
mut:
	controller &EventController[T]
}

struct EventController #

struct EventController[T] {
mut:
	id        int
	wait_fors map[int]EventWaiter[T]
	listeners map[int]EventListener[T]
}

struct EventWaitParams #

@[params]
struct EventWaitParams[T] {
pub:
	check   ?Check[T]
	timeout ?time.Duration
}

struct Events #

struct Events {
pub mut:
	on_raw_event                              EventController[DispatchEvent]
	on_ready                                  EventController[ReadyEvent]
	on_resumed                                EventController[ResumedEvent]
	on_application_command_permissions_update EventController[ApplicationCommandPermissionsUpdateEvent]
	on_auto_moderation_rule_create            EventController[AutoModerationRuleCreateEvent]
	on_auto_moderation_rule_update            EventController[AutoModerationRuleUpdateEvent]
	on_auto_moderation_rule_delete            EventController[AutoModerationRuleDeleteEvent]
	on_auto_moderation_action_execution       EventController[AutoModerationActionExecutionEvent]
	on_channel_create                         EventController[ChannelCreateEvent]
	on_channel_update                         EventController[ChannelUpdateEvent]
	on_channel_delete                         EventController[ChannelDeleteEvent]
	on_thread_create                          EventController[ThreadCreateEvent]
	on_thread_update                          EventController[ThreadUpdateEvent]
	on_thread_delete                          EventController[ThreadDeleteEvent]
	on_thread_list_sync                       EventController[ThreadListSyncEvent]
	on_thread_member_update                   EventController[ThreadMemberUpdateEvent]
	on_channel_pins_update                    EventController[ChannelPinsUpdateEvent]
	on_entitlement_create                     EventController[EntitlementCreateEvent]
	on_entitlement_update                     EventController[EntitlementUpdateEvent]
	on_entitlement_delete                     EventController[EntitlementDeleteEvent]
	on_guild_create                           EventController[GuildCreateEvent]
	on_guild_update                           EventController[GuildUpdateEvent]
	on_guild_delete                           EventController[GuildDeleteEvent]
	on_guild_audit_log_entry_create           EventController[GuildAuditLogEntryCreateEvent]
	on_guild_ban_add                          EventController[GuildBanAddEvent]
	on_guild_ban_remove                       EventController[GuildBanRemoveEvent]
	on_guild_emojis_update                    EventController[GuildEmojisUpdateEvent]
	on_guild_stickers_update                  EventController[GuildStickersUpdateEvent]
	on_guild_integrations_update              EventController[GuildIntegrationsUpdateEvent]
	on_guild_member_add                       EventController[GuildMemberAddEvent]
	on_guild_member_remove                    EventController[GuildMemberRemoveEvent]
	on_guild_member_update                    EventController[GuildMemberUpdateEvent]
	on_guild_members_chunk                    EventController[GuildMembersChunkEvent]
	on_guild_role_create                      EventController[GuildRoleCreateEvent]
	on_guild_role_update                      EventController[GuildRoleUpdateEvent]
	on_guild_role_delete                      EventController[GuildRoleDeleteEvent]
	on_guild_scheduled_event_create           EventController[GuildScheduledEventCreateEvent]
	on_guild_scheduled_event_update           EventController[GuildScheduledEventUpdateEvent]
	on_guild_scheduled_event_delete           EventController[GuildScheduledEventDeleteEvent]
	on_guild_scheduled_event_user_add         EventController[GuildScheduledEventUserAddEvent]
	on_guild_scheduled_event_user_remove      EventController[GuildScheduledEventUserRemoveEvent]
	on_integration_create                     EventController[IntegrationCreateEvent]
	on_integration_update                     EventController[IntegrationUpdateEvent]
	on_integration_delete                     EventController[IntegrationDeleteEvent]
	on_invite_create                          EventController[InviteCreateEvent]
	on_invite_delete                          EventController[InviteDeleteEvent]
	on_message_create                         EventController[MessageCreateEvent]
	on_message_update                         EventController[MessageUpdateEvent]
	on_message_delete                         EventController[MessageDeleteEvent]
	on_message_delete_bulk                    EventController[MessageDeleteBulkEvent]
	on_message_reaction_add                   EventController[MessageReactionAddEvent]
	on_message_reaction_remove                EventController[MessageReactionRemoveEvent]
	on_message_reaction_remove_all            EventController[MessageReactionRemoveAllEvent]
	on_message_reaction_remove_emoji          EventController[MessageReactionRemoveEmojiEvent]
	on_presence_update                        EventController[PresenceUpdateEvent]
	on_typing_start                           EventController[TypingStartEvent]
	on_user_update                            EventController[UserUpdateEvent]
	on_voice_state_update                     EventController[VoiceStateUpdateEvent]
	on_voice_server_update                    EventController[VoiceServerUpdateEvent]
	on_webhooks_update                        EventController[WebhooksUpdateEvent]
	on_interaction_create                     EventController[InteractionCreateEvent]
	on_stage_instance_create                  EventController[StageInstanceCreateEvent]
	on_stage_instance_update                  EventController[StageInstanceUpdateEvent]
	on_stage_instance_delete                  EventController[StageInstanceDeleteEvent]
}

struct ExecuteWebhookParams #

struct ExecuteWebhookParams {
pub mut:
	// waits for server confirmation of message send before response, and returns the created message body (defaults to `false`; when `false` a message that is not saved does not return an error)
	wait ?bool
	// Send a message to the specified thread within a webhook's channel. The thread will automatically be unarchived.
	thread_id ?Snowflake
	// the message contents (up to 2000 characters)
	content ?string
	// override the default username of the webhook
	username ?string
	// override the default avatar of the webhook
	avatar_url ?string
	// true if this is a TTS message
	tts ?bool
	// embedded `rich` content
	embeds ?[]Embed
	// allowed mentions for the message
	allowed_mentions ?AllowedMentions
	// the components to include with the message
	components ?[]Component
	// the contents of the file being sent, attachment objects with filename and description
	files ?[]File
	// message flags combined as a bitfield (only `.suppress_embeds` can be set)
	flags ?MessageFlags
	// name of thread to create (requires the webhook channel to be a forum or media channel)
	thread_name ?string
	// array of tag ids to apply to the thread (requires the webhook channel to be a forum or media channel)
	applied_tags ?[]Snowflake
}

fn (ExecuteWebhookParams) build #

fn (params ExecuteWebhookParams) build() json2.Any

fn (ExecuteWebhookParams) build_query_values #

fn (params ExecuteWebhookParams) build_query_values() urllib.Values

struct FetchGlobalApplicationCommandsParams #

@[params]
struct FetchGlobalApplicationCommandsParams {
pub:
	with_localizations ?bool
}

fn (FetchGlobalApplicationCommandsParams) build_query_values #

fn (params FetchGlobalApplicationCommandsParams) build_query_values() urllib.Values

struct FetchGuildAuditLogParams #

@[params]
struct FetchGuildAuditLogParams {
pub mut:
	// Entries from a specific user ID
	user_id ?Snowflake
	// Entries for a specific audit log event
	action_type ?AuditLogEvent
	// Entries with ID less than a specific audit log entry ID
	before ?Snowflake
	// Entries with ID greater than a specific audit log entry ID
	after ?Snowflake
	// Maximum number of entries (between 1-100) to return, defaults to 50
	limit ?int
}

The following parameters can be used to filter which and how many audit log entries are returned.

fn (FetchGuildAuditLogParams) build_query_values #

fn (params FetchGuildAuditLogParams) build_query_values() urllib.Values

struct FetchGuildBansParams #

@[params]
struct FetchGuildBansParams {
pub mut:
	// number of users to return (up to maximum 1000)
	limit ?int
	// consider only users before given user id
	before ?Snowflake
	// consider only users after given user id
	after ?Snowflake
}

fn (FetchGuildBansParams) build_query_values #

fn (params FetchGuildBansParams) build_query_values() urllib.Values

struct FetchGuildPruneCountParams #

@[params]
struct FetchGuildPruneCountParams {
pub mut:
	// number of days to count prune for (1-30)
	days int
	// role(s) to include
	with_roles []Snowflake
}

fn (FetchGuildPruneCountParams) build_values #

fn (params FetchGuildPruneCountParams) build_values() urllib.Values

struct FetchGuildScheduledEventUsersParams #

@[params]
struct FetchGuildScheduledEventUsersParams {
pub mut:
	// number of users to return (up to maximum 100)
	limit ?int
	// include guild member data if it exists
	with_member ?bool
	// consider only users before given user id
	before ?Snowflake
	// consider only users after given user id
	after ?Snowflake
}

fn (FetchGuildScheduledEventUsersParams) build_query_values #

fn (params FetchGuildScheduledEventUsersParams) build_query_values() urllib.Values

struct FetchInviteParams #

@[params]
struct FetchInviteParams {
pub mut:
	// whether the invite should contain approximate member counts
	with_counts ?bool
	// whether the invite should contain the expiration date
	with_expiration ?bool
	// the guild scheduled event to include with the invite
	guild_scheduled_event_id ?Snowflake
}

fn (FetchInviteParams) build_query_values #

fn (params FetchInviteParams) build_query_values() urllib.Values

struct FetchMyGuildsParams #

@[params]
struct FetchMyGuildsParams {
pub:
	// get guilds before this guild ID
	before ?Snowflake
	// get guilds after this guild ID
	after ?Snowflake
	// max number of guilds to return (1-200)
	limit ?int
	// include approximate member and presence counts in response
	with_counts ?bool
}

fn (FetchMyGuildsParams) build_query_values #

fn (params FetchMyGuildsParams) build_query_values() urllib.Values

struct FetchReactionsParams #

@[params]
struct FetchReactionsParams {
	ReactionParams
pub mut:
	// The [type of reaction](#ReactionType)
	typ   ?ReactionType
	after ?Snowflake
	limit ?int
}

fn (FetchReactionsParams) build_query_values #

fn (params FetchReactionsParams) build_query_values() urllib.Values

struct FetchScheduledEventsParams #

@[params]
struct FetchScheduledEventsParams {
pub mut:
	// include number of users subscribed to each event
	with_user_count ?bool
}

fn (FetchScheduledEventsParams) build_query_values #

fn (params FetchScheduledEventsParams) build_query_values() urllib.Values

struct FetchThreadMemberParams #

@[params]
struct FetchThreadMemberParams {
pub mut:
	// Whether to include a guild member object for the thread member
	with_member ?bool
}

fn (FetchThreadMemberParams) build_query_values #

fn (params FetchThreadMemberParams) build_query_values() urllib.Values

struct FetchWebhookMessageParams #

@[params]
struct FetchWebhookMessageParams {
pub mut:
	// id of the thread the message is in
	thread_id ?Snowflake
}

fn (FetchWebhookMessageParams) build_query_values #

fn (params FetchWebhookMessageParams) build_query_values() urllib.Values

struct File #

struct File {
pub:
	filename     string  @[required]
	content_type string = 'application/octet-stream'
	data         []u8    @[required]
	description  ?string
}

fn (File) build #

fn (f File) build(i int) json2.Any

struct FollowedChannel #

struct FollowedChannel {
pub:
	// source channel id
	channel_id Snowflake
	// created target webhook id
	webhook_id Snowflake
}

struct Forbidden #

struct Forbidden {
	RestError
}

struct ForumTag #

struct ForumTag {
pub:
	// the id of the tag
	id Snowflake
	// the name of the tag (0-20 characters)
	name string
	// whether this tag can only be added to or removed from threads by a member with the MANAGE_THREADS permission
	moderated bool
	// the id of a guild's custom emoji
	emoji_id ?Snowflake
	// the unicode character of the emoji
	emoji_name ?string
}

fn (ForumTag) build #

fn (ft ForumTag) build() json2.Any

struct ForumThreadMessageParams #

struct ForumThreadMessageParams {
pub mut:
	// Message contents (up to 2000 characters)
	content ?string
	// Up to 10 rich embeds (up to 6000 characters)
	embeds ?[]Embed
	// Allowed mentions for the message
	allowed_mentions ?AllowedMentions
	// Components to include with the message
	components ?[]Component
	// IDs of up to 3 stickers in the server to send in the message
	sticker_ids ?[]Snowflake
	// Contents of the file being sent. See Uploading Files
	files ?[]File
	// Message flags combined as a bitfield (only `.suppress_embeds` and `.suppress_notifications` can be set)
	flags ?MessageFlags
}

fn (ForumThreadMessageParams) build #

fn (params ForumThreadMessageParams) build() json2.Any

struct Gateway #

struct Gateway {
pub mut:
	client             &GatewayClient
	close_event        chan int
	events             &Events
	large_threshold    ?int
	base_url           string
	resume_gateway_url string
	shard              ?ShardInfo
	hbq                ?time.Time
	hbs                ?time.Time
	sequence           ?int
	session_id         string
	socket             &websocket.Client = unsafe { nil }
}

fn (Gateway) mainloop #

fn (mut g Gateway) mainloop()

struct GatewayClient #

@[heap]
struct GatewayClient {
pub:
	settings        GatewayClientSettings
	intents         int
	properties      Properties
	large_threshold ?int
	gateway_url     string = 'wss://gateway.discord.gg'
	log             log.Logger
	rest            REST
	token           string
mut:
	close_code         ?int
	last_heartbeat_req ?time.Time
	last_heartbeat_res ?time.Time
	logger             log.Logger
	presence           ?UpdatePresenceParams
	read_timeout       ?time.Duration
	ready              bool
	resume_gateway_url string
	sequence           ?int
	session_id         string
	write_timeout      ?time.Duration
	close_event        chan voidptr
pub mut:
	user     User
	cache    Cache
	events   Events
	userdata map[string]voidptr
	ws       &websocket.Client = unsafe { nil }
}

fn (GatewayClient) init #

fn (mut c GatewayClient) init() !

fn (GatewayClient) latency #

fn (mut gc GatewayClient) latency() f64

fn (GatewayClient) launch #

fn (mut c GatewayClient) launch() !

fn (GatewayClient) process_dispatch #

fn (mut c GatewayClient) process_dispatch(event DispatchEvent) !bool

fn (GatewayClient) request_guild_members #

fn (mut gc GatewayClient) request_guild_members(params RequestGuildMembersParams) !

fn (GatewayClient) run #

fn (mut c GatewayClient) run() !

fn (GatewayClient) update_presence #

fn (mut gc GatewayClient) update_presence(params UpdatePresenceParams) !

fn (GatewayClient) update_voice_state #

fn (mut gc GatewayClient) update_voice_state(params VoiceStateUpdateParams) !

struct GatewayConfiguration #

struct GatewayConfiguration {
pub:
	// WSS URL that can be used for connecting to the Gateway
	url string
	// Recommended number of shards to use when connecting
	shards int
	// Information on the current session start limit
	session_start_limit SessionStartLimit
}

struct GatewayMessage #

struct GatewayMessage {
pub:
	opcode GatewayOpcode
	data   json2.Any
	seq    ?int
	event  string
}

struct GetChannelMessagesParams #

@[params]
struct GetChannelMessagesParams {
pub mut:
	// Get messages around this message ID
	around ?Snowflake
	// Get messages before this message ID
	before ?Snowflake
	// Get messages after this message ID
	after ?Snowflake
	// Max number of messages to return (1-100)
	limit ?int
}

fn (GetChannelMessagesParams) build_query_values #

fn (params GetChannelMessagesParams) build_query_values() urllib.Values

struct GifImage #

struct GifImage {
pub:
	data []u8 @[required]
}

fn (GifImage) content_type #

fn (_ GifImage) content_type() string

fn (GifImage) build #

fn (gf GifImage) build() string

struct GroupDMAddRecipientParams #

@[params]
struct GroupDMAddRecipientParams {
pub mut:
	// access token of a user that has granted your app the gdm.join scope
	access_token string @[required]
	// nickname of the user being added
	nickname ?string
}

fn (GroupDMAddRecipientParams) build #

fn (params GroupDMAddRecipientParams) build() json2.Any

struct Guild #

struct Guild {
pub:
	// guild id
	id Snowflake
	// guild name (2-100 characterrs, excluding trailing and leading whitespace)
	name string
	// icon hash
	icon ?string
	// icon hash, returned when in the template object
	icon_hash ?string
	// splash hash
	splash ?string
	// discovery splash hash; only present for guilds with the "DISCOVERABLE" feature
	discovery_splash ?string
	// id of owner
	owner_id Snowflake
	// id of afk channel
	afk_channel_id ?Snowflake
	// afk timeout
	afk_timeout time.Duration
	// true if the server widget is enabled
	widget_enabled ?bool
	// the channel id that the widget will generate an invite to, or `none` if set to no invite
	widget_channel_id ?Snowflake
	// verification level required for the guild
	verification_level VerificationLevel
	// default message notifications level
	default_message_notifications MessageNotificationsLevel
	// explicit content filter level
	explicit_content_filter ExplicitContentFilterLevel
	// roles in the guild
	roles []Role
	// custom guild emojis
	emojis []Emoji
	// enabled guild features
	features []GuildFeature
	// required MFA level for the guild
	mfa_level MFALevel
	// application id of the guild creator if it is bot-created
	application_id ?Snowflake
	// the id of the channel where guild notices such as welcome messages and boost events are posted
	system_channel_id ?Snowflake
	// system channel flags
	system_channel_flags SystemChannelFlags
	// the id of the channel where Community guilds can display rules and/or guidelines
	rules_channel_id ?Snowflake
	// the maximum number of presences for the guild (`none` is always returned, apart from largest of guilds)
	max_presences ?int
	// the maximum number of members for the guild
	max_members ?int
	// the vanity url code for the guild
	vanity_url_code ?string
	// the description of a guild
	description ?string
	// banner hash
	banner ?string
	// premium tier (Server Boost level)
	premium_tier PremiumTier
	// the number of boosts this guild currently has
	premium_subscription_count ?int
	// the preferred locale of a Community guild; used in server discovery and notices from Discord, and sent in interactions; defaults to "en-US"
	preferred_locale string
	// the id of the channel where admins and moderators of Community guilds receive notices from Discord
	public_updates_channel_id ?Snowflake
	// the maximum amount of users in a video channel
	max_video_channel_users ?int
	// // the maximum amount of users in a stage video channel
	max_stage_video_channel_users ?int
	// approximate number of members in this guild, returned from the `GET /guilds/` and `/users/@me/guilds` endpoints when `with_counts` is `true`
	approximate_member_count ?int
	// approximate number of non-offline members in this guild, returned from the `GET /guilds/` and `/users/@me/guilds` endpoints when `with_counts` is `true`
	approximate_presence_count ?int
	// the welcome screen of a Community guild, shown to new members, returned in an Invite's guild object
	welcome_screen ?WelcomeScreen
	// guild NSFW level
	nsfw_level NSFWLevel
	// custom guild stickers
	stickers []Sticker
	// whether the guild has the boost progress bar enabled
	premium_progress_bar_enabled bool
	// the id of the channel where admins and moderators of Community guilds receive safety alerts from Discord
	safety_alerts_channel_id ?Snowflake
}

fn (Guild) get_role #

fn (g Guild) get_role(role_id Snowflake) ?Role

fn (Guild) get_emoji #

fn (g Guild) get_emoji(emoji_id Snowflake) ?Emoji

fn (Guild) get_sticker #

fn (g Guild) get_sticker(sticker_id Snowflake) ?Sticker

struct Guild2 #

struct Guild2 {
	Guild
pub:
	// When this guild was joined at
	joined_at time.Time
	// `true` if this is considered a large guild
	large bool
	// Total number of members in this guild
	member_count int
	// States of members currently in voice channels; lacks the `guild_id` key
	voice_states []VoiceState
	// Users in the guild
	users []GuildMember
	// Channels in the guild
	channels []Channel
	// All active threads in the guild that current user has permission to view
	threads []Channel
	// Presences of the members in the guild, will only include non-offline members if the size is greater than `large threshold`
	presences []Presence
	// Stage instances in the guild
	stage_instances []StageInstance
	// Scheduled events in the guild
	guild_scheduled_events []GuildScheduledEvent
}

struct GuildApplicationCommandPermissions #

struct GuildApplicationCommandPermissions {
pub:
	// ID of the command or the application ID
	id Snowflake
	// ID of the application the command belongs to
	application_id Snowflake
	// ID of the guild
	guild_id Snowflake
	// Permissions for the command in the guild, max of 100
	permissions []ApplicationCommandPermission
}

struct GuildAuditLogEntryCreateEvent #

struct GuildAuditLogEntryCreateEvent {
	BaseEvent
pub:
	entry AuditLogEntry
}

Sent when a guild audit log entry is created. The inner payload is an AuditLogEntry object. This event is only sent to bots with the .view_audit_log permission.

struct GuildBanAddEvent #

struct GuildBanAddEvent {
	BaseEvent
pub:
	// ID of the guild
	guild_id Snowflake
	// User who was banned
	user User
}

struct GuildBanRemoveEvent #

struct GuildBanRemoveEvent {
	BaseEvent
pub:
	// ID of the guild
	guild_id Snowflake
	// User who was banned
	user User
}

struct GuildCreateEvent #

struct GuildCreateEvent {
	BaseEvent
pub:
	guild Guild2
}

struct GuildDeleteEvent #

struct GuildDeleteEvent {
	BaseEvent
pub:
	guild UnavailableGuild
}

struct GuildEmojisUpdateEvent #

struct GuildEmojisUpdateEvent {
	BaseEvent
pub:
	// ID of the guild
	guild_id Snowflake
	// Array of emojis
	emojis []Emoji
}

struct GuildIntegrationsUpdateEvent #

struct GuildIntegrationsUpdateEvent {
	BaseEvent
pub:
	// ID of the guild whose integrations were updated
	guild_id Snowflake
}

struct GuildMember #

@[noinit]
struct GuildMember {
pub mut:
	// the user this guild member represents
	user ?User
	// this user's guild nickname
	nick ?string
	// the member's guild avatar hash
	avatar ?string
	// array of role object ids
	roles []Snowflake
	// when the user joined the guild
	joined_at time.Time
	// when the user started boosting the guild
	premium_since ?time.Time
	// whether the user is deafened in voice channels
	deaf bool
	// whether the user is muted in voice channels
	mute bool
	// guild member flags represented as a bit set, defaults to 0
	flags GuildMemberFlags
	// whether the user has not yet passed the guild's Membership Screening requirements
	pending ?bool
	// total permissions of the member in the channel, including overwrites, returned when in the interaction object
	permissions ?Permissions
	// when the user's timeout will expire and the user will be able to communicate in the guild again, null or a time in the past if the user is not timed out
	communication_disabled_until ?time.Time
}

struct GuildMember2 #

struct GuildMember2 {
	GuildMember
pub:
	// ID of the guild
	guild_id Snowflake
}

struct GuildMemberAddEvent #

struct GuildMemberAddEvent {
	BaseEvent
pub:
	member GuildMember2
}

struct GuildMemberRemoveEvent #

struct GuildMemberRemoveEvent {
	BaseEvent
pub:
	// ID of the guild
	guild_id Snowflake
	// User who was removed
	user User
}

struct GuildMemberUpdateEvent #

struct GuildMemberUpdateEvent {
	BaseEvent
pub:
	// ID of the guild
	guild_id Snowflake
	// User role ids
	roles []Snowflake
	// User
	user User
	// Nickname of the user in the guild
	nick ?NullOr[string]
	// Member's guild avatar hash
	avatar ?string
	// When the user joined the guild
	joined_at ?time.Time
	// When the user starting boosting the guild
	premium_since ?NullOr[time.Time]
	// Whether the user is deafened in voice channels
	deaf ?bool
	// Whether the user is muted in voice channels
	mute ?bool
	// Whether the user has not yet passed the guild's Membership Screening requirements
	pending ?bool
	// When the user's timeout will expire and the user will be able to communicate in the guild again, null or a time in the past if the user is not timed out
	communication_disabled_until ?NullOr[time.Time]
}

struct GuildMembersChunkEvent #

struct GuildMembersChunkEvent {
	BaseEvent
pub:
	// ID of the guild
	guild_id Snowflake
	// Set of guild members
	members []GuildMember
	// Chunk index in the expected chunks for this response (0 <= chunk_index < chunk_count)
	chunk_index int
	// Total number of expected chunks for this response
	chunk_count int
	// When passing an invalid ID to `REQUEST_GUILD_MEMBERS`, it will be returned here
	not_found ?[]Snowflake
	// When passing true to `REQUEST_GUILD_MEMBERS`, presences of the returned members will be here
	presences ?[]Presence
	// Nonce used in the Guild Members Request
	nonce ?string
}

struct GuildOnboarding #

struct GuildOnboarding {
pub:
	// ID of the guild this onboarding is part of
	guild_id Snowflake
	// Prompts shown during onboarding and in customize community
	prompts []OnboardingPrompt
	// Channel IDs that members get opted into automatically
	default_channel_ids []Snowflake
	// Whether onboarding is enabled in the guild
	enabled bool
	// Current mode of onboarding
	mode OnboardingMode
}

struct GuildPreview #

struct GuildPreview {
pub:
	// guild id
	id Snowflake
	// guild name (2-100 characters)
	name string
	// icon hash
	icon ?string
	// splash hash
	splash ?string
	// discovery splash hash
	discovery_splash ?string
	// custom guild emojis
	emojis []Emoji
	// enabled guild features
	features []GuildFeature
	// approximate number of members in this guild
	approximate_member_count int
	// approximate number of online members in this guild
	approximate_presence_count int
	// the description for the guild
	description ?string
	// custom guild stickers
	stickers []Sticker
}

struct GuildRoleCreateEvent #

struct GuildRoleCreateEvent {
	BaseEvent
pub:
	guild_id Snowflake
	role     Role
}

struct GuildRoleDeleteEvent #

struct GuildRoleDeleteEvent {
	BaseEvent
pub:
	guild_id Snowflake
	role_id  Snowflake
}

struct GuildRoleUpdateEvent #

struct GuildRoleUpdateEvent {
	BaseEvent
pub:
	guild_id Snowflake
	role     Role
}

struct GuildScheduledEvent #

struct GuildScheduledEvent {
pub:
	// the id of the scheduled event
	id Snowflake
	// the guild id which the scheduled event belongs to
	guild_id Snowflake
	// the channel id in which the scheduled event will be hosted, or null if scheduled entity type is `.external`
	channel_id ?Snowflake
	// the id of the user that created the scheduled event
	creator_id ?Snowflake
	// the name of the scheduled event (1-100 characters)
	name string
	// the description of the scheduled event (1-1000 characters)
	description ?string
	// the time the scheduled event will start
	scheduled_start_time time.Time
	// the time the scheduled event will end, required if `entity_type` is `.external`
	scheduled_end_time ?time.Time
	// the privacy level of the scheduled event
	privacy_level GuildScheduledEventPrivacyLevel
	// the status of the scheduled event
	status GuildScheduledEventStatus
	// the type of the scheduled event
	entity_type GuildScheduledEventEntityType
	// additional metadata for the guild scheduled event
	entity_metadata ?GuildScheduledEventEntityMetadata
	// the user that created the scheduled event
	creator ?User
	// the number of users subscribed to the scheduled event
	user_count ?int
	// the cover image hash of the scheduled event
	image ?string
}

struct GuildScheduledEventCreateEvent #

struct GuildScheduledEventCreateEvent {
	BaseEvent
pub:
	event GuildScheduledEvent
}

struct GuildScheduledEventDeleteEvent #

struct GuildScheduledEventDeleteEvent {
	BaseEvent
pub:
	event GuildScheduledEvent
}

struct GuildScheduledEventEntityMetadata #

struct GuildScheduledEventEntityMetadata {
pub:
	// location of the event (1-100 characters)
	location ?string @[required]
}

fn (GuildScheduledEventEntityMetadata) build #

fn (md GuildScheduledEventEntityMetadata) build() json2.Any

struct GuildScheduledEventUpdateEvent #

struct GuildScheduledEventUpdateEvent {
	BaseEvent
pub:
	event GuildScheduledEvent
}

struct GuildScheduledEventUser #

struct GuildScheduledEventUser {
pub:
	// the scheduled event id which the user subscribed to
	guild_scheduled_event_id Snowflake
	// user which subscribed to an event
	user User
	// guild member data for this user for the guild which this event belongs to, if any
	member ?GuildMember
}

struct GuildScheduledEventUserAddEvent #

struct GuildScheduledEventUserAddEvent {
	BaseEvent
pub:
	// ID of the guild scheduled event
	guild_scheduled_event_id Snowflake
	// ID of the user
	user_id Snowflake
	// ID of the guild
	guild_id Snowflake
}

struct GuildScheduledEventUserRemoveEvent #

struct GuildScheduledEventUserRemoveEvent {
	BaseEvent
pub:
	// ID of the guild scheduled event
	guild_scheduled_event_id Snowflake
	// ID of the user
	user_id Snowflake
	// ID of the guild
	guild_id Snowflake
}

struct GuildStickersUpdateEvent #

struct GuildStickersUpdateEvent {
	BaseEvent
pub:
	// ID of the guild
	guild_id Snowflake
	// Array of stickers
	stickers []Sticker
}

struct GuildTemplate #

struct GuildTemplate {
pub:
	// the template code (unique ID)
	code string
	// template name
	name string
	// the description for the template
	description ?string
	// number of times this template has been used
	usage_count int
	// the ID of the user who created the template
	creator_id Snowflake
	// the user who created the template
	creator User
	// when this template was created
	created_at time.Time
	// when this template was last synced to the source guild
	updated_at time.Time
	// the ID of the guild this template is based on
	source_guild_id Snowflake
	// the guild snapshot this template contains
	serialized_source_guild PartialGuild
	// whether the template has unsynced changes
	is_dirty ?bool
}

struct GuildUpdateEvent #

struct GuildUpdateEvent {
	BaseEvent
pub:
	guild Guild
}

struct GuildVanityUrl #

struct GuildVanityUrl {
pub:
	code ?string
	uses int
}

struct GuildWidget #

struct GuildWidget {
pub:
	// guild id
	id Snowflake
	// guild name (2-100 characters)
	name string
	// instant invite for the guilds specified widget invite channel
	instant_invite ?string
	// voice and stage channels which are accessible by @everyone
	channels []PartialChannel
	// special widget user objects that includes users presence (Limit 100)
	members []PartialUser
	// number of online members in this guild
	presence_count int
}

struct GuildWidgetSettings #

struct GuildWidgetSettings {
pub:
	// whether the widget is enabled
	enabled bool
	// the widget channel id
	channel_id ?Snowflake
}

struct InstallParams #

struct InstallParams {
pub:
	// Scopes to add the application to the server with
	scopes []string
	// Permissions to request for the bot role
	permissions Permissions
}

fn (InstallParams) build #

fn (ip InstallParams) build() json2.Any

struct Integration #

struct Integration {
pub:
	// integration id
	id Snowflake
	// integration name
	name string
	// integration type (twitch, youtube, discord, or guild_subscription)
	typ string
	// is this integration enabled
	enabled bool
	// is this integration syncing
	syncing ?bool
	// id that this integration uses for "subscribers"
	role_id ?Snowflake
	// whether emoticons should be synced for this integration (twitch only currently)
	enable_emoticons ?bool
	// the behavior of expiring subscribers
	expire_behavior ?IntegrationExpireBehavior
	// the grace period (in days) before expiring subscribers
	expire_grace_period ?time.Duration
	// user for this integration
	user ?User
	// integration account information
	account ?IntegrationAccount
	// when this integration was last synced
	synced_at ?time.Time
	// how many subscribers this integration has
	subscriber_count ?int
	// has this integration been revoked
	revoked ?bool
	// The bot/OAuth2 application for discord integrations
	application ?IntegrationApplication
	// the scopes the application has been authorized for
	scopes ?[]string
}

struct Integration2 #

struct Integration2 {
	Integration
pub:
	// ID of the guild
	guild_id Snowflake
}

struct IntegrationAccount #

struct IntegrationAccount {
pub:
	// id of the account
	id string
	// name of the account
	name string
}

struct IntegrationApplication #

struct IntegrationApplication {
pub:
	// the id of the app
	id Snowflake
	// the name of the app
	name string
	// the icon hash of the app
	icon ?string
	// the description of the app
	description string
	// the bot associated with this application
	bot ?User
}

struct IntegrationCreateEvent #

struct IntegrationCreateEvent {
	BaseEvent
pub:
	integration Integration2
}

struct IntegrationDeleteEvent #

struct IntegrationDeleteEvent {
	BaseEvent
pub:
	// Integration ID
	id Snowflake
	// ID of the guild
	guild_id Snowflake
	// ID of the bot/OAuth2 application for this discord integration
	application_id ?Snowflake
}

struct IntegrationUpdateEvent #

struct IntegrationUpdateEvent {
	BaseEvent
pub:
	integration Integration2
}

struct Interaction #

struct Interaction {
pub:
	// ID of the interaction
	id Snowflake
	// ID of the application this interaction is for
	application_id Snowflake
	// Type of interaction
	typ InteractionType
	// Interaction data payload
	data ?json2.Any
	// Guild that the interaction was sent from
	guild_id ?Snowflake
	// Channel that the interaction was sent from
	channel ?PartialChannel
	// Channel that the interaction was sent from
	channel_id ?Snowflake
	// Guild member data for the invoking user, including permissions
	member ?GuildMember
	// User object for the invoking user, if invoked in a DM
	user ?User
	// Continuation token for responding to the interaction
	token string
	// For components, the message they were attached to
	message ?Message
	// Bitwise set of permissions the app or bot has within the channel the interaction was sent from
	app_permissions ?Permissions
	// Selected [language](#Locale) of the invoking user
	locale ?Locale
	// Guild's [preferred locale](#Locale), if invoked in a guild
	guild_locale ?Locale
	// For monetized apps, any entitlements for the invoking user, representing access to premium [SKUs](#Sku)
	entitlements []Entitlement
}

fn (Interaction) get_user #

fn (i Interaction) get_user() User

fn (Interaction) get_application_command_data #

fn (i Interaction) get_application_command_data() !ApplicationCommandData

fn (Interaction) get_message_component_data #

fn (i Interaction) get_message_component_data() !MessageComponentData

fn (Interaction) get_modal_submit_data #

fn (i Interaction) get_modal_submit_data() !ModalSubmitData

struct InteractionCreateEvent #

struct InteractionCreateEvent {
	BaseEvent
pub:
	interaction Interaction
}

struct InteractionResponse #

struct InteractionResponse {
pub:
	// the type of response
	typ InteractionResponseType
	// an optional response message
	data ?InteractionResponseData
}

fn (InteractionResponse) get_files #

fn (ir InteractionResponse) get_files() ?[]File

fn (InteractionResponse) build #

fn (ir InteractionResponse) build() json2.Any

struct InternalServerError #

struct InternalServerError {
	RestError
}

struct Invite #

struct Invite {
pub:
	// the type of invite
	typ InviteType
	// the invite code (unique ID)
	code string
	// the guild this invite is for
	guild ?PartialGuild
	// the channel this invite is for
	channel ?PartialChannel
	// the user who created the invite
	inviter ?User
	// the type of target for this voice channel invite
	target_type ?InviteTargetType
	// the user whose stream to display for this voice channel stream invite
	target_user ?User
	// the embedded application to open for this voice channel embedded application invite
	target_application ?PartialApplication
	// approximate count of online members, returned from the `GET /invites/` endpoint when `with_counts` is `true`
	approximate_presence_count ?int
	// approximate count of total members, returned from the `GET /invites/` endpoint when `with_counts` is `true`
	approximate_member_count ?int
	// the expiration date of this invite, returned from the `GET /invites/` endpoint when `with_expiration` is `true`
	expires_at ?time.Time
	// guild scheduled event data, only included if `guild_scheduled_event_id` contains a valid guild scheduled event id
	guild_scheduled_event ?GuildScheduledEvent
}

Represents a code that when used, adds a user to a guild or group DM channel.

struct InviteCreateEvent #

struct InviteCreateEvent {
	BaseEvent
pub:
	// Channel the invite is for
	channel_id Snowflake
	// Unique invite code
	code string
	// Time at which the invite was created
	created_at time.Time
	// Guild of the invite
	guild_id ?Snowflake
	// User that created the invite
	inviter ?User
	// How long the invite is valid for
	max_age time.Duration
	// Maximum number of times the invite can be used
	max_uses int
	// Type of target for this voice channel invite
	target_type ?InviteTargetType
	// User whose stream to display for this voice channel stream invite
	target_user ?User
	// Embedded application to open for this voice channel embedded application invite
	target_application ?PartialApplication
	// Whether or not the invite is temporary (invited users will be kicked on disconnect unless they're assigned a role)
	temporary bool
	// How many times the invite has been used (always will be 0)
	// uses int // not provided because it is always 0 in event
}

struct InviteDeleteEvent #

struct InviteDeleteEvent {
	BaseEvent
pub:
	// Channel the invite is for
	channel_id Snowflake
	// Unique invite code
	code string
	// Time at which the invite was created
	created_at time.Time
	// Guild of the invite
	guild_id ?Snowflake
	// User that created the invite
	inviter ?User
	// How long the invite is valid for
	max_age time.Duration
	// Maximum number of times the invite can be used
	max_uses int
	// Type of target for this voice channel invite
	target_type ?InviteTargetType
	// User whose stream to display for this voice channel stream invite
	target_user ?User
	// Embedded application to open for this voice channel embedded application invite
	target_application ?PartialApplication
	// Whether or not the invite is temporary (invited users will be kicked on disconnect unless they're assigned a role)
	temporary bool
	// How many times the invite has been used (always will be 0)
	// uses int // not provided because it is always 0 in event
}

struct InviteMetadata #

struct InviteMetadata {
	Invite
pub:
	// number of times this invite has been used
	uses int
	// max number of times this invite can be used
	max_uses int
	// duration after which the invite expires
	max_age time.Duration
	// whether this invite only grants temporary membership
	temporary bool
	// when this invite was created
	created_at time.Time
}

Extra information about an invite, will extend the invite object.

struct JpegImage #

struct JpegImage {
pub:
	data []u8 @[required]
}

fn (JpegImage) content_type #

fn (_ JpegImage) content_type() string

fn (JpegImage) build #

fn (jf JpegImage) build() string

struct ListArchivedThreadsParams #

@[params]
struct ListArchivedThreadsParams {
pub mut:
	// returns threads archived before this timestamp
	before ?time.Time
	// optional maximum number of threads to return
	limit ?int
}

fn (ListArchivedThreadsParams) build_query_values #

fn (params ListArchivedThreadsParams) build_query_values() urllib.Values

struct ListEntitlementParams #

@[params]
struct ListEntitlementParams {
pub mut:
	// User ID to look up entitlements for
	user_id ?Snowflake
	// Optional list of SKU IDs to check entitlements for
	sku_ids ?[]Snowflake
	// Retrieve entitlements before this entitlement ID
	before ?Snowflake
	// Retrieve entitlements after this entitlement ID
	after ?Snowflake
	// Number of entitlements to return, 1-100, default 100
	limit ?int
	// Guild ID to look up entitlements for
	guild_id ?Snowflake
	// Whether or not ended entitlements should be omitted
	exclude_ended ?bool
}

fn (ListEntitlementParams) build_query_values #

fn (params ListEntitlementParams) build_query_values() urllib.Values

struct ListGuildMembersParams #

@[params]
struct ListGuildMembersParams {
pub mut:
	// max number of members to return (1-1000)
	limit ?int
	// the highest user id in the previous page
	after ?Snowflake
}

fn (ListGuildMembersParams) build_query_values #

fn (params ListGuildMembersParams) build_query_values() urllib.Values

struct ListJoinedPrivateArchivedThreadsParams #

@[params]
struct ListJoinedPrivateArchivedThreadsParams {
pub mut:
	// returns threads before this id
	before ?Snowflake
	// optional maximum number of threads to return
	limit ?int
}

fn (ListJoinedPrivateArchivedThreadsParams) build_query_values #

fn (params ListJoinedPrivateArchivedThreadsParams) build_query_values() urllib.Values

struct ListThreadMembersParams #

@[params]
struct ListThreadMembersParams {
pub mut:
	// Whether to include a guild member object for each thread member
	with_member ?bool
	// Get thread members after this user ID
	after ?Snowflake
	// Max number of thread members to return (1-100). Defaults to 100.
	limit ?int
}

fn (ListThreadMembersParams) build_query_values #

fn (params ListThreadMembersParams) build_query_values() urllib.Values

struct ListThreadsResponse #

struct ListThreadsResponse {
pub mut:
	// the threads
	threads []Channel
	// a thread member object for each returned thread the current user has joined
	members []ThreadMember
	// whether there are potentially additional threads that could be returned on a subsequent call
	has_more bool
}

struct MentionableSelect #

struct MentionableSelect {
pub:
	// ID for the select menu; max 100 characters
	custom_id string @[required]
	// Placeholder text if nothing is selected; max 150 characters
	placeholder ?string
	// List of default values for auto-populated select menu components; number of default values must be in the range defined by `min_values` and `max_values`
	default_values ?[]DefaultValue
	// Minimum number of items that must be chosen (defaults to 1); min 0, max 25
	min_values ?int
	// Maximum number of items that can be chosen (defaults to 1); max 25
	max_values ?int
	// Whether select menu is disabled (defaults to `false`)
	disabled ?bool
}

fn (MentionableSelect) build #

fn (ms MentionableSelect) build() json2.Any

struct Message #

@[heap]
struct Message {
pub:
	// id of the message
	id Snowflake
	// id of the channel the message was sent in
	channel_id Snowflake
	// the author of this message (not guaranteed to be a valid user, see below)
	author User
	// contents of the message
	content string
	// when this message was sent
	timestamp time.Time
	// when this message was edited (or null if never)
	edited_timestamp ?time.Time
	// whether this was a TTS message
	tts bool
	// whether this message mentions everyone
	mention_everyone bool
	// users specifically mentioned in the message
	mentions []User
	// roles specifically mentioned in this message
	mention_roles []Snowflake
	// channels specifically mentioned in this message
	mention_channels ?[]ChannelMention
	// any attached files
	attachments []Attachment
	// any embedded content
	embeds []Embed
	// reactions to the message
	reactions ?[]Reaction
	// used for validating a message was sent
	nonce ?Nonce
	// whether this message is pinned
	pinned bool
	// if the message is generated by a webhook, this is the webhook's id
	webhook_id ?Snowflake
	// type of message
	typ MessageType
	// sent with Rich Presence-related chat embeds
	activity ?MessageActivity
	// sent with Rich Presence-related chat embeds
	application ?PartialApplication
	// if the message is an Interaction or application-owned webhook, this is the id of the application
	application_id ?Snowflake
	// data showing the source of a crosspost, channel follow add, pin, or reply message
	message_reference ?MessageReference
	// message flags combined as a bitfield
	flags ?MessageFlags
	// the message associated with the message_reference
	// > May be nil
	referenced_message ?&Message
	// sent if the message is a response to an Interaction
	interaction ?MessageInteraction
	// the thread that was started from this message, includes thread member object
	thread ?Channel
	// sent if the message contains components like buttons, action rows, or other interactive components
	components ?[]Component
	// sent if the message contains stickers
	sticker_items ?[]StickerItem
	// A generally increasing integer (there may be gaps or duplicates) that represents the approximate position of the message in a thread, it can be used to estimate the relative position of the message in a thread in company with total_message_sent on parent thread
	position ?int
	// data of the role subscription purchase or renewal that prompted this ROLE_SUBSCRIPTION_PURCHASE message
	role_subscription_data ?RoleSubscriptionData
	// data for users, members, channels, and roles in the message's auto-populated select menus
	resolved ?Resolved
}

struct Message2 #

struct Message2 {
	Message
pub:
	// ID of the guild the message was sent in - unless it is an ephemeral message
	guild_id ?Snowflake
	// Member properties for this message's author. Missing for ephemeral messages and messages from webhooks
	member ?PartialGuildMember
}

struct MessageActivity #

struct MessageActivity {
pub:
	// type of message activity
	typ MessageActivityType
	// party_id from a Rich Presence event
	party_id ?Snowflake
}

struct MessageComponentData #

struct MessageComponentData {
pub:
	// the custom_id of the component
	custom_id string
	// the type of the component
	component_type ComponentType
	// values the user selected in a select menu component
	values ?[]string
	// resolved entities from selected options
	resolved ?Resolved
}

struct MessageCreateEvent #

struct MessageCreateEvent {
	BaseEvent
pub:
	message Message2
}

struct MessageDeleteBulkEvent #

struct MessageDeleteBulkEvent {
	BaseEvent
pub:
	// IDs of the messages
	ids []Snowflake
	// ID of the channel
	channel_id Snowflake
	// ID of the guild
	guild_id ?Snowflake
}

struct MessageDeleteEvent #

struct MessageDeleteEvent {
	BaseEvent
pub:
	// ID of the message
	id Snowflake
	// ID of the channel
	channel_id Snowflake
	// ID of the guild
	guild_id ?Snowflake
}

struct MessageInteraction #

struct MessageInteraction {
pub:
	// ID of the interaction
	id Snowflake
	// Type of interaction
	typ InteractionType
	// Name of the application command, including subcommands and subcommand groups
	name string
	// User who invoked the interaction
	user User
	// Member who invoked the interaction in the guild
	member ?PartialGuildMember
}

struct MessageInteractionResponse #

struct MessageInteractionResponse {
	MessageResponseData
}

fn (MessageInteractionResponse) get_files #

fn (r MessageInteractionResponse) get_files() ?[]File

fn (MessageInteractionResponse) build #

fn (mir MessageInteractionResponse) build() json2.Any

struct MessageReactionAddEvent #

struct MessageReactionAddEvent {
	BaseEvent
pub:
	// ID of the user
	user_id Snowflake
	// ID of the channel
	channel_id Snowflake
	// ID of the message
	message_id Snowflake
	// ID of the guild
	guild_id ?Snowflake
	// Member who reacted if this happened in a guild
	member ?GuildMember
	// Emoji used to react
	emoji PartialEmoji
	// ID of the user who authored the message which was reacted to
	message_author_id ?Snowflake
}

struct MessageReactionRemoveAllEvent #

struct MessageReactionRemoveAllEvent {
	BaseEvent
pub:
	// ID of the channel
	channel_id Snowflake
	// ID of the message
	message_id Snowflake
	// ID of the guild
	guild_id ?Snowflake
}

struct MessageReactionRemoveEmojiEvent #

struct MessageReactionRemoveEmojiEvent {
	BaseEvent
pub:
	// ID of the channel
	channel_id Snowflake
	// ID of the message
	message_id Snowflake
	// ID of the guild
	guild_id ?Snowflake
	// Emoji that was removed
	emoji PartialEmoji
}

struct MessageReactionRemoveEvent #

struct MessageReactionRemoveEvent {
	BaseEvent
pub:
	// ID of the user
	user_id Snowflake
	// ID of the channel
	channel_id Snowflake
	// ID of the message
	message_id Snowflake
	// ID of the guild
	guild_id ?Snowflake
	// Emoji used to react
	emoji PartialEmoji
}

struct MessageReference #

struct MessageReference {
pub:
	// id of the originating message
	message_id ?Snowflake
	// id of the originating message's channel
	channel_id ?Snowflake
	// id of the originating message's guild
	guild_id ?Snowflake
	// when sending, whether to error if the referenced message doesn't exist instead of sending as a normal (non-reply) message, default true
	fail_if_not_exists ?bool
}

fn (MessageReference) build #

fn (mr MessageReference) build() json2.Any

struct MessageResponseData #

struct MessageResponseData {
pub:
	// is the response TTS
	tts ?bool
	// message content
	content ?string
	// supports up to 10 embeds
	embeds ?[]Embed
	// allowed mentions object
	allowed_mentions ?AllowedMentions
	// message flags combined as a bitfield (only SUPPRESS_EMBEDS and EPHEMERAL can be set)
	flags ?MessageFlags
	// message components
	components ?[]Component
	// uploaded files
	files ?[]File
}

fn (MessageResponseData) is_interaction_response_data #

fn (_ MessageResponseData) is_interaction_response_data()

fn (MessageResponseData) get_files #

fn (mrd MessageResponseData) get_files() ?[]File

fn (MessageResponseData) build #

fn (mrd MessageResponseData) build() json2.Any

struct MessageUpdateEvent #

struct MessageUpdateEvent {
	BaseEvent
pub:
	message Message2
}

struct ModalInteractionResponse #

struct ModalInteractionResponse {
pub:
	// a developer-defined identifier for the modal, max 100 characters
	custom_id string
	// the title of the popup modal, max 45 characters
	title string
	// between 1 and 5 (inclusive) components that make up the modal
	components []Component
}

fn (ModalInteractionResponse) get_files #

fn (_ ModalInteractionResponse) get_files() ?[]File

fn (ModalInteractionResponse) build #

fn (mir ModalInteractionResponse) build() json2.Any

struct ModalResponseData #

struct ModalResponseData {
pub:
	// a developer-defined identifier for the modal, max 100 characters
	custom_id string @[required]
	// the title of the popup modal, max 45 characters
	title string @[required]
	// between 1 and 5 (inclusive) components that make up the modal
	components []Component @[required]
}

fn (ModalResponseData) is_interaction_response_data #

fn (_ ModalResponseData) is_interaction_response_data()

fn (ModalResponseData) get_files #

fn (_ ModalResponseData) get_files() ?[]File

fn (ModalResponseData) build #

fn (mrd ModalResponseData) build() json2.Any

struct ModalSubmitData #

struct ModalSubmitData {
pub:
	// the custom_id of the modal
	custom_id string
	// the values submitted by the user
	components []Component
}

fn (ModalSubmitData) get #

fn (msd ModalSubmitData) get(custom_id string) ?string

struct NewCDNParams #

@[params]
struct NewCDNParams {
pub:
	base string = discord.default_cdn_url
}

struct NoneFile #

struct NoneFile {
	data []u8 = []
}

fn (NoneFile) content_type #

fn (_ NoneFile) content_type() string

fn (NoneFile) build #

fn (_ NoneFile) build() string

struct NotFound #

struct NotFound {
	RestError
}

struct NullOr #

struct NullOr[T] {
pub:
	is_null bool
	val     T
}

struct OnboardingPrompt #

struct OnboardingPrompt {
pub:
	// ID of the prompt
	id Snowflake
	// Type of prompt
	typ PromptType
	// Options available within the prompt
	options []PromptOption
	// Title of the prompt
	title string
	// Indicates whether users are limited to selecting one option for the prompt
	single_select bool
	// Indicates whether the prompt is required before a user completes the onboarding flow
	required bool
	// Indicates whether the prompt is present in the onboarding flow. If `false`, the prompt will only appear in the Channels & Roles tab
	in_onboarding bool
}

fn (OnboardingPrompt) build #

fn (op OnboardingPrompt) build() json2.Any

struct PartialApplication #

struct PartialApplication {
pub:
	// ID of the app
	id Snowflake
	// Name of the app
	name ?string
	// Icon hash of the app
	icon ?string
	// Description of the app
	description ?string
	// When `false`, only the app owner can add the app to guilds
	bot_public ?bool
	// When `true`, the app's bot will only join upon completion of the full OAuth2 code grant flow
	bot_require_code_grant ?bool
	// URL of the app's Terms of Service
	terms_of_service_url ?string
	// URL of the app's Privacy Policy
	privacy_policy_url ?string
	// Key for verification in interactions and the GameSDK's GetTicket
	verify_key ?[]u8
	// App's public flags
	flags ApplicationFlags
	// List of tags describing the content and functionality of the app. Max of 5 tags.
	tags ?[]string
}

struct PartialChannel #

struct PartialChannel {
pub:
	id                            Snowflake
	typ                           ChannelType
	position                      ?int
	permission_overwrites         ?[]PermissionOverwrite
	name                          ?string
	topic                         ?string
	nsfw                          ?bool
	bitrate                       ?int
	user_limit                    ?int
	parent_id                     ?Snowflake
	default_auto_archive_duration ?time.Duration
	permissions                   ?Permissions
	flags                         ?ChannelFlags
	available_tags                ?[]ForumTag
}

fn (PartialChannel) build #

fn (pc PartialChannel) build() json2.Any

struct PartialEmoji #

struct PartialEmoji {
pub:
	id             ?Snowflake
	name           ?string
	roles          ?[]Snowflake
	user           ?User
	require_colons ?bool
	managed        ?bool
	animated       ?bool
	available      ?bool
}

struct PartialGuild #

struct PartialGuild {
pub:
	// guild id
	id Snowflake
	// guild name (2-100 characters, excluding trailing and leading whitespace)
	name string
	// icon hash
	icon ?string
	// icon hash, returned when in the template object
	icon_hash ?string
	// true if the user is the owner of the guild
	owner ?bool
	// total permissions for the user in the guild (excludes overwrites and implicit permissions)
	permissions ?Permissions
	// verification level required for the guild
	verification_level ?VerificationLevel
	// default message notifications level
	default_message_notifications ?MessageNotificationsLevel
	// explicit content filter level
	explicit_content_filter ?ExplicitContentFilterLevel
	// roles in the guild
	roles ?[]Role
	// enabled guild features
	features ?[]GuildFeature
	// the id of the channel where guild notices such as welcome messages and boost events are posted
	system_channel_id ?Snowflake
	// system channel flags
	system_channel_flags ?SystemChannelFlags
	// approximate number of members in this guild, returned from the `GET /guilds/` and `/users/@me/guilds` endpoints when `with_counts` is true
	approximate_member_count ?int
	// approximate number of non-offline members in this guild, returned from the `GET /guilds/` and `/users/@me/guilds` endpoints when `with_counts` is true
	approximate_presence_count ?int
}

struct PartialGuildMember #

struct PartialGuildMember {
pub:
	user                         ?User
	nick                         ?string
	avatar                       ?string
	roles                        ?[]Snowflake
	joined_at                    ?time.Time
	premium_since                ?time.Time
	deaf                         ?bool
	mute                         ?bool
	flags                        ?GuildMemberFlags
	pending                      ?bool
	permissions                  ?Permissions
	communication_disabled_until ?time.Time
}

struct PartialIntegration #

struct PartialIntegration {
pub:
	// integration id
	id Snowflake
	// integration name
	name ?string
	// integration type (twitch, youtube, discord, or guild_subscription)
	typ ?string
	// is this integration enabled
	enabled ?bool
	// is this integration syncing
	syncing ?bool
	// id that this integration uses for "subscribers"
	role_id ?Snowflake
	// whether emoticons should be synced for this integration (twitch only currently)
	enable_emoticons ?bool
	// the behavior of expiring subscribers
	expire_behavior ?IntegrationExpireBehavior
	// the grace period (in days) before expiring subscribers
	expire_grace_period ?time.Duration
	// user for this integration
	user ?User
	// integration account information
	account ?IntegrationAccount
	// when this integration was last synced
	synced_at ?time.Time
	// how many subscribers this integration has
	subscriber_count ?int
	// has this integration been revoked
	revoked ?bool
	// The bot/OAuth2 application for discord integrations
	application ?IntegrationApplication
	// the scopes the application has been authorized for
	scopes ?[]string
}

struct PartialMessage #

struct PartialMessage {
pub:
	// id of the message
	id Snowflake
	// id of the channel the message was sent in
	channel_id Snowflake
	// the author of this message (not guaranteed to be a valid user, see below)
	author User
	// contents of the message
	content ?string
	// when this message was sent
	timestamp ?time.Time
	// when this message was edited (or null if never)
	edited_timestamp ?time.Time
	// whether this was a TTS message
	tts ?bool
	// whether this message mentions everyone
	mention_everyone ?bool
	// users specifically mentioned in the message
	mentions ?[]User
	// roles specifically mentioned in this message
	mention_roles ?[]Snowflake
	// channels specifically mentioned in this message
	mention_channels ?[]ChannelMention
	// any attached files
	attachments ?[]Attachment
	// any embedded content
	embeds ?[]Embed
	// reactions to the message
	reactions ?[]Reaction
	// used for validating a message was sent
	nonce ?Nonce
	// whether this message is pinned
	pinned ?bool
	// if the message is generated by a webhook, this is the webhook's id
	webhook_id ?Snowflake
	// type of message
	typ ?MessageType
	// sent with Rich Presence-related chat embeds
	activity ?MessageActivity
	// sent with Rich Presence-related chat embeds
	application ?PartialApplication
	// if the message is an Interaction or application-owned webhook, this is the id of the application
	application_id ?Snowflake
	// data showing the source of a crosspost, channel follow add, pin, or reply message
	message_reference ?MessageReference
	// message flags combined as a bitfield
	flags ?MessageFlags
	// the message associated with the message_reference
	referenced_message ?&Message
	// sent if the message is a response to an Interaction
	interaction ?MessageInteraction
	// the thread that was started from this message, includes thread member object
	thread ?Channel
	// sent if the message contains components like buttons, action rows, or other interactive components
	components ?[]Component
	// sent if the message contains stickers
	sticker_items ?[]StickerItem
	// A generally increasing integer (there may be gaps or duplicates) that represents the approximate position of the message in a thread, it can be used to estimate the relative position of the message in a thread in company with total_message_sent on parent thread
	position ?int
	// data of the role subscription purchase or renewal that prompted this ROLE_SUBSCRIPTION_PURCHASE message
	role_subscription_data ?RoleSubscriptionData
}

struct PartialUser #

struct PartialUser {
pub:
	// the user's id
	id Snowflake
	// the user's username, not unique across the platform
	username ?string
	// the user's Discord-tag
	discriminator ?string
	// the user's display name, if it is set. For bots, this is the application name
	global_name ?string
	// the user's avatar hash
	avatar ?string
	// whether the user belongs to an OAuth2 application
	bot ?bool
	// whether the user is an Official Discord System user (part of the urgent message system)
	system ?bool
	// whether the user has two factor enabled on their account
	mfa_enabled ?bool
	// the user's banner hash
	banner ?string
	// the user's banner color encoded as an integer representation of hexadecimal color code
	accent_color ?int
	// the user's chosen [language option](#Locale)
	locale ?string
	// whether the email on this account has been verified
	verified ?bool
	// the user's email
	email ?string
	// the flags on a user's account
	flags ?UserFlags
	// the type of Nitro subscription on a user's account
	premium_type ?PremiumType
	// the public flags on a user's account
	public_flags ?UserFlags
	// data for the user's avatar decoration
	avatar_decoration_data ?AvatarDecorationData
}

struct PermissionOverwrite #

struct PermissionOverwrite {
pub:
	// role or user id
	id Snowflake
	// either 0 (role) or 1 (member)
	typ PermissionOverwriteType
	// permission bit set
	allow Permissions = discord.sentinel_permissions
	// permission bit set
	deny Permissions = discord.sentinel_permissions
}

See permissions for more information about the allow and deny fields.

fn (PermissionOverwrite) build #

fn (po PermissionOverwrite) build() json2.Any

struct PngImage #

struct PngImage {
pub:
	data []u8 @[required]
}

fn (PngImage) content_type #

fn (_ PngImage) content_type() string

fn (PngImage) build #

fn (pf PngImage) build() string

struct Presence #

struct Presence {
pub:
	// User whose presence is being updated
	user PartialUser
	// ID of the guild
	guild_id Snowflake
	// Either "idle", "dnd", "online", or "offline"
	status Status
	// User's current activities
	activities []Activity
	// User's platform-dependent status
	client_status ClientStatus
}

struct PresenceUpdateEvent #

struct PresenceUpdateEvent {
	BaseEvent
pub:
	presence Presence
}

struct PromptOption #

struct PromptOption {
pub:
	// ID of the prompt option
	id Snowflake
	// IDs for channels a member is added to when the option is selected
	channel_ids []Snowflake
	// IDs for roles assigned to a member when the option is selected
	role_ids []Snowflake
	// Emoji of the option (see below)
	emoji ?Emoji
	// Emoji ID of the option (see below)
	emoji_id ?Snowflake
	// Emoji name of the option (see below)
	emoji_name ?string
	// Whether the emoji is animated (see below)
	emoji_animated ?bool
	// Title of the option
	title string
	// Description of the option
	description string
}

fn (PromptOption) build #

fn (po PromptOption) build() json2.Any

struct Properties #

struct Properties {
pub:
	os      string = os.user_os()
	browser string = 'discord.v'
	device  string = 'discord.v'
}

struct REST #

struct REST {
pub:
	token      string
	base_url   string = 'https://discord.com/api/v10'
	user_agent string = discord.default_user_agent
	http       ?HTTPClient
}

fn (REST) add_guild_member #

fn (rest &REST) add_guild_member(guild_id Snowflake, user_id Snowflake, params AddGuildMemberParams) !GuildMember

Adds a user to the guild, provided you have a valid oauth2 access token for the user with the guilds.join scope. Returns a 201 Created with the guild member as the body, or 204 No Content if the user is already a member of the guild. Fires a Guild Member Add Gateway event. For guilds with Membership Screening enabled, this endpoint will default to adding new members as pending in the guild member object. Members that are pending will have to complete membership screening before they become full members that can talk.

fn (REST) add_guild_member_role #

fn (rest &REST) add_guild_member_role(guild_id Snowflake, user_id Snowflake, role_id Snowflake, params ReasonParam) !

Adds a role to a guild member. Requires the .manage_roles permission. Returns a 204 empty response on success. Fires a Guild Member Update Gateway event.

fn (REST) add_thread_member #

fn (rest &REST) add_thread_member(channel_id Snowflake, user_id Snowflake) !

Adds another member to a thread. Requires the ability to send messages in the thread. Also requires the thread is not archived. Returns nothing if the member is successfully added or was already a member of the thread. Fires a Thread Members Update Gateway event.

fn (REST) begin_guild_prune #

fn (rest &REST) begin_guild_prune(guild_id Snowflake, params BeginGuildPruneParams) !int

Begin a prune operation. Requires the .kick_members permission. Returns an object with one pruned key indicating the number of members that were removed in the prune operation. For large guilds it's recommended to set the compute_prune_count option to false, forcing pruned to null. Fires multiple Guild Member Remove Gateway events.

fn (REST) bulk_guild_ban #

fn (rest &REST) bulk_guild_ban(guild_id Snowflake, params BulkGuildBanParams) !BulkBanResponse

Ban up to 200 users from a guild, and optionally delete previous messages sent by the banned users. Requires both the .ban_members and .manage_guild permissions. Returns 200 response on success, including a field banned_users with the IDs of the banned users and failed_users with all that were not be banned. The list of failed_users will also include all users that were already banned.

fn (REST) bulk_overwrite_global_application_commands #

fn (rest &REST) bulk_overwrite_global_application_commands(application_id Snowflake, commands []CreateApplicationCommandParams) ![]ApplicationCommand

Takes a list of application commands, overwriting the existing global command list for this application. Returns 200 and a list of application command objects. Commands that do not already exist will count toward daily application command create limits.

fn (REST) bulk_overwrite_guild_application_commands #

fn (rest &REST) bulk_overwrite_guild_application_commands(application_id Snowflake, guild_id Snowflake, commands []CreateApplicationCommandParams) ![]ApplicationCommand

Takes a list of application commands, overwriting the existing command list for this application for the targeted guild. Returns 200 and a list of application command objects.

fn (REST) create_auto_moderation_rule #

fn (rest &REST) create_auto_moderation_rule(guild_id Snowflake, params CreateAutoModerationRuleParams) !AutoModerationRule

Create a new rule. Returns an auto moderation rule on success. Fires an Auto Moderation Rule Create Gateway event.

fn (REST) create_dm #

fn (rest &REST) create_dm(recipient_id Snowflake) !Channel

Create a new DM channel with a user. Returns a DM channel object (if one already exists, it will be returned instead). > You should not use this endpoint to DM everyone in a server about something. DMs should generally be initiated by a user action. If you open a significant amount of DMs too quickly, your bot may be rate limited or blocked from opening new ones.

fn (REST) create_followup_message #

fn (rest &REST) create_followup_message(application_id Snowflake, interaction_token string, params ExecuteWebhookParams) !Message

Create a followup message for an Interaction. Functions the same as Client.execute_webhook, but wait is always true. The thread_id, avatar_url, and username parameters are not supported when using this endpoint for interaction followups. flags can be set to .ephemeral to mark the message as ephemeral, except when it is the first followup message to a deferred Interactions Response. In that case, the flags field will be ignored, and the ephemerality of the message will be determined by the flags value in your original ACK.

fn (REST) create_global_application_command #

fn (rest &REST) create_global_application_command(application_id Snowflake, params CreateApplicationCommandParams) !ApplicationCommand

Create a new global command. Returns 201 if a command with the same name does not already exist, or a 200 if it does (in which case the previous command will be overwritten). Both responses include an application command object.

fn (REST) create_group_dm #

fn (rest &REST) create_group_dm(params CreateGroupDMParams) !Channel

Create a new group DM channel with multiple users. Returns a DM channel object. This endpoint was intended to be used with the now-deprecated GameBridge SDK. Fires a Channel Create Gateway event.

fn (REST) create_guild #

fn (rest &REST) create_guild(params CreateGuildParams) !Guild

fn (REST) create_guild_application_command #

fn (rest &REST) create_guild_application_command(application_id Snowflake, guild_id Snowflake, params CreateApplicationCommandParams) !ApplicationCommand

Create a new guild command. New guild commands will be available in the guild immediately. Returns 201 if a command with the same name does not already exist, or a 200 if it does (in which case the previous command will be overwritten). Both responses include an application command object.

fn (REST) create_guild_ban #

fn (rest &REST) create_guild_ban(guild_id Snowflake, user_id Snowflake, params CreateGuildBanParams) !

Create a guild ban, and optionally delete previous messages sent by the banned user. Requires the .ban_members permission. Returns a 204 empty response on success. Fires a Guild Ban Add Gateway event.

fn (REST) create_guild_channel #

fn (rest &REST) create_guild_channel(guild_id Snowflake, params CreateGuildChannelParams) !Channel

Create a new channel object for the guild. Requires the .manage_channels permission. If setting permission overwrites, only permissions your bot has in the guild can be allowed/denied. Setting .manage_roles permission in channels is only possible for guild administrators. Returns the new channel object on success. Fires a Channel Create Gateway event.

fn (REST) create_guild_emoji #

fn (rest &REST) create_guild_emoji(guild_id Snowflake, params CreateGuildEmojiParams) !Emoji

Create a new emoji for the guild. Requires the .create_guild_expressions permission. Returns the new emoji object on success. Fires a Guild Emojis Update Gateway event.

fn (REST) create_guild_from_guild_template #

fn (rest &REST) create_guild_from_guild_template(template_code string, params CreateGuildFromGuildTemplateParams) !Guild

Create a new guild based on a template. Returns a guild object on success. Fires a Guild Create Gateway event. > i This endpoint can be used only by bots in less than 10 guilds.

fn (REST) create_guild_role #

fn (rest &REST) create_guild_role(guild_id Snowflake, params CreateGuildRoleParams) !Role

Create a new role for the guild. Requires the .manage_roles permission. Returns the new role object on success. Fires a Guild Role Create Gateway event. All JSON params are optional.

fn (REST) create_guild_scheduled_event #

fn (rest &REST) create_guild_scheduled_event(guild_id Snowflake, params CreateGuildScheduledEventParams) !GuildScheduledEvent

Create a guild scheduled event in the guild. Returns a guild scheduled event object on success. Fires a Guild Scheduled Event Create Gateway event. > i A guild can have a maximum of 100 events with .scheduled or .active status at any time.

fn (REST) create_guild_sticker #

fn (rest &REST) create_guild_sticker(guild_id Snowflake, params CreateGuildStickerParams) !Sticker

Create a new sticker for the guild. Requires the .create_guild_expressions permission. Returns the new sticker object on success. Fires a Guild Stickers Update Gateway event. Every guilds has five free sticker slots by default, and each Boost level will grant access to more slots. > i Lottie stickers can only be uploaded on guilds that have either the VERIFIED and/or the PARTNERED guild feature.

fn (REST) create_guild_template #

fn (rest &REST) create_guild_template(guild_id Snowflake, params CreateGuildTemplateParams) !GuildTemplate

Creates a template for the guild. Requires the .manage_guild permission. Returns the created guild template object on success.

fn (REST) create_interaction_response #

fn (rest &REST) create_interaction_response(interaction_id Snowflake, interaction_token string, response IInteractionResponse) !

Create a response to an Interaction from the gateway. Body is an interaction response. Returns 204 No Content. This endpoint also supports file attachments similar to the webhook endpoints. Refer to Uploading Files for details on uploading files and multipart/form-data requests.

fn (REST) create_invite #

fn (rest &REST) create_invite(channel_id Snowflake, params CreateInviteParams) !Invite

Create a new invite object for the channel. Only usable for guild channels. Requires the .create_instant_invite permission. All JSON parameters for this route are optional. Returns an invite object. Fires an Invite Create Gateway event.

fn (REST) create_message #

fn (rest &REST) create_message(channel_id Snowflake, params CreateMessageParams) !Message

fn (REST) create_reaction #

fn (rest &REST) create_reaction(channel_id Snowflake, message_id Snowflake, params ReactionParams) !

Create a reaction for the message. This endpoint requires the .read_message_history permission to be present on the current user. Additionally, if nobody else has reacted to the message using this emoji, this endpoint requires the .add_reactions permission to be present on the current user. Fires a Message Reaction Add Gateway event.

fn (REST) create_stage_instance #

fn (rest &REST) create_stage_instance(params CreateStageInstanceParams) !StageInstance

Creates a new Stage instance associated to a Stage channel. Returns that Stage instance. Fires a Stage Instance Create Gateway event. Requires the user to be a moderator of the Stage channel.

fn (REST) create_test_entitlement #

fn (rest &REST) create_test_entitlement(application_id Snowflake, params CreateTestEntitlementParams) !Entitlement

Creates a test entitlement to a given SKU for a given guild or user. Discord will act as though that user or guild has entitlement to your premium offering. After creating a test entitlement, you'll need to reload your Discord client. After doing so, you'll see that your server or user now has premium access.

fn (REST) create_webhook #

fn (rest &REST) create_webhook(channel_id Snowflake, params CreateWebhookParams) !Webhook

Creates a new webhook and returns a webhook object on success. Requires the .manage_webhooks permission. Fires a Webhooks Update Gateway event. An error will be returned if a webhook name (name) is not valid. A webhook name is valid if:- It does not contain the substrings clyde or discord (case-insensitive)

  • It follows the nickname guidelines in the Usernames and Nicknames documentation, with an exception that webhook names can be up to 80 characters

fn (REST) crosspost_message #

fn (rest &REST) crosspost_message(channel_id Snowflake, message_id Snowflake) !Message

Crosspost a message in an Announcement Channel to following channels. This endpoint requires the SEND_MESSAGES permission, if the current user sent the message, or additionally the .manage_messages permission, for all other messages, to be present for the current user. Returns a message object. Fires a Message Update Gateway event.

fn (REST) delete_all_reactions #

fn (rest &REST) delete_all_reactions(channel_id Snowflake, message_id Snowflake) !

Deletes all reactions on a message. This endpoint requires the .manage_messages permission to be present on the current user. Fires a Message Reaction Remove All Gateway event.

fn (REST) delete_all_reactions_for_emoji #

fn (rest &REST) delete_all_reactions_for_emoji(channel_id Snowflake, message_id Snowflake, params ReactionParams) !

Deletes all the reactions for a given emoji on a message. This endpoint requires the .manage_messages permission to be present on the current user. Fires a Message Reaction Remove Emoji Gateway event.

fn (REST) delete_auto_moderation_rule #

fn (rest &REST) delete_auto_moderation_rule(guild_id Snowflake, auto_moderation_rule_id Snowflake, params ReasonParam) !

Delete a rule. Returns a 204 on success. Fires an Auto Moderation Rule Delete Gateway event.

fn (REST) delete_channel #

fn (rest &REST) delete_channel(channel_id Snowflake, params ReasonParam) !Channel

Delete a channel, or close a private message. Requires the MANAGE_CHANNELS permission for the guild, or MANAGE_THREADS if the channel is a thread. Deleting a category does not delete its child channels; they will have their parent_id removed and a Channel Update Gateway event will fire for each of them. Returns a channel object on success. Fires a Channel Delete Gateway event (or Thread Delete if the channel was a thread).

fn (REST) delete_channel_permission #

fn (rest &REST) delete_channel_permission(channel_id Snowflake, overwrite_id Snowflake, params ReasonParam) !

Delete a channel permission overwrite for a user or role in a channel. Only usable for guild channels. Requires the .manage_roles permission. Fires a Channel Update Gateway event. For more information about permissions, see Permissions.

fn (REST) delete_followup_message #

fn (rest &REST) delete_followup_message(application_id Snowflake, interaction_token string, message_id Snowflake) !

Deletes a followup message for an Interaction. Returns 204 No Content on success

fn (REST) delete_global_application_command #

fn (rest &REST) delete_global_application_command(application_id Snowflake, command_id Snowflake) !

Deletes a global command. Returns 204 No Content on success.

fn (REST) delete_guild #

fn (rest &REST) delete_guild(guild_id Snowflake) !

Delete a guild permanently. User must be owner. Fires a Guild Delete Gateway event.

fn (REST) delete_guild_application_command #

fn (rest &REST) delete_guild_application_command(application_id Snowflake, guild_id Snowflake, command_id Snowflake) !

Delete a guild command. Returns 204 No Content on success.

fn (REST) delete_guild_emoji #

fn (rest &REST) delete_guild_emoji(guild_id Snowflake, emoji_id Snowflake, params ReasonParam) !

Delete the given emoji. For emojis created by the current user, requires either the .create_guild_expressions or .manage_guild_expressions permission. For other emojis, requires the .manage_guild_expressions permission. Returns 204 No Content on success. Fires a Guild Emojis Update Gateway event.

fn (REST) delete_guild_integration #

fn (rest &REST) delete_guild_integration(guild_id Snowflake, integration_id Snowflake) !

Delete the attached integration object for the guild. Deletes any associated webhooks and kicks the associated bot if there is one. Requires the .manage_guild permission. Returns a 204 empty response on success. Fires Guild Integrations Update and Integration Delete Gateway events.

fn (REST) delete_guild_role #

fn (rest &REST) delete_guild_role(guild_id Snowflake, role_id Snowflake, params ReasonParam) !

Delete a guild role. Requires the .manage_roles permission. Returns a 204 empty response on success. Fires a Guild Role Delete Gateway event.

fn (REST) delete_guild_scheduled_event #

fn (rest &REST) delete_guild_scheduled_event(guild_id Snowflake, guild_scheduled_event_id Snowflake, params ReasonParam) !

Delete a guild scheduled event. Returns a 204 on success. Fires a Guild Scheduled Event Delete Gateway event.

fn (REST) delete_guild_sticker #

fn (rest &REST) delete_guild_sticker(guild_id Snowflake, sticker_id Snowflake, params ReasonParam) !

Delete the given sticker. For stickers created by the current user, requires either the .create_guild_expressions or .manage_guild_expressions permission. For other stickers, requires the .manage_guild_expressions permission. Returns 204 No Content on success. Fires a Guild Stickers Update Gateway event.

fn (REST) delete_guild_template #

fn (rest &REST) delete_guild_template(guild_id Snowflake, template_code string) !GuildTemplate

Deletes the template. Requires the .manage_guild permission. Returns the deleted guild template object on success.

fn (REST) delete_invite #

fn (rest &REST) delete_invite(code string, params ReasonParam) !Invite

Delete an invite. Requires the .manage_channels permission on the channel this invite belongs to, or .manage_guild to remove any invite across the guild. Returns an Invite object on success. Fires an Invite Delete Gateway event.

fn (REST) delete_message #

fn (rest &REST) delete_message(channel_id Snowflake, message_id Snowflake, params ReasonParam) !

Delete a message. If operating on a guild channel and trying to delete a message that was not sent by the current user, this endpoint requires the .manage_messages permission. Fires a Message Delete Gateway event.

fn (REST) delete_messages #

fn (rest &REST) delete_messages(channel_id Snowflake, message_ids []Snowflake, params ReasonParam) !

Delete multiple messages in a single request. This endpoint can only be used on guild channels and requires the .manage_messages permission. Fires a Message Delete Bulk Gateway event. Any message IDs given that do not exist or are invalid will count towards the minimum and maximum message count (currently 2 and 100 respectively). > ! This endpoint will not delete messages older than 2 weeks, and will fail with a 400 BAD REQUEST if any message provided is older than that or if any duplicate message IDs are provided.

fn (REST) delete_original_interaction_response #

fn (rest &REST) delete_original_interaction_response(application_id Snowflake, interaction_token string) !

Deletes the initial Interaction response. Returns 204 No Content on success.

fn (REST) delete_own_reaction #

fn (rest &REST) delete_own_reaction(channel_id Snowflake, message_id Snowflake, params ReactionParams) !

Delete a reaction the current user has made for the message. Fires a Message Reaction Remove Gateway event.

fn (REST) delete_stage_instance #

fn (rest &REST) delete_stage_instance(channel_id Snowflake, params ReasonParam) !

Deletes the Stage instance. Returns 204 No Content. Fires a Stage Instance Delete Gateway event. Requires the user to be a moderator of the Stage channel.

fn (REST) delete_test_entitlement #

fn (rest &REST) delete_test_entitlement(application_id Snowflake, entitlement_id Snowflake) !

Deletes a currently-active test entitlement. Discord will act as though that user or guild no longer has entitlement to your premium offering.

fn (REST) delete_user_reaction #

fn (rest &REST) delete_user_reaction(channel_id Snowflake, message_id Snowflake, user_id Snowflake, params ReactionParams) !

Deletes another user's reaction. This endpoint requires the .manage_messages permission to be present on the current user. Fires a Message Reaction Remove Gateway event.

fn (REST) delete_webhook #

fn (rest &REST) delete_webhook(webhook_id Snowflake, params ReasonParam) !

Delete a webhook permanently. Requires the .manage_webhooks permission. Returns a 204 No Content response on success. Fires a Webhooks Update Gateway event.

fn (REST) delete_webhook_message #

fn (rest &REST) delete_webhook_message(webhook_id Snowflake, webhook_token string, message_id ?Snowflake, params DeleteWebhookMessageParams) !

Deletes a message that was created by the webhook. Returns a 204 No Content response on success.

fn (REST) delete_webhook_with_token #

fn (rest &REST) delete_webhook_with_token(webhook_id Snowflake, webhook_token string, params ReasonParam) !

Same as static REST.delete_webhook_with_token

fn (REST) edit_application_command_permissions #

fn (rest &REST) edit_application_command_permissions(application_id Snowflake, guild_id Snowflake, command_id Snowflake, params EditApplicationCommandPermissionsParams) !GuildApplicationCommandPermissions

Edits command permissions for a specific command for your application in a guild and returns a guild application command permissions object. Fires an Application Command Permissions Update Gateway event.

You can add up to 100 permission overwrites for a command.

fn (REST) edit_auto_moderation_rule #

fn (rest &REST) edit_auto_moderation_rule(guild_id Snowflake, auto_moderation_rule_id Snowflake, params EditAutoModerationRuleParams) !AutoModerationRule

Modify an existing rule. Returns an auto moderation rule on success. Fires an Auto Moderation Rule Update Gateway event.

fn (REST) edit_channel #

fn (rest &REST) edit_channel(channel_id Snowflake, params EditChannelParams) !Channel

Update a channel's settings. Returns a channel on success, and a 400 BAD REQUEST on invalid parameters. All JSON parameters are optional.

fn (REST) edit_channel_permissions #

fn (rest &REST) edit_channel_permissions(channel_id Snowflake, overwrite_id Snowflake, params EditChannelPermissionsParams) !

Edit the channel permission overwrites for a user or role in a channel. Only usable for guild channels. Requires the .manage_roles permission. Only permissions your bot has in the guild or parent channel (if applicable) can be allowed/denied (unless your bot has a .manage_roles overwrite in the channel). Fires a Channel Update Gateway event. For more information about permissions, see Permissions.

fn (REST) edit_current_user_voice_state #

fn (rest &REST) edit_current_user_voice_state(guild_id Snowflake, params EditCurrentUserVoiceStateParams) !

Updates the current user's voice state. Returns 204 No Content on success. Fires a Voice State Update Gateway event.# CaveatsThere are currently several caveats for this endpoint:- channel_id must currently point to a stage channel.

  • current user must already have joined channel_id.
  • You must have the .mute_members permission to unsuppress yourself. You can always suppress yourself.
  • You must have the .request_to_speak permission to request to speak. You can always clear your own request to speak.
  • You are able to set request_to_speak_timestamp to any present or future time.

fn (REST) edit_followup_message #

fn (rest &REST) edit_followup_message(application_id Snowflake, interaction_token string, message_id Snowflake, params EditWebhookMessageParams) !Message

Edits a followup message for an Interaction. Functions the same as Client.edit_webhook_message.

fn (REST) edit_global_application_command #

fn (rest &REST) edit_global_application_command(application_id Snowflake, command_id Snowflake, params EditApplicationCommandParams) !ApplicationCommand

Edit a global command. Returns application command object. All fields are optional, but any fields provided will entirely overwrite the existing values of those fields.

fn (REST) edit_group_dm_channel #

fn (rest &REST) edit_group_dm_channel(channel_id Snowflake, params EditGroupDMChannelParams) !Channel

Update a group DM channel's settings. Returns a channel on success, and a 400 BAD REQUEST on invalid parameters. All JSON parameters are optional.

fn (REST) edit_guild #

fn (rest &REST) edit_guild(guild_id Snowflake, params EditGuildParams) !Guild

Modify a guild's settings. Requires the .manage_guild permission. Returns the updated guild object on success. Fires a Guild Update Gateway event. > ! Attempting to add or remove the COMMUNITY guild feature requires the ADMINISTRATOR permission.

fn (REST) edit_guild_application_command #

fn (rest &REST) edit_guild_application_command(application_id Snowflake, guild_id Snowflake, command_id Snowflake, params EditApplicationCommandParams) !ApplicationCommand

Edit a guild command. Updates for guild commands will be available immediately. Returns application command object. All fields are optional, but any fields provided will entirely overwrite the existing values of those fields.

fn (REST) edit_guild_channel #

fn (rest &REST) edit_guild_channel(channel_id Snowflake, params EditGuildChannelParams) !Channel

Update a guild channel's settings. Returns a channel on success, and a 400 BAD REQUEST on invalid parameters. All JSON parameters are optional.

fn (REST) edit_guild_channel_positions #

fn (rest &REST) edit_guild_channel_positions(guild_id Snowflake, params []EditGuildChannelPositionsParams) !

Modify the positions of a set of channel objects for the guild. Requires .manage_channels permission. Fires multiple Channel Update Gateway events.

fn (REST) edit_guild_emoji #

fn (rest &REST) edit_guild_emoji(guild_id Snowflake, emoji_id Snowflake, params EditGuildEmojiParams) !Emoji

Modify the given emoji. For emojis created by the current user, requires either the .create_guild_expressions or .manage_guild_expressions permission. For other emojis, requires the .manage_guild_expressions permission. Returns the updated emoji object on success. Fires a Guild Emojis Update Gateway event.

fn (REST) edit_guild_member #

fn (rest &REST) edit_guild_member(guild_id Snowflake, user_id Snowflake, params EditGuildMemberParams) !GuildMember

Modify attributes of a guild member. Returns a 200 OK with the guild member as the body. Fires a Guild Member Update Gateway event. If the channel_id is set to null, this will force the target user to be disconnected from voice.

fn (REST) edit_guild_mfa_level #

fn (rest &REST) edit_guild_mfa_level(guild_id Snowflake, level MFALevel, params ReasonParam) !MFALevel

Modify a guild's MFA level. Requires guild ownership. Returns the updated level on success. Fires a Guild Update Gateway event.

fn (REST) edit_guild_onboarding #

fn (rest &REST) edit_guild_onboarding(guild_id Snowflake, params EditGuildOnboardingParams) !GuildOnboarding

Modifies the onboarding configuration of the guild. Returns a 200 with the Onboarding object for the guild. Requires the .manage_guild and .manage_roles permissions. > i Onboarding enforces constraints when enabled. These constraints are that there must be at least 7 Default Channels and at least 5 of them must allow sending messages to the @everyone role. The mode field modifies what is considered when enforcing these constraints.

fn (REST) edit_guild_role #

fn (rest &REST) edit_guild_role(guild_id Snowflake, role_id Snowflake, params EditGuildRoleParams) !Role

Modify a guild role. Requires the .manage_roles permission. Returns the updated role on success. Fires a Guild Role Update Gateway event.

fn (REST) edit_guild_role_positions #

fn (rest &REST) edit_guild_role_positions(guild_id Snowflake, params []EditGuildRolePositionsParams, params2 ReasonParam) ![]Role

Modify the positions of a set of role objects for the guild. Requires the .manage_roles permission. Returns a list of all of the guild's role objects on success. Fires multiple Guild Role Update Gateway events.

fn (REST) edit_guild_scheduled_event #

fn (rest &REST) edit_guild_scheduled_event(guild_id Snowflake, guild_scheduled_event_id Snowflake, params EditGuildScheduledEventParams) !GuildScheduledEvent

Modify a guild scheduled event. Returns the modified guild scheduled event object on success. Fires a Guild Scheduled Event Update Gateway event. > i To start or end an event, use this function to modify the event's status field. > i This endpoint silently discards entity_metadata for non-.external events.

fn (REST) edit_guild_sticker #

fn (rest &REST) edit_guild_sticker(guild_id Snowflake, sticker_id Snowflake, params EditGuildStickerParams) !Sticker

Modify the given sticker. For stickers created by the current user, requires either the .create_guild_expressions or .manage_guild_expressions permission. For other stickers, requires the .manage_guild_expressions permission. Returns the updated sticker object on success. Fires a Guild Stickers Update Gateway event.

fn (REST) edit_guild_template #

fn (rest &REST) edit_guild_template(guild_id Snowflake, template_code string, params EditGuildTemplateParams) !GuildTemplate

Modifies the template's metadata. Requires the .manage_guild permission. Returns the guild template object on success.

fn (REST) edit_guild_widget_settings #

fn (rest &REST) edit_guild_widget_settings(guild_id Snowflake, params EditGuildWidgetParams) !GuildWidgetSettings

Modify a guild widget settings object for the guild. All attributes may be passed in with JSON and modified. Requires the .manage_guild permission. Returns the updated guild widget settings object. Fires a Guild Update Gateway event.

fn (REST) edit_message #

fn (rest &REST) edit_message(channel_id Snowflake, message_id Snowflake, params EditMessageParams) !Message

Edit a previously sent message. The fields content, embeds, and flags can be edited by the original message author. Other users can only edit flags and only if they have the .manage_messages permission in the corresponding channel. When specifying flags, ensure to include all previously set flags/bits in addition to ones that you are modifying. Only flags documented in the table below may be modified by users (unsupported flag changes are currently ignored without error). When the content field is edited, the mentions array in the message object will be reconstructed from scratch based on the new content. The allowed_mentions field of the edit request controls how this happens. If there is no explicit allowed_mentions in the edit request, the content will be parsed with default allowances, that is, without regard to whether or not an allowed_mentions was present in the request that originally created the message. Returns a message object. Fires a Message Update Gateway event.

fn (REST) edit_my_application #

fn (rest &REST) edit_my_application(params EditApplicationParams) !Application

Edit properties of the app associated with the requesting bot user. Only properties that are passed will be updated. Returns the updated application object on success.

fn (REST) edit_my_guild_member #

fn (rest &REST) edit_my_guild_member(guild_id Snowflake, params EditCurrentMemberParams) !GuildMember

Modifies the current member in a guild. Returns a 200 with the updated member object on success. Fires a Guild Member Update Gateway event.

fn (REST) edit_my_user #

fn (rest &REST) edit_my_user(params EditMyUserParams) !User

Modify the requester's user account settings. Returns a user object on success. Fires a User Update Gateway event.

fn (REST) edit_original_interaction_response #

fn (rest &REST) edit_original_interaction_response(application_id Snowflake, interaction_token string, params EditWebhookMessageParams) !Message

Edits the initial Interaction response. Functions the same as Client.edit_webhook_message.

fn (REST) edit_stage_instance #

fn (rest &REST) edit_stage_instance(channel_id Snowflake, params EditStageInstanceParams) !StageInstance

Updates fields of an existing Stage instance. Returns the updated Stage instance. Fires a Stage Instance Update Gateway event. Requires the user to be a moderator of the Stage channel.

fn (REST) edit_thread_channel #

fn (rest &REST) edit_thread_channel(channel_id Snowflake, params EditThreadChannelParams) !Channel

Update a thread's settings. Returns a channel on success, and a 400 BAD REQUEST on invalid parameters. All JSON parameters are optional.

fn (REST) edit_user_voice_state #

fn (rest &REST) edit_user_voice_state(guild_id Snowflake, user_id Snowflake, params EditUserVoiceStateParams) !

Updates another user's voice state. Fires a Voice State Update Gateway event.# CaveatsThere are currently several caveats for this endpoint:- channel_id must currently point to a stage channel.

  • User must already have joined channel_id.
  • You must have the .mute_members permission. (Since suppression is the only thing that is available currently.)
  • When unsuppressed, non-bot users will have their request_to_speak_timestamp set to the current time. Bot users will not.
  • When suppressed, the user will have their request_to_speak_timestamp removed.

fn (REST) edit_webhook #

fn (rest &REST) edit_webhook(webhook_id Snowflake, params EditWebhookParams) !Webhook

Modify a webhook. Requires the .manage_webhooks permission. Returns the updated webhook object on success. Fires a Webhooks Update Gateway event.

fn (REST) edit_webhook_message #

fn (rest &REST) edit_webhook_message(webhook_id Snowflake, webhook_token string, message_id ?Snowflake, params EditWebhookMessageParams) !Message

Edits a previously-sent webhook message from the same token. Returns a message object on success. When the content field is edited, the mentions array in the message object will be reconstructed from scratch based on the new content. The allowed_mentions field of the edit request controls how this happens. If there is no explicit allowed_mentions in the edit request, the content will be parsed with default allowances, that is, without regard to whether or not an allowed_mentions was present in the request that originally created the message.

fn (REST) edit_webhook_with_token #

fn (rest &REST) edit_webhook_with_token(webhook_id Snowflake, webhook_token string, params EditWebhookParams) !Webhook

Same as static REST.edit_webhook_with_token

fn (REST) execute_webhook #

fn (rest &REST) execute_webhook(webhook_id Snowflake, webhook_token string, params ExecuteWebhookParams) !&Message

Same as static REST.execute_webhook

fn (REST) fetch_application_command_permissions #

fn (rest &REST) fetch_application_command_permissions(application_id Snowflake, guild_id Snowflake, command_id Snowflake) !GuildApplicationCommandPermissions

Fetches permissions for a specific command for your application in a guild. Returns a guild application command permissions object.

fn (REST) fetch_application_role_connection_metadata_records #

fn (rest &REST) fetch_application_role_connection_metadata_records(application_id Snowflake) ![]ApplicationRoleConnectionMetadata

Returns a list of application role connection metadata objects for the given application.

fn (REST) fetch_auto_moderation_rule #

fn (rest &REST) fetch_auto_moderation_rule(guild_id Snowflake, auto_moderation_rule_id Snowflake) !AutoModerationRule

Get a single rule. Returns an auto moderation rule object.

fn (REST) fetch_channel #

fn (rest &REST) fetch_channel(channel_id Snowflake) !Channel

Get a channel by ID. Returns a channel object. If the channel is a thread, a thread member object is included in the returned result.

fn (REST) fetch_channel_webhooks #

fn (rest &REST) fetch_channel_webhooks(channel_id Snowflake) ![]Webhook

Returns a list of channel webhook objects. Requires the .manage_webhooks permission.

fn (REST) fetch_followup_message #

fn (rest &REST) fetch_followup_message(application_id Snowflake, interaction_token string, message_id Snowflake) !Message

Returns a followup message for an Interaction. Functions the same as Client.fetch_webhook_message.

fn (REST) fetch_gateway_configuration #

fn (rest &REST) fetch_gateway_configuration() !GatewayConfiguration

fn (REST) fetch_gateway_url #

fn (rest &REST) fetch_gateway_url() !string

fn (REST) fetch_global_application_command #

fn (rest &REST) fetch_global_application_command(application_id Snowflake, command_id Snowflake) !ApplicationCommand

Fetch a global command for your application. Returns an application command object.

fn (REST) fetch_global_application_commands #

fn (rest &REST) fetch_global_application_commands(application_id Snowflake, params FetchGlobalApplicationCommandsParams) ![]ApplicationCommand

Fetch all of the global commands for your application. Returns an array of application command objects.

fn (REST) fetch_guild #

fn (rest &REST) fetch_guild(guild_id Snowflake) !Guild

fn (REST) fetch_guild_application_command #

fn (rest &REST) fetch_guild_application_command(application_id Snowflake, guild_id Snowflake, command_id Snowflake) !ApplicationCommand

Fetch a guild command for your application. Returns an application command object.

fn (REST) fetch_guild_application_command_permissions #

fn (rest &REST) fetch_guild_application_command_permissions(application_id Snowflake, guild_id Snowflake) ![]GuildApplicationCommandPermissions

Fetches permissions for all commands for your application in a guild. Returns an array of guild application command permissions objects.

fn (REST) fetch_guild_audit_log #

fn (rest &REST) fetch_guild_audit_log(guild_id Snowflake, params FetchGuildAuditLogParams) !AuditLog

Returns an audit log object for the guild. Requires the .view_audit_log permission. The returned list of audit log entries is ordered based on whether you use before or after. When using before, the list is ordered by the audit log entry ID descending (newer entries first). If after is used, the list is reversed and appears in ascending order (older entries first). Omitting both before and after defaults to before the current timestamp and will show the most recent entries in descending order by ID, the opposite can be achieved using after: 0 (showing oldest entries).

fn (REST) fetch_guild_ban #

fn (rest &REST) fetch_guild_ban(guild_id Snowflake, user_id Snowflake) !Ban

Returns a ban object for the given user or a 404 not found if the ban cannot be found. Requires the .ban_members permission.

fn (REST) fetch_guild_bans #

fn (rest &REST) fetch_guild_bans(guild_id Snowflake, params FetchGuildBansParams) ![]Ban

Returns a list of ban objects for the users banned from this guild. Requires the .ban_members permission.

fn (REST) fetch_guild_channels #

fn (rest &REST) fetch_guild_channels(guild_id Snowflake) ![]Channel

Returns a list of guild channel objects. Does not include threads.

fn (REST) fetch_guild_emoji #

fn (rest &REST) fetch_guild_emoji(guild_id Snowflake, emoji_id Snowflake) !Emoji

Returns an emoji object for the given guild and emoji IDs. Includes the user field if the bot has the .manage_guild_expressions permission, or if the bot created the emoji and has the the .create_guild_expressions permission.

fn (REST) fetch_guild_integrations #

fn (rest &REST) fetch_guild_integrations(guild_id Snowflake) ![]Integration

Returns a list of integration objects for the guild. Requires the .manage_guild permission. > i This endpoint returns a maximum of 50 integrations. If a guild has more integrations, they cannot be accessed.

fn (REST) fetch_guild_invites #

fn (rest &REST) fetch_guild_invites(guild_id Snowflake) ![]InviteMetadata

Returns a list of invite objects (with invite metadata) for the guild. Requires the .manage_guild permission.

fn (REST) fetch_guild_member #

fn (rest &REST) fetch_guild_member(guild_id Snowflake, user_id Snowflake) !GuildMember

Returns a guild member object for the specified user.

fn (REST) fetch_guild_members #

fn (rest &REST) fetch_guild_members(guild_id Snowflake, params ListGuildMembersParams) ![]GuildMember

Returns a list of guild member objects that are members of the guild. > ! This endpoint is restricted according to whether the .guild_members Privileged Intent is enabled for your application.

fn (REST) fetch_guild_onboarding #

fn (rest &REST) fetch_guild_onboarding(guild_id Snowflake) !GuildOnboarding

Returns the Onboarding object for the guild.

fn (REST) fetch_guild_preview #

fn (rest &REST) fetch_guild_preview(guild_id Snowflake) !GuildPreview

fn (REST) fetch_guild_prune_count #

fn (rest &REST) fetch_guild_prune_count(guild_id Snowflake, params FetchGuildPruneCountParams) !int

Returns an object with one pruned key indicating the number of members that would be removed in a prune operation. Requires the .kick_members permission. By default, prune will not remove users with roles. You can optionally include specific roles in your prune by providing the include_roles parameter. Any inactive user that has a subset of the provided role(s) will be counted in the prune and users with additional roles will not.

fn (REST) fetch_guild_roles #

fn (rest &REST) fetch_guild_roles(guild_id Snowflake) ![]Role

Returns a list of role objects for the guild.

fn (REST) fetch_guild_scheduled_event #

fn (rest &REST) fetch_guild_scheduled_event(guild_id Snowflake, guild_scheduled_event_id Snowflake, params FetchScheduledEventsParams) !GuildScheduledEvent

Get a guild scheduled event. Returns a guild scheduled event object on success.

fn (REST) fetch_guild_scheduled_event_users #

fn (rest &REST) fetch_guild_scheduled_event_users(guild_id Snowflake, guild_scheduled_event_id Snowflake, params FetchGuildScheduledEventUsersParams) ![]GuildScheduledEventUser

Get a list of guild scheduled event users subscribed to a guild scheduled event. Returns a list of guild scheduled event user objects on success. Guild member data, if it exists, is included if the with_member parameter is set.

fn (REST) fetch_guild_sticker #

fn (rest &REST) fetch_guild_sticker(guild_id Snowflake, sticker_id Snowflake) !Sticker

Returns a sticker object for the given guild and sticker IDs. Includes the user field if the bot has the .create_guild_expressions or .manage_guild_expressions permission.

fn (REST) fetch_guild_template #

fn (rest &REST) fetch_guild_template(template_code string) !GuildTemplate

Returns a guild template object for the given code.

fn (REST) fetch_guild_templates #

fn (rest &REST) fetch_guild_templates(guild_id Snowflake) ![]GuildTemplate

Returns an array of guild template objects. Requires the .manage_guild permission.

fn (REST) fetch_guild_vanity_url #

fn (rest &REST) fetch_guild_vanity_url(guild_id Snowflake) !GuildVanityUrl

Returns a partial invite object for guilds with that feature enabled. Requires the .manage_guild permission. code will be none if a vanity url for the guild is not set.

fn (REST) fetch_guild_voice_regions #

fn (rest &REST) fetch_guild_voice_regions(guild_id Snowflake) ![]VoiceRegion

Returns a list of voice region objects for the guild. Unlike the similar /voice route, this returns VIP servers when the guild is VIP-enabled.

fn (REST) fetch_guild_webhooks #

fn (rest &REST) fetch_guild_webhooks(guild_id Snowflake) ![]Webhook

Returns a list of guild webhook objects. Requires the .manage_webhooks permission.

fn (REST) fetch_guild_welcome_screen #

fn (rest &REST) fetch_guild_welcome_screen(guild_id Snowflake) !WelcomeScreen

Returns the Welcome Screen object for the guild. If the welcome screen is not enabled, the .manage_guild permission is required.

fn (REST) fetch_guild_widget #

fn (rest &REST) fetch_guild_widget(guild_id Snowflake) !GuildWidget

Returns the widget for the guild. Fires an Invite Create Gateway event when an invite channel is defined and a new Invite is generated.

fn (REST) fetch_guild_widget_settings #

fn (rest &REST) fetch_guild_widget_settings(guild_id Snowflake) !GuildWidgetSettings

Returns a guild widget settings object. Requires the .manage_guild permission.

fn (REST) fetch_invite #

fn (rest &REST) fetch_invite(code string, params FetchInviteParams) !Invite

Returns an invite object for the given code.

fn (REST) fetch_invites #

fn (rest &REST) fetch_invites(channel_id Snowflake) ![]InviteMetadata

Returns a list of invite objects (with invite metadata) for the channel. Only usable for guild channels. Requires the .manage_channels permission.

fn (REST) fetch_message #

fn (rest &REST) fetch_message(channel_id Snowflake, message_id Snowflake) !Message

fn (REST) fetch_messages #

fn (rest &REST) fetch_messages(channel_id Snowflake, params GetChannelMessagesParams) ![]Message

fn (REST) fetch_my_application #

fn (rest &REST) fetch_my_application() !Application

Returns the application object associated with the requesting bot user.

fn (REST) fetch_my_application_role_connection #

fn (rest &REST) fetch_my_application_role_connection(application_id Snowflake) !ApplicationRoleConnection

Returns the application role connection for the user. Requires an OAuth2 access token with role_connections.write scope for the application specified in the path.

fn (REST) fetch_my_connections #

fn (rest &REST) fetch_my_connections() ![]Connection

Returns a list of connection objects. Requires the connections OAuth2 scope.

fn (REST) fetch_my_guild_member #

fn (rest &REST) fetch_my_guild_member(guild_id Snowflake) !GuildMember

Returns a guild member object for the current user. Requires the guilds.members.read OAuth2 scope.

fn (REST) fetch_my_guilds #

fn (rest &REST) fetch_my_guilds(params FetchMyGuildsParams) ![]PartialGuild

fn (REST) fetch_my_user #

fn (rest &REST) fetch_my_user() !User

Returns the user object of the requester's account. For OAuth2, this requires the identify scope, which will return the object without an email, and optionally the email scope, which returns the object with an email.

fn (REST) fetch_original_interaction_response #

fn (rest &REST) fetch_original_interaction_response(application_id Snowflake, interaction_token string) !Message

Returns the initial Interaction response. Functions the same as Clientc.fetch_webhook_message.

fn (REST) fetch_pinned_messagse #

fn (rest &REST) fetch_pinned_messagse(channel_id Snowflake) ![]Message

Returns all pinned messages in the channel as an array of message objects.

fn (REST) fetch_reactions #

fn (rest &REST) fetch_reactions(channel_id Snowflake, message_id Snowflake, params FetchReactionsParams) ![]User

Get a list of users that reacted with this emoji. Returns an array of user objects on success.

fn (REST) fetch_stage_instance #

fn (rest &REST) fetch_stage_instance(channel_id Snowflake) !StageInstance

Gets the stage instance associated with the Stage channel, if it exists.

fn (REST) fetch_sticker #

fn (rest &REST) fetch_sticker(sticker_id Snowflake) !Sticker

Returns a sticker object for the given sticker ID.

fn (REST) fetch_thread_member #

fn (rest &REST) fetch_thread_member(channel_id Snowflake, user_id Snowflake, params FetchThreadMemberParams) !ThreadMember

Returns a thread member object for the specified user if they are a member of the thread, returns a 404 response otherwise. When with_member is set to true, the thread member object will include a member field containing a guild member object.

fn (REST) fetch_user #

fn (rest &REST) fetch_user(user_id Snowflake) !User

Returns a user object for a given user ID.

fn (REST) fetch_webhook #

fn (rest &REST) fetch_webhook(webhook_id Snowflake) !Webhook

Returns the new webhook object for the given id.

fn (REST) fetch_webhook_message #

fn (rest &REST) fetch_webhook_message(webhook_id Snowflake, webhook_token string, message_id ?Snowflake, params FetchWebhookMessageParams) !Message

Returns a previously-sent webhook message from the same token. Returns a message object on success.

fn (REST) fetch_webhook_with_token #

fn (rest &REST) fetch_webhook_with_token(webhook_id Snowflake, webhook_token string) !Webhook

Same as above, except this call does not require authentication and returns no user in the webhook object.

fn (REST) follow_announcement_channel #

fn (rest &REST) follow_announcement_channel(channel_id Snowflake, webhook_channel_id Snowflake, params ReasonParam) !FollowedChannel

Follow an Announcement Channel to send messages to a target channel. Requires the .manage_webhooks permission in the target channel. Fires a Webhooks Update Gateway event for the target channel.

fn (REST) group_dm_add_recipient #

fn (rest &REST) group_dm_add_recipient(channel_id Snowflake, user_id Snowflake, params GroupDMAddRecipientParams) !

Adds a recipient to a Group DM using their access token.

fn (REST) group_dm_remove_recipient #

fn (rest &REST) group_dm_remove_recipient(channel_id Snowflake, user_id Snowflake) !

Removes a recipient from a Group DM.

fn (REST) join_thread #

fn (rest &REST) join_thread(channel_id Snowflake) !

Adds the current user to a thread. Also requires the thread is not archived. Fires a Thread Members Update and a Thread Create Gateway event.

fn (REST) leave_guild #

fn (rest &REST) leave_guild(guild_id Snowflake) !

Leave a guild. Fires a Guild Delete Gateway event and a Guild Member Remove Gateway event.

fn (REST) leave_thread #

fn (rest &REST) leave_thread(channel_id Snowflake) !

Removes the current user from a thread. Also requires the thread is not archived. Returns nothing on success. Fires a Thread Members Update Gateway event.

fn (REST) list_active_guild_threads #

fn (rest &REST) list_active_guild_threads(guild_id Snowflake) !ListThreadsResponse

Returns all active threads in the guild, including public and private threads. Threads are ordered by their id, in descending order.

fn (REST) list_auto_moderation_rules_for_guild #

fn (rest &REST) list_auto_moderation_rules_for_guild(guild_id Snowflake) ![]AutoModerationRule

Get a list of all rules currently configured for the guild. Returns a list of auto moderation rule objects for the given guild.

fn (REST) list_entitlements #

fn (rest &REST) list_entitlements(application_id Snowflake, params ListEntitlementParams) ![]Entitlement

Returns all entitlements for a given app, active and expired.

fn (REST) list_guild_emojis #

fn (rest &REST) list_guild_emojis(guild_id Snowflake) ![]Emoji

Returns a list of emoji objects for the given guild. Includes user fields if the bot has the .create_guild_expressions or .manage_guild_expressions permission.

fn (REST) list_guild_stickers #

fn (rest &REST) list_guild_stickers(guild_id Snowflake) ![]Sticker

Returns an array of sticker objects for the given guild. Includes user fields if the bot has the .create_guild_expressions or .manage_guild_expressions permission.

fn (REST) list_joined_private_archived_threads #

fn (rest &REST) list_joined_private_archived_threads(channel_id Snowflake, params ListArchivedThreadsParams) !ListThreadsResponse

Returns archived threads in the channel that are of type .private_threads, and the user has joined. Threads are ordered by their id, in descending order. Requires the .read_message_history permission.

fn (REST) list_private_archived_threads #

fn (rest &REST) list_private_archived_threads(channel_id Snowflake, params ListArchivedThreadsParams) !ListThreadsResponse

Returns archived threads in the channel that are of type .private_thread. Threads are ordered by archive_timestamp, in descending order. Requires both the .read_message_history and .manage_threads permissions.

fn (REST) list_public_archived_threads #

fn (rest &REST) list_public_archived_threads(channel_id Snowflake, params ListArchivedThreadsParams) !ListThreadsResponse

Returns archived threads in the channel that are public. When called on a .guild_text channel, returns threads of type .public_thread. When called on a .guild_announcement channel returns threads of type .announcement_thread. Threads are ordered by archive_timestamp, in descending order. Requires the .read_message_history permission.

fn (REST) list_scheduled_events_for_guild #

fn (rest &REST) list_scheduled_events_for_guild(guild_id Snowflake, params FetchScheduledEventsParams) ![]GuildScheduledEvent

Returns a list of guild scheduled event objects for the given guild.

fn (REST) list_skus #

fn (rest &REST) list_skus(application_id Snowflake) ![]Sku

fn (REST) list_sticker_packs #

fn (rest &REST) list_sticker_packs() ![]StickerPack

Returns a list of available sticker packs.

fn (REST) list_thread_members #

fn (rest &REST) list_thread_members(channel_id Snowflake, params FetchThreadMemberParams) ![]ThreadMember

Returns array of thread members objects that are members of the thread. When with_member is set to true, the results will be paginated and each thread member object will include a member field containing a guild member object.

fn (REST) list_voice_regions #

fn (rest &REST) list_voice_regions() ![]VoiceRegion

Returns an array of voice region objects that can be used when setting a voice or stage channel's rtc_region.

fn (REST) pin_message #

fn (rest &REST) pin_message(channel_id Snowflake, message_id Snowflake, params ReasonParam) !

Pin a message in a channel. Requires the .manage_messages permission. Fires a Channel Pins Update Gateway event.

fn (REST) remove_guild_ban #

fn (rest &REST) remove_guild_ban(guild_id Snowflake, user_id Snowflake, params ReasonParam) !

Remove the ban for a user. Requires the .ban_members permissions. Returns a 204 empty response on success. Fires a Guild Ban Remove Gateway event.

fn (REST) remove_guild_member #

fn (rest &REST) remove_guild_member(guild_id Snowflake, user_id Snowflake, params ReasonParam) !

Remove a member from a guild. Requires .kick_members permission. Returns a 204 empty response on success. Fires a Guild Member Remove Gateway event.

fn (REST) remove_guild_member_role #

fn (rest &REST) remove_guild_member_role(guild_id Snowflake, user_id Snowflake, role_id Snowflake, params ReasonParam) !

Removes a role from a guild member. Requires the .manage_roles permission. Returns a 204 empty response on success. Fires a Guild Member Update Gateway event.

fn (REST) remove_thread_member #

fn (rest &REST) remove_thread_member(channel_id Snowflake, user_id Snowflake) !

Removes another member from a thread. Requires the .manage_threads permission, or the creator of the thread if it is a .private_thread. Also requires the thread is not archived. Returns nothing on success. Fires a Thread Members Update Gateway event.

fn (REST) request #

fn (rest &REST) request(method http.Method, route string, options RequestOptions) !http.Response

fn (REST) start_thread_from_message #

fn (rest &REST) start_thread_from_message(channel_id Snowflake, message_id Snowflake, params StartThreadFromMessageParams) !Channel

Creates a new thread from an existing message. Fires a Thread Create and a Message Update Gateway event. When called on a .guild_text channel, creates a .public_thread. When called on a .guild_announcement channel, creates a .announcement_thread. Does not work on a .guild_forum or a .guild_media channel. The id of the created thread will be the same as the id of the source message, and as such a message can only have a single thread created from it.

fn (REST) start_thread_in_forum_channel #

fn (rest &REST) start_thread_in_forum_channel(channel_id Snowflake, params StartThreadInForumChannelParams) !Channel

Creates a new thread in a forum or a media channel, and sends a message within the created thread. Fires a Thread Create and Message Create Gateway event.- The type of the created thread is .public_thread.

  • See message formatting for more information on how to properly format messages.
  • The current user must have the .send_messages permission (.create_public_threads is ignored).
  • The maximum request size when sending a message is 25 MiB.
  • Note that when sending a message, you must provide a value for at least one of content, embeds, sticker_ids, components, or files[n]`.

! Discord may strip certain characters from message content, like invalid unicode characters or characters which cause unexpected message formatting. If you are passing user-generated strings into message content, consider sanitizing the data to prevent unexpected behavior and using allowed_mentions to prevent unexpected mentions.

fn (REST) start_thread_without_message #

fn (rest &REST) start_thread_without_message(channel_id Snowflake, params StartThreadWithoutMessageParams) !Channel

Creates a new thread that is not connected to an existing message. Fires a Thread Create Gateway event.

fn (REST) sync_guild_template #

fn (rest &REST) sync_guild_template(guild_id Snowflake, template_code string) !GuildTemplate

Syncs the template to the guild's current state. Requires the .manage_guild permission. Returns the guild template object on success.

fn (REST) trigger_typing #

fn (rest &REST) trigger_typing(channel_id Snowflake) !

Post a typing indicator for the specified channel, which expires after 10 seconds. Fires a Typing Start Gateway event. Generally bots should not use this route. However, if a bot is responding to a command and expects the computation to take a few seconds, this endpoint may be called to let the user know that the bot is processing their message.

fn (REST) unpin_message #

fn (rest &REST) unpin_message(channel_id Snowflake, message_id Snowflake, params ReasonParam) !

Unpin a message in a channel. Requires the .manage_messages permission. Fires a Channel Pins Update Gateway event.

fn (REST) update_application_role_connection_metadata_records #

fn (rest &REST) update_application_role_connection_metadata_records(application_id Snowflake) ![]ApplicationRoleConnectionMetadata

Updates and returns a application role connection metadata objects for the given application.

fn (REST) update_my_application_role_connection #

fn (rest &REST) update_my_application_role_connection(application_id Snowflake, params UpdateMyApplicationRoleConnectionParams) !ApplicationRoleConnection

Updates and returns the application role connection for the user. Requires an OAuth2 access token with role_connections.write scope for the application specified in the path.

struct RESTConfig #

@[params]
struct RESTConfig {
pub:
	base_url   string = 'https://discord.com/api/v10'
	http       ?HTTPClient
	user_agent string = discord.default_user_agent
}

struct RPC #

struct RPC {
mut:
	conn io.ReaderWriter
}

fn (RPC) send #

fn (mut rpc RPC) send(op int, data []u8) !

fn (RPC) recv #

fn (mut rpc RPC) recv() !RPCPacket

fn (RPC) get_connection #

fn (rpc RPC) get_connection() io.ReaderWriter

fn (RPC) send_json #

fn (mut rpc RPC) send_json(op int, j json2.Any) !

fn (RPC) recv_json #

fn (mut rpc RPC) recv_json() !RPCJSONPacket

fn (RPC) handshake #

fn (mut rpc RPC) handshake(client_id Snowflake) !

struct RPCJSONPacket #

struct RPCJSONPacket {
pub:
	op   int
	data json2.Any
}

struct RPCPacket #

struct RPCPacket {
pub:
	op   int
	data []u8
}

struct Ratelimit #

struct Ratelimit {
	RestError
	retry_after f32
}

struct Reaction #

struct Reaction {
pub:
	// Total number of times this emoji has been used to react (including super reacts)
	count int
	// Reaction count details object
	count_details ReactionCountDetails
	// Whether the current user reacted using this emoji
	me bool
	// Whether the current user super-reacted using this emoji
	me_burst bool
	// emoji information
	emoji PartialEmoji
	// HEX colors used for super reaction
	burst_colors []int
}

struct ReactionCountDetails #

struct ReactionCountDetails {
pub:
	// Count of super reactions
	burst int
	// Count of normal reactions
	normal int
}

struct ReactionParams #

@[params]
struct ReactionParams {
pub mut:
	id   ?Snowflake
	name string     @[required]
}

fn (ReactionParams) build #

fn (params ReactionParams) build() string

struct ReadyEvent #

struct ReadyEvent {
	BaseEvent
pub:
	// Information about the user including email
	user User
	// Guilds the user is in
	guilds []UnavailableGuild
	// Used for resuming connections
	session_id string
	// Gateway URL for resuming connections
	resume_gateway_url string
	// Contains id and flags
	application PartialApplication
}

struct ReasonParam #

@[params]
struct ReasonParam {
pub:
	reason ?string
}

struct RequestGuildMembersParams #

@[params]
struct RequestGuildMembersParams {
pub:
	// ID of the guild to get members for
	guild_id Snowflake @[required]
	// string that username starts with, or an empty string to return all members
	query ?string
	// maximum number of members to send matching the `query`; a limit of `0` can be used with an empty string `query` to return all members
	limit ?int
	// used to specify if we want the presences of the matched members
	presences ?bool
	// used to specify which users you wish to fetch
	user_ids ?ArrayOrSnowflake
	// nonce to identify the [Guild Members Chunk](#GuildMembersChunkEvent) response
	nonce ?string
}

Used to request all members for a guild or a list of guilds. When initially connecting, if you don't have the GUILD_PRESENCES Gateway Intent, or if the guild is over 75k members, it will only send members who are in voice, plus the member for you (the connecting user). Otherwise, if a guild has over large_threshold members (value in the Gateway Identify), it will only send members who are online, have a role, have a nickname, or are in a voice channel, and if it has under large_threshold members, it will send all members. If a client wishes to receive additional members, they need to explicitly request them via this operation. The server will send Guild Members Chunk events in response with up to 1000 members per chunk until all members that match the request have been sent.

fn (RequestGuildMembersParams) build #

fn (params RequestGuildMembersParams) build() json2.Any

struct RequestOptions #

@[params]
struct RequestOptions {
	authenticate   bool = true
	reason         ?string
	json           ?json2.Any
	body           ?string
	common_headers map[http.CommonHeader]string
	query_params   ?urllib.Values
	headers        map[string]string
}

struct Resolved #

struct Resolved {
pub:
	// the ids and User objects
	users ?map[Snowflake]User
	// the ids and partial Member objects
	members ?map[Snowflake]PartialGuildMember
	// the ids and Role objects
	roles ?map[Snowflake]Role
	// the ids and partial Channel objects
	channels ?map[Snowflake]PartialChannel
	// the ids and partial Message objects
	messages ?map[Snowflake]PartialMessage
	// the ids and attachment objects
	attachments ?map[Snowflake]Attachment
}

struct RestError #

struct RestError {
	Error
	code    int
	errors  map[string]json2.Any
	message string
	status  http.Status
}

fn (RestError) code #

fn (re RestError) code() int

fn (RestError) msg #

fn (re RestError) msg() string

struct ResumedEvent #

struct ResumedEvent {
	BaseEvent
pub:
	// Information about the user including email
	user User
	// Guilds the user is in
	guilds []UnavailableGuild
	// Used for resuming connections
	session_id string
	// Gateway URL for resuming connections
	resume_gateway_url string
	// Contains id and flags
	application PartialApplication
}

struct Role #

struct Role {
pub:
	// role id
	id Snowflake
	// role name
	name string
	// integer representation of hexadecimal color code
	color int
	// if this role is pinned in the user listing
	hoist bool
	// role icon hash
	icon ?string
	// role unicode emoji
	unicode_emoji ?string
	// position of this role
	position int
	// permission bit set
	permissions Permissions
	// whether this role is managed by an integrations
	managed bool
	// whether this role is mentionable
	mentionable bool
	// the tags this role has
	tags ?RoleTags
	// role flags combined as a bitfield
	flags RoleFlags
}

fn (Role) build #

fn (role Role) build() json2.Any

struct RoleSelect #

struct RoleSelect {
pub:
	// ID for the select menu; max 100 characters
	custom_id string @[required]
	// Placeholder text if nothing is selected; max 150 characters
	placeholder ?string
	// List of default values for auto-populated select menu components; number of default values must be in the range defined by `min_values` and `max_values`
	default_values ?[]Snowflake
	// Minimum number of items that must be chosen (defaults to 1); min 0, max 25
	min_values ?int
	// Maximum number of items that can be chosen (defaults to 1); max 25
	max_values ?int
	// Whether select menu is disabled (defaults to `false`)
	disabled ?bool
}

fn (RoleSelect) build #

fn (rs RoleSelect) build() json2.Any

struct RoleSubscriptionData #

struct RoleSubscriptionData {
pub:
	// the id of the [Sku](#Sku) and listing that the user is subscribed to
	role_subscription_listing_id Snowflake
	// the name of the tier that the user is subscribed to
	tier_name string
	// the cumulative number of months that the user has been subscribed for
	total_months_subscribed int
	// whether this notification is for a renewal rather than a new purchase
	is_renewal bool
}

struct RoleTags #

struct RoleTags {
pub:
	// the id of the bot this role belongs to
	bot_id ?Snowflake
	// the id of the integration this role belongs to
	integration_id ?Snowflake
	// whether this is the guild's Booster role
	premium_subscriber bool
	// the id of this role's subscription sku and listing
	subscription_listing_id ?Snowflake
	// whether this role is available for purchase
	available_for_purchase bool
	// whether this role is a guild's linked role
	guild_connections bool
}

struct SelectOption #

struct SelectOption {
pub:
	// User-facing name of the option; max 100 characters
	label string @[required]
	// Dev-defined value of the option; max 100 characters
	value string @[required]
	// Additional description of the option; max 100 characters
	description ?string
	// `id`, `name`, and `animated`
	emoji ?ComponentEmoji
	// Will show this option as selected by default
	default ?bool
}

fn (SelectOption) build #

fn (so SelectOption) build() json2.Any

struct SessionStartLimit #

struct SessionStartLimit {
pub:
	// Total number of session starts the current user is allowed
	total int
	// Remaining number of session starts the current user is allowed
	remaining int
	// Number of milliseconds after which the limit resets
	reset_after time.Duration
	// Number of identify requests allowed per 5 seconds
	max_concurrency int
}

struct ShardInfo #

struct ShardInfo {
pub mut:
	shard_id    int
	shard_count int
}

fn (ShardInfo) build #

fn (si ShardInfo) build() json2.Any

struct Sku #

struct Sku {
pub:
	// ID of SKU
	id Snowflake
	// Type of SKU
	typ SkuType
	// ID of the parent application
	application_id Snowflake
	// Customer-facing name of your premium offering
	name string
	// System-generated URL slug based on the SKU's name
	slug string
	// SKU flags combined as a bitfield
	flags SkuFlags
}

struct StageInstance #

struct StageInstance {
pub:
	// The id of this Stage instance
	id Snowflake
	// The guild id of the associated Stage channel
	guild_id Snowflake
	// The id of the associated Stage channel
	channel_id Snowflake
	// The topic of the Stage instance (1-120 characters)
	topic string
	// The privacy level of the Stage instance
	privacy_level PrivacyLevel
	// The id of the scheduled event for this Stage instance
	guild_scheduled_event_id ?Snowflake
}

A Stage Instance holds information about a live stage.

struct StageInstanceCreateEvent #

struct StageInstanceCreateEvent {
	BaseEvent
pub:
	instance StageInstance
}

struct StageInstanceDeleteEvent #

struct StageInstanceDeleteEvent {
	BaseEvent
pub:
	instance StageInstance
}

struct StageInstanceUpdateEvent #

struct StageInstanceUpdateEvent {
	BaseEvent
pub:
	instance StageInstance
}

struct StartThreadFromMessageParams #

@[params]
struct StartThreadFromMessageParams {
pub mut:
	// 1-100 character channel name
	name string @[required]
	// the thread will stop showing in the channel list after auto_archive_duration minutes of inactivity, can be set to: 60, 1440, 4320, 10080
	auto_archive_duration ?time.Duration
	// amount of seconds a user has to wait before sending another message (0-21600)
	rate_limit_per_user ?time.Duration = discord.sentinel_duration
	reason              ?string
}

fn (StartThreadFromMessageParams) build #

fn (params StartThreadFromMessageParams) build() json2.Any

struct StartThreadInForumChannelParams #

@[params]
struct StartThreadInForumChannelParams {
pub mut:
	// 1-100 character channel name
	name string @[required]
	// duration in minutes to automatically archive the thread after recent activity, can be set to: 60, 1440, 4320, 10080
	auto_archive_duration ?time.Duration
	// amount of seconds a user has to wait before sending another message (0-21600)
	rate_limit_per_user ?time.Duration = discord.sentinel_duration
	// contents of the first message in the forum/media thread
	message ForumThreadMessageParams @[required]
	// the IDs of the set of tags that have been applied to a thread in a `.guild_forum` or a `.guild_media` channel
	applied_tags ?[]Snowflake
	reason       ?string
}

fn (StartThreadInForumChannelParams) build #

fn (params StartThreadInForumChannelParams) build() json2.Any

struct StartThreadWithoutMessageParams #

@[params]
struct StartThreadWithoutMessageParams {
pub mut:
	reason ?string
	// 1-100 character channel name
	name string @[required]
	// the thread will stop showing in the channel list after auto_archive_duration minutes of inactivity, can be set to: 60, 1440, 4320, 10080
	auto_archive_duration ?time.Duration
	// the type of thread to create
	typ ChannelType @[required]
	// whether non-moderators can add other non-moderators to a thread; only available when creating a private thread
	invitable ?bool
	// amount of seconds a user has to wait before sending another message (0-21600)
	rate_limit_per_user ?time.Duration = discord.sentinel_duration
}

fn (StartThreadWithoutMessageParams) build #

fn (params StartThreadWithoutMessageParams) build() json2.Any

struct Sticker #

struct Sticker {
pub:
	id          Snowflake
	pack_id     ?Snowflake
	name        string
	description ?string
	tags        ?string
	typ         StickerType
	format_type StickerFormatType
	available   ?bool
	guild_id    ?Snowflake
	user        ?User
	sort_value  ?int
}

struct StickerItem #

struct StickerItem {
pub:
	// id of the sticker
	id Snowflake
	// name of the sticker
	name string
	// type of sticker format
	format_type StickerFormatType
}

The smallest amount of data required to render a sticker. A partial sticker object.

struct StickerPack #

struct StickerPack {
pub:
	// id of the sticker pack
	id Snowflake
	// the stickers in the pack
	stickers []Sticker
	// name of the sticker pack
	name string
	// id of the pack's SKU
	sku_id Snowflake
	// id of a sticker in the pack which is shown as the pack's icon
	cover_sticker_id ?Snowflake
	// description of the sticker pack
	description string
	// id of the sticker pack's banner image
	banner_asset_id ?Snowflake
}

Represents a pack of standard stickers.

struct StringSelect #

struct StringSelect {
pub:
	// ID for the select menu; max 100 characters
	custom_id string @[required]
	// Specified choices in a select menu (only required and available for string selects (type 3); max 25
	options []SelectOption @[required]
	// Placeholder text if nothing is selected; max 150 characters
	placeholder ?string
	// Minimum number of items that must be chosen (defaults to 1); min 0, max 25
	min_values ?int
	// Maximum number of items that can be chosen (defaults to 1); max 25
	max_values ?int
	// Whether select menu is disabled (defaults to false)
	disabled ?bool
}

fn (StringSelect) build #

fn (ss StringSelect) build() json2.Any

struct Team #

struct Team {
pub:
	// Hash of the image of the team's icon
	icon ?string
	// Unique ID of the team
	id Snowflake
	// Members of the team
	members []TeamMember
	// Name of the team
	name string
	// User ID of the current team owner
	owner_user_id Snowflake
}

struct TeamMember #

struct TeamMember {
pub:
	// User's membership state on the team
	membership_state MembershipState
	// ID of the parent team of which they are a member
	team_id Snowflake
	// Avatar, discriminator, ID, and username of the user
	user PartialUser
	// Role of the team member
	role TeamMemberRole
}

struct TextInput #

struct TextInput {
pub:
	// Developer-defined identifier for the input; max 100 characters
	custom_id string @[required]
	// The Text Input Style
	style TextInputStyle = .short
	// Label for this component; max 45 characters
	label string @[required]
	// Minimum input length for a text input; min 0, max 4000
	min_length ?int
	// Maximum input length for a text input; min 1, max 4000
	max_length ?int
	// Whether this component is required to be filled (defaults to `true`)
	required ?bool
	// Pre-filled value for this component; max 4000 characters
	value ?string
	// Custom placeholder text if the input is empty; max 100 characters
	placeholder ?string
}

Text inputs are an interactive component that render in modals. They can be used to collect short-form or long-form text. When defining a text input component, you can set attributes to customize the behavior and appearance of it. However, not all attributes will be returned in the text input interaction payload.

fn (TextInput) build #

fn (ti TextInput) build() json2.Any

struct ThreadCreateEvent #

struct ThreadCreateEvent {
	BaseEvent
pub:
	thread Channel
}

struct ThreadDeleteEvent #

struct ThreadDeleteEvent {
	BaseEvent
pub:
	thread Channel
}

struct ThreadListSyncEvent #

struct ThreadListSyncEvent {
	BaseEvent
pub:
	// ID of the guild
	guild_id Snowflake
	// Parent channel IDs whose threads are being synced. If omitted, then threads were synced for the entire guild. This array may contain channel_ids that have no active threads as well, so you know to clear that data.
	channel_ids ?[]Snowflake
	// All active threads in the given channels that the current user can access
	threads []Channel
	// All thread member objects from the synced threads for the current user, indicating which threads the current user has been added to
	members []ThreadMember
}

struct ThreadMember #

struct ThreadMember {
pub:
	// ID of the thread
	id ?Snowflake
	// ID of the user
	user_id ?Snowflake
	// Time the user last joined the thread
	join_timestamp time.Time
	// Any user-thread settings, currently only used for notifications
	flags int
	// Additional information about the user
	member ?GuildMember
}

struct ThreadMember2 #

struct ThreadMember2 {
	ThreadMember
pub:
	guild_id Snowflake
}

struct ThreadMemberUpdateEvent #

struct ThreadMemberUpdateEvent {
	BaseEvent
pub:
	member ThreadMember2
}

struct ThreadMetadata #

struct ThreadMetadata {
pub:
	// whether the thread is archived
	archived bool
	// the thread will stop showing in the channel list after auto_archive_duration `minutes` of inactivity, can be set to: 60, 1440, 4320, 10080
	auto_archive_duration time.Duration
	// timestamp when the thread's archive status was last changed, used for calculating recent activity
	archive_timestamp time.Time
	// whether the thread is locked; when a thread is locked, only users with MANAGE_THREADS can unarchive it
	locked bool
	// whether non-moderators can add other non-moderators to a thread; only available on private threads
	invitable ?bool
	// timestamp when the thread was created; only populated for threads created after 2022-01-09
	create_timestamp ?time.Time
}

struct ThreadUpdateEvent #

struct ThreadUpdateEvent {
	BaseEvent
pub:
	thread Channel
}

struct TriggerMetadata #

struct TriggerMetadata {
pub:
	// substrings which will be searched for in content (Maximum of 1000)
	keyword_filter ?[]string
	// regular expression patterns which will be matched against content (Maximum of 10)
	regex_patterns ?[]string
	// the internally pre-defined wordsets which will be searched for in content
	presets ?[]KeywordPresetType
	// substrings which should not trigger the rule (Maximum of 100 or 1000)
	allow_list ?[]string
	// total number of unique role and user mentions allowed per message (Maximum of 50)
	mention_total_limit ?int
	// whether to automatically detect mention raids
	mention_raid_protection_enabled ?bool
}

Additional data used to determine whether a rule should be triggered. Different fields are relevant based on the value of trigger_type.

fn (TriggerMetadata) build #

fn (tm TriggerMetadata) build() json2.Any

struct TypingStartEvent #

struct TypingStartEvent {
	BaseEvent
pub:
	// ID of the channel
	channel_id Snowflake
	// ID of the guild
	guild_id ?Snowflake
	// ID of the user
	user_id Snowflake
	// When the user started typing
	timestamp time.Time
	// Member who started typing if this happened in a guild
	member ?GuildMember
}

struct Unauthorized #

struct Unauthorized {
	RestError
}

struct UnavailableGuild #

struct UnavailableGuild {
pub:
	id          Snowflake
	unavailable bool
}

struct UpdateMessageInteractionResponse #

struct UpdateMessageInteractionResponse {
	MessageResponseData
}

fn (UpdateMessageInteractionResponse) get_files #

fn (r UpdateMessageInteractionResponse) get_files() ?[]File

fn (UpdateMessageInteractionResponse) build #

fn (umir UpdateMessageInteractionResponse) build() json2.Any

struct UpdateMyApplicationRoleConnectionParams #

@[params]
struct UpdateMyApplicationRoleConnectionParams {
pub mut:
	// the vanity name of the platform a bot has connected (max 50 characters)
	platform_name ?string
	// the username on the platform a bot has connected (max 100 characters)
	platform_username ?string
	// object mapping [application role connection metadata](#ApplicationRoleConnectionMetadata) keys to their string-ified value (max 100 characters) for the user on the platform a bot has connected
	metadata ?map[string]string
}

fn (UpdateMyApplicationRoleConnectionParams) build #

fn (params UpdateMyApplicationRoleConnectionParams) build() json2.Any

struct UpdatePresenceParams #

@[params]
struct UpdatePresenceParams {
pub:
	// Unix time (in milliseconds) of when the client went idle, or null if the client is not idle
	since ?time.Time
	// User's activities
	activities []Activity
	// User's new status
	status Status = .online
	// Whether or not the client is afk
	afk bool
}

fn (UpdatePresenceParams) build #

fn (params UpdatePresenceParams) build() json2.Any

struct User #

struct User {
pub:
	// the user's id
	id Snowflake
	// the user's username, not unique across the platform
	username string
	// the user's Discord-tag
	discriminator string
	// the user's display name, if it is set. For bots, this is the application name
	global_name ?string
	// the user's avatar hash
	avatar ?string
	// whether the user belongs to an OAuth2 application
	bot ?bool
	// whether the user is an Official Discord System user (part of the urgent message system)
	system ?bool
	// whether the user has two factor enabled on their account
	mfa_enabled ?bool
	// the user's banner hash
	banner ?string
	// the user's banner color encoded as an integer representation of hexadecimal color code
	accent_color ?int
	// the user's chosen [language option](#Locale)
	locale ?string
	// whether the email on this account has been verified
	verified ?bool
	// the user's email
	email ?string
	// the flags on a user's account
	flags ?UserFlags
	// the type of Nitro subscription on a user's account
	premium_type ?PremiumType
	// the public flags on a user's account
	public_flags ?UserFlags
	// data for the user's avatar decoration
	avatar_decoration_data ?AvatarDecorationData
}

struct UserSelect #

struct UserSelect {
pub:
	// ID for the select menu; max 100 characters
	custom_id string @[required]
	// Placeholder text if nothing is selected; max 150 characters
	placeholder ?string
	// List of default values for auto-populated select menu components; number of default values must be in the range defined by `min_values` and `max_values`
	default_values ?[]Snowflake
	// Minimum number of items that must be chosen (defaults to 1); min 0, max 25
	min_values ?int
	// Maximum number of items that can be chosen (defaults to 1); max 25
	max_values ?int
	// Whether select menu is disabled (defaults to false)
	disabled ?bool
}

fn (UserSelect) build #

fn (us UserSelect) build() json2.Any

struct UserUpdateEvent #

struct UserUpdateEvent {
	BaseEvent
pub:
	user User
}

struct VoiceRegion #

struct VoiceRegion {
pub:
	// unique ID for the region
	id string
	// name of the region
	name string
	// true for a single server that is closest to the current user's client
	optimal bool
	// whether this is a deprecated voice region (avoid switching to these)
	deprecated bool
	// whether this is a custom voice region (used for events/etc)
	custom bool
}

struct VoiceServerUpdateEvent #

struct VoiceServerUpdateEvent {
	BaseEvent
pub:
	// Voice connection token
	token string
	// Guild this voice server update is for
	guild_id Snowflake
	// Voice server host
	endpoint ?string
}

struct VoiceState #

struct VoiceState {
pub:
	// the guild id this voice state is for
	guild_id ?Snowflake
	// the channel id this user is connected to
	channel_id ?Snowflake
	// the user id this voice state is for
	user_id Snowflake
	// the guild member this voice state is for
	member ?GuildMember
	// the session id for this voice state
	session_id string
	// whether this user is deafened by the server
	deaf bool
	// whether this user is muted by the server
	mute bool
	// whether this user is locally deafened
	self_deaf bool
	// whether this user is locally muted
	self_mute bool
	// whether this user is streaming using "Go Live"
	self_stream ?bool
	// whether this user's camera is enabled
	self_video bool
	// whether this user's permission to speak is denied
	suppress bool
	// the time at which the user requested to speak
	request_to_speak_timestamp ?time.Time
}

Used to represent a user's voice connection status.

struct VoiceStateUpdateEvent #

struct VoiceStateUpdateEvent {
	BaseEvent
pub:
	state VoiceState
}

struct VoiceStateUpdateParams #

@[params]
struct VoiceStateUpdateParams {
pub:
	// ID of the guild
	guild_id Snowflake
	// ID of the voice channel client wants to join (null if disconnecting)
	channel_id ?Snowflake
	// Whether the client is muted
	self_mute bool
	// Whether the client deafened
	self_deaf bool
}

fn (VoiceStateUpdateParams) build #

fn (params VoiceStateUpdateParams) build() json2.Any

struct Webhook #

struct Webhook {
pub:
	// the id of the webhook
	id Snowflake
	// the type of the webhook
	typ WebhookType
	// the guild id this webhook is for, if any
	guild_id ?Snowflake
	// the channel id this webhook is for, if any
	channel_id ?Snowflake
	// the user this webhook was created by (not returned when getting a webhook with its token)
	user ?User
	// the default name of the webhook
	name ?string
	// the default user avatar hash of the webhook
	avatar ?string
	// the secure token of the webhook (returned for Incoming Webhooks)
	token ?string
	// the bot/OAuth2 application that created this webhook
	application_id ?Snowflake
	// the guild of the channel that this webhook is following (returned for Channel Follower Webhooks)
	source_guild ?PartialGuild
	// the channel that this webhook is following (returned for Channel Follower Webhooks)
	source_channel ?PartialChannel
	// the url used for executing the webhook (returned by the webhooks OAuth2 flow)
	url ?string
}

fn (Webhook) edit #

fn (webhook &Webhook) edit(params EditWebhookParams) !Webhook

fn (Webhook) delete #

fn (webhook &Webhook) delete(params ReasonParam) !

fn (Webhook) execute #

fn (webhook &Webhook) execute(params ExecuteWebhookParams) !&Message

struct WebhooksUpdateEvent #

struct WebhooksUpdateEvent {
	BaseEvent
pub:
	// ID of the channel
	channel_id Snowflake
	// ID of the guild
	guild_id Snowflake
}

struct WelcomeChannel #

struct WelcomeChannel {
pub:
	// the channel's id
	channel_id Snowflake @[required]
	// the description shown for the channel
	description string @[required]
	// the emoji id, if the emoji is custom
	emoji_id ?Snowflake
	// the emoji name if custom, the unicode character if standard, or `none` if no emoji is set
	emoji_name ?string
}

fn (WelcomeChannel) build #

fn (wc WelcomeChannel) build() json2.Any

struct WelcomeScreen #

struct WelcomeScreen {
pub:
	// the server description shown in the welcome screen
	description ?string
	// the channels shown in the welcome screen, up to 5
	welcome_channels []WelcomeChannel
}