This contains every single discord objects All Optional fields in these object are:
- Fields that cannot be assumed. such as bools
- Optional fields for example embeds, which they may not be present.
Some may not be optional, but they can be assumable or always present.
Types
Activity = object name*: string kind*: ActivityType flags*: set[ActivityFlags] url*, application_id*, details*, state*: Option[string] created_at*: BiggestFloat timestamps*: Option[tuple[start, final: BiggestFloat]] emoji*: Option[Emoji] party*: Option[tuple[id: string, size: seq[int]]] ## todo assets*: Option[ActivityAssets] secrets*: Option[tuple[join, spectate, match: string]] buttons*: seq[tuple[label, url: string]] instance*: bool
- Source Edit
ActivityAssets = object small_text*, small_image*: string large_text*, large_image*: string
- Read more at: https://discord.com/developers/docs/topics/gateway-events#activity-object-activity-asset-image Source Edit
ActivityStatus = object name*: string kind*: ActivityType url*: Option[string]
- This is used for status updates. Source Edit
AllowedMentions = object parse*, roles*, users*: seq[string] replied_user*: bool
- An object of allowed mentions. For parse: The values should be "roles", "users", "everyone" Source Edit
Application = object id*, description*, name*: string summary*, verify_key*: string rpc_origins*, tags*: seq[string] approximate_guild_count*: Option[int] bot_public*, bot_require_code_grant*: bool terms_of_service_url*, privacy_policy_url*: Option[string] guild_id*, custom_install_url*: Option[string] icon*, primary_sku_id*, slug*, cover_image*: Option[string] role_connections_verification_url*: Option[string] owner*: User guild*: PartialGuild team*: Option[Team] flags*: set[ApplicationFlags] install_params*: tuple[scopes: seq[string], permissions: string]
- Source Edit
ApplicationCommand = object id*, application_id*, version*: string guild_id*: Option[string] kind*: ApplicationCommandType name*, description*: string name_localizations*: Option[Table[string, string]] description_localizations*: Option[Table[string, string]] default_member_permissions*: Option[set[PermissionFlags]] default_permission*, nsfw*, dm_permission*: Option[bool] options*: seq[ApplicationCommandOption]
- Source Edit
ApplicationCommandInteractionData = ref object case interaction_type*: InteractionDataType of idtApplicationCommand: id*, name*: string guild_id*: Option[string] resolved*: ApplicationCommandResolution case kind*: ApplicationCommandType of atSlash: options*: Table[string, ApplicationCommandInteractionDataOption] of atUser, atMessage: target_id*: string of atNothing: nil of idtMessageComponent, idtModalSubmit: case component_type*: MessageComponentType of SelectMenu, UserSelect, RoleSelect, MentionableSelect, ChannelSelect: values*: seq[string] else: nil custom_id*: string components*: seq[MessageComponent] else: nil
- options Tableoption_name, obj Source Edit
ApplicationCommandInteractionDataOption = object name*: string case kind*: ApplicationCommandOptionType of acotNothing: nil of acotBool: bval*: bool of acotInt: ival*: BiggestInt of acotStr: str*: string of acotUser: user_id*: string of acotChannel: channel_id*: string of acotRole: role_id*: string of acotSubCommand, acotSubCommandGroup: options*: Table[string, ApplicationCommandInteractionDataOption] of acotNumber: fval*: BiggestFloat of acotMentionable: mention_id*: string of acotAttachment: aval*: string focused*: Option[bool] ## Will be true if this is the value the user is typing during auto complete
- Source Edit
ApplicationCommandOption = object kind*: ApplicationCommandOptionType name*, description*: string name_localizations*: Option[Table[string, string]] description_localizations*: Option[Table[string, string]] required*, autocomplete*: Option[bool] channel_types*: seq[ChannelType] min_value*, max_value*: (Option[BiggestInt], Option[float]) min_length*, max_length*: Option[int] choices*: seq[ApplicationCommandOptionChoice] options*: seq[ApplicationCommandOption]
- Source Edit
ApplicationCommandOptionChoice = object name*: string name_localizations*: Option[Table[string, string]] value*: (Option[string], Option[int])
- Source Edit
ApplicationCommandPermission = object id*: string ## ID of role or user kind*: ApplicationCommandPermissionType permission*: bool ## true to allow, false to disallow
- Source Edit
ApplicationCommandResolution = object users*: Table[string, User] attachments*: Table[string, Attachment] case kind*: ApplicationCommandType of atUser: members*: Table[string, Member] roles*: Table[string, Role] of atMessage: channels*: Table[string, ResolvedChannel] messages*: Table[string, Message] else: nil
- Source Edit
ApplicationRoleConnection = object platform_name*, platform_username*: Option[string] metadata*: Table[string, string]
- Source Edit
ApplicationRoleConnectionMetadata = object kind*: RoleConnectionMetadataType key*, name*, description*: string name_localizations*: Option[Table[string, string]] description_localizations*: Option[Table[string, string]]
- Source Edit
Attachment = object id*, filename*: string description*, content_type*, waveform*: Option[string] proxy_url*, url*: string file*: string height*, width*: Option[int] ephemeral*: Option[bool] size*: int
- file is used for sending/editing attachments. file is like body in DiscordFile, but for attachments. Source Edit
AuditLog = object webhooks*: seq[Webhook] users*: seq[User] application_commands*: seq[ApplicationCommand] audit_log_entries*: seq[AuditLogEntry] integrations*: seq[Integration] threads*: seq[GuildChannel] guild_scheduled_events*: seq[GuildScheduledEvent] auto_moderation_rules*: seq[AutoModerationRule]
- Source Edit
AuditLogChangeValue = object case kind*: AuditLogChangeType of alcString: str*: string of alcInt: ival*: int of alcBool: bval*: bool of alcRoles: roles*: seq[tuple[id, name: string]] of alcOverwrites: overwrites*: seq[Overwrite] of alcNil: nil
- Source Edit
AuditLogEntry = ref object id*: string user_id*, target_id*, reason*: Option[string] before*, after*: Table[string, AuditLogChangeValue] opts*: Option[AuditLogOptions] action_type*: AuditLogEntryType
- Source Edit
AuditLogOptions = object auto_moderation_rule_name*: Option[string] auto_moderation_rule_trigger_type*: Option[string] delete_member_days*, members_removed*: Option[string] channel_id*, count*, role_name*: Option[string] id*, message_id*, application_id*: Option[string] kind*: Option[string]
-
- kind ("role" or "member") or (0 or 1)
AutoModerationRule = object id*, guild_id*, name*, creator_id*: string event_type*: int trigger_type*: ModerationTriggerType trigger_metadata*: TriggerMetadata actions*: seq[ModerationAction] enabled*: bool exempt_roles*, exempt_channels*: seq[string]
- trigger_metadata info: https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-metadata event_type: https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-event-types presets: https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-keyword-preset-types Source Edit
CacheError = object of KeyError
- Source Edit
CacheTable = ref object preferences*: CacheTablePrefs users*: Table[string, User] guilds*: Table[string, Guild] guildChannels*: Table[string, GuildChannel] dmChannels*: Table[string, DMChannel]
- Source Edit
CacheTablePrefs = object cache_users*, cache_guilds*: bool cache_guild_channels*, cache_dm_channels*: bool large_message_threshold*, max_message_size*: int
- Source Edit
DefaultForumReaction = object emoji_id*, emoji_name*: Option[string]
- Source Edit
DiscordClient = ref object api*: RestApi events*: Events token*: string shards*: Table[int, Shard] waits*: WaitTable restMode*, autoreconnect*, guildSubscriptions*: bool largeThreshold*, gatewayVersion*, maxShards*: int intents*: set[GatewayIntent]
- Source Edit
DiscordFile = ref object name*, body*: string
- A Discord file. Source Edit
DiscordHttpError = ref object of CatchableError code*: int message*: string errors*: JsonNode
-
- code the status code e.g. 400 for a bad request.
- message the message field from the json e.g. "You are being rate-limited"
Note: if you want exception msg, it's DiscordHttpError.msg
Source Edit DMChannel = ref object id*, last_message_id*: string kind*: ChannelType recipients*: seq[User] messages*: Table[string, Message]
- Source Edit
Embed = object title*, `type`*, description*: Option[string] url*, timestamp*: Option[string] color*: Option[int] footer*: Option[EmbedFooter] image*: Option[EmbedImage] thumbnail*: Option[EmbedThumbnail] video*: Option[EmbedVideo] provider*: Option[EmbedProvider] author*: Option[EmbedAuthor] fields*: Option[seq[EmbedField]]
- Source Edit
EmbedAuthor = object name*: string url*: Option[string] icon_url*, proxy_icon_url*: Option[string]
- Source Edit
EmbedField = object name*, value*: string inline*: Option[bool]
- Source Edit
EmbedImage = object url*: string proxy_url*: Option[string] height*, width*: Option[int]
- Source Edit
EmbedProvider = object name*, url*: Option[string]
- Source Edit
EmbedThumbnail = object url*: string proxy_url*: Option[string] height*, width*: Option[int]
- Source Edit
EmbedVideo = object url*, proxy_url*: Option[string] height*, width*: Option[int]
- Source Edit
Emoji = object id*, name*: Option[string] require_colons*, animated*: Option[bool] managed*, available*: Option[bool] user*: Option[User] roles*: seq[string]
- Source Edit
EntityMetadata = object location*: Option[string]
- Source Edit
Events = ref object on_dispatch*: proc (s: Shard; evt: string; data: JsonNode) {.async.} on_ready*: proc (s: Shard; r: Ready) {.async.} on_disconnect*: proc (s: Shard) {.async.} message_create*: proc (s: Shard; msg: Message) {.async.} message_delete*: proc (s: Shard; msg: Message; exists: bool) {.async.} message_update*: proc (s: Shard; msg: Message; old: Option[Message]; exists: bool) {.async.} message_reaction_add*: proc (s: Shard; msg: Message; u: User; emj: Emoji; exists: bool) {.async.} message_reaction_remove*: proc (s: Shard; msg: Message; u: User; rtn: Reaction; exists: bool) {.async.} message_reaction_remove_all*: proc (s: Shard; msg: Message; exists: bool) {. async.} message_reaction_remove_emoji*: proc (s: Shard; msg: Message; emj: Emoji; exists: bool) {.async.} message_delete_bulk*: proc (s: Shard; m: seq[tuple[msg: Message, exists: bool]]) {.async.} channel_create*: proc (s: Shard; g: Option[Guild]; c: Option[GuildChannel]; dm: Option[DMChannel]) {.async.} channel_update*: proc (s: Shard; g: Guild; c: GuildChannel; old: Option[GuildChannel]) {.async.} channel_delete*: proc (s: Shard; g: Option[Guild]; c: Option[GuildChannel]; dm: Option[DMChannel]) {.async.} channel_pins_update*: proc (s: Shard; chan_id: string; g: Option[Guild]; last_pin: Option[string]) {.async.} presence_update*: proc (s: Shard; p: Presence; old: Option[Presence]) {.async.} typing_start*: proc (s: Shard; evt: TypingStart) {.async.} guild_emojis_update*: proc (s: Shard; g: Guild; emojis: seq[Emoji]) {.async.} guild_ban_add*, guild_ban_remove*: proc (s: Shard; g: Guild; u: User) {.async.} guild_audit_log_entry_create*: proc (s: Shard; g: Guild; entry: AuditLogEntry) {. async.} guild_integrations_update*: proc (s: Shard; g: Guild) {.async.} guild_member_add*, guild_member_remove*: proc (s: Shard; g: Guild; m: Member) {. async.} guild_member_update*: proc (s: Shard; g: Guild; m: Member; old: Option[Member]) {. async.} guild_update*: proc (s: Shard; g: Guild; old: Option[Guild]) {.async.} guild_create*, guild_delete*: proc (s: Shard; g: Guild) {.async.} guild_members_chunk*: proc (s: Shard; g: Guild; m: GuildMembersChunk) {.async.} guild_role_create*, guild_role_delete*: proc (s: Shard; g: Guild; r: Role) {. async.} guild_role_update*: proc (s: Shard; g: Guild; r: Role; old: Option[Role]) {. async.} invite_create*: proc (s: Shard; i: InviteCreate) {.async.} invite_delete*: proc (s: Shard; g: Option[Guild]; chan_id, code: string) {. async.} user_update*: proc (s: Shard; u: User) {.async.} voice_state_update*: proc (s: Shard; v: VoiceState; old: Option[VoiceState]) {. async.} voice_server_update*: proc (s: Shard; g: Guild; token: string; endpoint: Option[string]; initial: bool) {.async.} webhooks_update*: proc (s: Shard; g: Guild; c: GuildChannel) {.async.} interaction_create*: proc (s: Shard; i: Interaction) {.async.} application_command_create*, application_command_update*: proc (s: Shard; g: Option[Guild]; a: ApplicationCommand) {.async.} application_command_delete*: proc (s: Shard; g: Option[Guild]; a: ApplicationCommand) {.async.} thread_create*: proc (s: Shard; g: Guild; c: GuildChannel) {.async.} thread_update*: proc (s: Shard; g: Guild; c: GuildChannel; old: Option[GuildChannel]) {.async.} thread_delete*: proc (s: Shard; g: Guild; c: GuildChannel; exists: bool) {. async.} thread_list_sync*: proc (s: Shard; e: ThreadListSync) {.async.} thread_member_update*: proc (s: Shard; g: Guild; t: ThreadMember) {.async.} thread_members_update*: proc (s: Shard; e: ThreadMembersUpdate) {.async.} stage_instance_create*: proc (s: Shard; g: Guild; i: StageInstance) {.async.} stage_instance_update*: proc (s: Shard; g: Guild; si: StageInstance; old: Option[StageInstance]) {.async.} stage_instance_delete*: proc (s: Shard; g: Guild; si: StageInstance; exists: bool) {.async.} guild_stickers_update*: proc (s: Shard; g: Guild; stickers: seq[Sticker]) {. async.} guild_scheduled_event_create*, guild_scheduled_event_delete*: proc (s: Shard; g: Guild; evt: GuildScheduledEvent) {.async.} guild_scheduled_event_update*: proc (s: Shard; g: Guild; evt: GuildScheduledEvent; old: Option[GuildScheduledEvent]) {.async.} guild_scheduled_event_user_add*, guild_scheduled_event_user_remove*: proc ( s: Shard; g: Guild; evt: GuildScheduledEvent; u: User) {.async.} auto_moderation_rule_create*, auto_moderation_rule_update*: proc (s: Shard; g: Guild; r: AutoModerationRule) {.async.} auto_moderation_rule_delete*: proc (s: Shard; g: Guild; r: AutoModerationRule) {. async.} auto_moderation_action_execution*: proc (s: Shard; g: Guild; e: ModerationActionExecution) {.async.}
-
An object containing events that can be changed.
- exists Checks message is cached or not. Other cachable objects dont have them.
- on_dispatch event gives you the raw event data for you to handle things.
GatewayBot = object url*: string shards*: int session_start_limit*: GatewaySession
- Source Edit
GatewaySession = object total*, remaining*: int reset_after*, max_concurrency*: int
- Source Edit
Guild = ref object id*, name*, owner_id*: string preferred_locale*: string rtc_region*, permissions_new*: Option[string] icon_hash*, description*, banner*: Option[string] public_updates_channel_id*, rules_channel_id*: Option[string] icon*, splash*, discovery_splash*: Option[string] afk_channel_id*, vanity_url_code*, application_id*: Option[string] widget_channel_id*, system_channel_id*, joined_at*: Option[string] safety_alerts_channel_id*: Option[string] system_channel_flags*: set[SystemChannelFlags] permissions*: set[PermissionFlags] premium_progress_bar_enabled*, nsfw*, owner*, widget_enabled*: bool large*, unavailable*: Option[bool] max_stage_video_channel_uses*: Option[int] max_video_channel_uses*, afk_timeout*, member_count*: Option[int] approximate_member_count*, approximate_presence_count*: Option[int] max_presences*, max_members*, premium_subscription_count*: Option[int] explicit_content_filter*: ExplicitContentFilter welcome_screen*: Option[tuple[description: Option[string], welcome_channels: seq[WelcomeChannel]]] mfa_level*: MFALevel nsfw_level*: GuildNSFWLevel premium_tier*: PremiumTier verification_level*: VerificationLevel default_message_notifications*: MessageNotificationLevel features*: seq[string] roles*: Table[string, Role] emojis*: Table[string, Emoji] voice_states*: Table[string, VoiceState] members*: Table[string, Member] threads*, channels*: Table[string, GuildChannel] presences*: Table[string, Presence] stage_instances*: Table[string, StageInstance] stickers*: Table[string, Sticker] guild_scheduled_events*: Table[string, GuildScheduledEvent]
- Source Edit
GuildApplicationCommandPermissions = object id*, application_id*, guild_id*: string permissions*: seq[ApplicationCommandPermission]
- Source Edit
GuildChannel = ref object id*, name*, guild_id*: string nsfw*: bool topic*, parent_id*, owner_id*: Option[string] last_pin_timestamp*: Option[string] permission_overwrites*: Table[string, Overwrite] position*: Option[int] default_auto_archive_duration*: Option[int] rate_limit_per_user*: Option[int] permissions*: set[PermissionFlags] messages*: Table[string, Message] last_message_id*: string case kind*: ChannelType of ctGuildVoice, ctGuildStageVoice: rtc_region*: Option[string] video_quality_mode*: Option[int] bitrate*, user_limit*: int of ctGuildPublicThread, ctGuildPrivateThread, ctGuildNewsThread: message_count*, member_count*: Option[int] total_message_sent*: Option[int] thread_metadata*: ThreadMetadata member*: Option[ThreadMember] flags*: set[ChannelFlags] applied_tags*: Option[seq[string]] of ctGuildForum, ctGuildMedia: available_tags*: seq[ForumTag] default_reaction_emoji*: Option[DefaultForumReaction] default_thread_rate_limit_per_user*: Option[int] default_sort_order*: Option[ForumSortOrder] default_forum_layout*: Option[ForumLayout] else: nil
- Source Edit
GuildMembersChunk = object guild_id*: string nonce*: Option[string] chunk_index*, chunk_count*: int members*: seq[Member] not_found*: seq[string] presences*: seq[Presence]
- Source Edit
GuildOnboarding = object guild_id*: string prompts*: seq[GuildOnboardingPrompt] default_channel_ids*: seq[string] enabled*: bool mode*: GuildOnboardingMode
- Source Edit
GuildOnboardingPrompt = object id*, title*: string kind*: GuildOnboardingPromptType options*: seq[GuildOnboardingPromptOption] single_select*, required*, in_onboarding*: bool
- Source Edit
GuildOnboardingPromptOption = object id*, title*: string description*: Option[string] channel_ids*, role_ids*: seq[string] emoji*: Emoji
- Source Edit
GuildPreview = object id*, name*: string system_channel_flags*: set[SystemChannelFlags] icon*, banner*, splash*, emojis*: Option[string] preferred_locale*, discovery_splash*, description*: Option[string] approximate_member_count*, approximate_presence_count*: int features*: seq[string]
- Source Edit
GuildScheduledEvent = ref object id*, guild_id*, name*, scheduled_start_time*: string channel_id*, creator_id*, scheduled_end_time*: Option[string] description*, entity_id*, image*: Option[string] privacy_level*: GuildScheduledEventPrivacyLevel status*: GuildScheduledEventStatus entity_type*: EntityType entity_metadata*: Option[EntityMetadata] creator*: Option[User] user_count*: Option[int]
- Source Edit
GuildScheduledEventUser = object guild_scheduled_event_id*: string user*: User member*: Option[Member]
- Source Edit
GuildTemplate = object code*, name*, creator_id*: string description*: Option[string] usage_count*: int creator*: User source_guild_id*, updated_at*, created_at*: string serialized_source_guild*: PartialGuild is_dirty*: Option[bool]
- Source Edit
GuildWidgetJson = object id*, name*: string instant_invite*: string channels*: seq[tuple[id, name: string, position: int]] members*: seq[tuple[id, username, discriminator: string, avatar: Option[string], status, avatar_url: string]]
- Source Edit
Integration = object id*, name*, kind*: string role_id*, synced_at*: Option[string] enabled*, syncing*: Option[bool] enable_emoticons*, revoked*: Option[bool] expire_behavior*: Option[IntegrationExpireBehavior] expire_grace_period*: Option[int] user*: Option[User] account*: tuple[id, name: string] subscriber_count*: Option[int] application*: Option[tuple[id, name, description: string, icon: Option[string], bot: Option[User]]]
- Source Edit
Interaction = object id*, application_id*: string guild_id*, channel_id*, locale*, guild_locale*: Option[string] kind*: InteractionType message*: Option[Message] member*: Option[Member] user*: Option[User] app_permissions*: set[PermissionFlags] token*: string data*: Option[ApplicationCommandInteractionData] version*: int
-
if member is present, then that means the interaction is in guild, and user is therefore not present.
if user is present and member isn't, then that means that the interaction is in a DM.
Source Edit InteractionApplicationCommandCallbackData = object tts*: Option[bool] content*: string embeds*: seq[Embed] allowed_mentions*: AllowedMentions flags*: set[MessageFlags] attachments*: seq[Attachment] components*: seq[MessageComponent]
- if you are setting message flags, there are limited amount. e.g. mfEphemeral and mfSuppressEmbeds. Source Edit
InteractionCallbackDataAutocomplete = object choices*: seq[ApplicationCommandOptionChoice]
- Source Edit
InteractionCallbackDataModal = object custom_id*, title*: string components*: seq[MessageComponent]
- Source Edit
InteractionResponse = object case kind*: InteractionResponseType of irtPong, irtChannelMessageWithSource, irtDeferredChannelMessageWithSource, irtDeferredUpdateMessage, irtUpdateMessage: data*: Option[InteractionApplicationCommandCallbackData] of irtAutoCompleteResult: choices*: seq[ApplicationCommandOptionChoice] of irtInvalid: nil of irtModal: custom_id*, title*: string components*: seq[MessageComponent]
- Source Edit
Invite = object code*: string guild*: Option[PartialGuild] channel*: Option[PartialChannel] target_type*: Option[InviteTargetType] target_user*, inviter*: Option[User] target_application*: Option[Application] approximate_presence_count*, approximate_member_count*: Option[int] expires_at*: Option[string] guild_scheduled_event*: Option[GuildScheduledEvent]
- Source Edit
InviteCreate = object code*, created_at*: string guild_id*: Option[string] uses*, max_uses*, max_age*: int channel_id*: string inviter*, target_user*: Option[User] target_type*: Option[InviteTargetType] target_application*: Option[Application] temporary*: bool
- Source Edit
InviteMetadata = object code*, created_at*: string guild_id*: Option[string] uses*, max_uses*, max_age*: int temporary*: bool
- Source Edit
Member = ref object user*: User nick*, premium_since*, avatar*: Option[string] communication_disabled_until*: Option[string] joined_at*: string roles*: seq[string] deaf*, mute*: bool pending*: Option[bool] flags*: set[GuildMemberFlags] permissions*: set[PermissionFlags] presence*: Presence voice_state*: Option[VoiceState]
-
- permissions Returned in the interaction object.
Be aware that Member.user could be nil in some cases.
Source Edit MentionChannel = object id*, guild_id*, name*: string kind*: ChannelType
- Source Edit
Message = ref object id*, channel_id*: string content*, timestamp*: string edited_timestamp*, guild_id*: Option[string] webhook_id*, nonce*, application_id*: Option[string] tts*, mention_everyone*, pinned*: bool kind*: MessageType flags*: set[MessageFlags] position*: Option[int] author*: User member*: Option[Member] mention_users*: seq[User] mention_roles*: seq[string] mention_channels*: seq[MentionChannel] attachments*: seq[Attachment] embeds*: seq[Embed] reactions*: Table[string, Reaction] activity*: Option[tuple[kind: int, party_id: string]] thread*: Option[GuildChannel] application*: Option[Application] interaction*: Option[MessageInteraction] role_subscription_data*: Option[RoleSubscriptionData] message_reference*: Option[MessageReference] sticker_items*: Table[string, tuple[id, name: string, format_type: MessageStickerFormat]] referenced_message*: Option[Message]
-
- sticker_items == Tablesticker_id, object
- reactions == Table"REACTION_EMOJI", object
MessageComponent = object custom_id*: Option[string] disabled*: Option[bool] placeholder*: Option[string] case kind*: MessageComponentType of None: nil of ActionRow: components*: seq[MessageComponent] of Button: style*: ButtonStyle label*: Option[string] emoji*: Option[Emoji] url*: Option[string] of SelectMenu, UserSelect, RoleSelect, MentionableSelect, ChannelSelect: options*: seq[SelectMenuOption] channel_types*: seq[ChannelType] min_values*, max_values*: Option[int] of TextInput: input_style*: Option[TextInputStyle] input_label*, value*: Option[string] required*: Option[bool] min_length*, max_length*: Option[int]
- Source Edit
MessageInteraction = object id*, name*: string kind*: InteractionType user*: User member*: Option[Member]
- Source Edit
MessageReference = object channel_id*: Option[string] message_id*, guild_id*: Option[string] fail_if_not_exists*: Option[bool]
- Source Edit
ModerationAction = object kind*: ModerationActionType metadata*: tuple[channel_id: string, duration_seconds: int, custom_message: Option[string]]
- Source Edit
ModerationActionExecution = object guild_id*, rule_id*, user_id*, content*: string channel_id*, message_id*, alert_system_message_id*: Option[string] matched_keyword*, matched_content*: Option[string] action*: ModerationAction rule_trigger_type*: ModerationTriggerType
- Source Edit
Overwrite = object id*: string kind*: int allow*, deny*: set[PermissionFlags]
-
- kind will be either ("role" or "member") or ("0" or "1")
PartialChannel = object id*, name*: string kind*: ChannelType
- Source Edit
PartialGuild = object id*, name*: string icon*, splash*: Option[string]
- Source Edit
PartialUser = object id*, username*, discriminator*: string avatar*: Option[string] public_flags*: set[UserFlags] bot*: bool
- Source Edit
PermObj = object allowed*, denied*: set[PermissionFlags]
- Source Edit
Presence = ref object user*: User guild_id*, status*: string activities*: seq[Activity] client_status*: tuple[web, desktop, mobile: string]
- Source Edit
Ready = object v*: int user*: User guilds*: seq[UnavailableGuild] resume_gateway_url*, session_id*: string shard*: Option[seq[int]] application*: tuple[id: string, flags: set[ApplicationFlags]]
- Source Edit
ResolvedChannel = object id*, name*: string kind*: ChannelType permissions*: set[PermissionFlags] thread_metadata*: Option[ThreadMetadata] parent_id*: Option[string]
- thread_metadata and parent_id are for Threads. Source Edit
RestApi = ref object token*: string endpoints*: Table[string, Ratelimit] restVersion*: int
- Source Edit
Role = object id*, name*, permissions_new*: string icon*, unicode_emoji*: Option[string] color*, position*: int permissions*: set[PermissionFlags] hoist*, managed*, mentionable*: bool tags*: Option[RoleTag] flags*: set[RoleFlags]
- Source Edit
RoleSubscriptionData = object tier_name*, role_susbcription_listing_id*: string total_months_subscribed*: int is_renewal*: bool
- Source Edit
RoleTag = object bot_id*, integration_id*: Option[string] subscription_listing_id*: Option[string] premium_subscriber*: Option[bool] available_for_purchase*, guild_connections*: Option[bool]
- Source Edit
SelectMenuOption = object label*: string value*: string description*: Option[string] emoji*: Option[Emoji] default*: Option[bool]
- Source Edit
Shard = ref object id*, sequence*: int client*: DiscordClient user*: User resumeGatewayUrl*: string gatewayUrl*, session_id*: string cache*: CacheTable voiceConnections*: Table[string, VoiceClient] connection*: WebSocket hbAck*, hbSent*, stop*: bool lastHBTransmit*, lastHBReceived*: float retry_info*: tuple[ms, attempts: int] heartbeating*, resuming*, reconnecting*: bool authenticating*, networkError*, ready*: bool interval*: int
-
This is where you interact with the gateway api with. It's basically a gateway connection.
For voiceConnections, the string is a guild_id.
Source Edit StageInstance = object id*, guild_id*: string channel_id*, topic*: string privacy_level*: PrivacyLevel discoverable_disabled*: bool guild_scheduled_event_id*: Option[string]
- Source Edit
Sticker = object id*: string name*, tags*: string guild_id*, description*: Option[string] pack_id*: Option[string] format_type*: MessageStickerFormat kind*: StickerType sort_value*: Option[int] available*: Option[bool] user*: Option[User]
- Source Edit
StickerPack = object id*, name*, description*: string stickers*: seq[Sticker] sku_id*, banner_asset_id*: string cover_sticker_id*: Option[string]
- Source Edit
Team = object icon*: Option[string] name*: string id*, owner_user_id*: string members*: seq[TeamMember]
- Source Edit
TeamMember = object membership_state*: TeamMembershipState permissions*: seq[string] ## always would be @["*"] team_id*: string user*: User
- Source Edit
ThreadListSync = object id*, guild_id*: string channel_ids*: seq[string] threads*: seq[GuildChannel] members*: seq[ThreadMember]
- Source Edit
ThreadMember = object id*, user_id*: Option[string] join_timestamp*: string flags*: int
-
- id The thread id the member is in.
ThreadMembersUpdate = object id*, guild_id*: string member_count*: int added_members*: seq[ThreadMember] removed_member_ids*: seq[string]
- Source Edit
ThreadMetadata = object archived*, locked*: bool archiver_id*, create_timestamp*: Option[string] auto_archive_duration*: int archive_timestamp*: string invitable*: Option[bool]
- Source Edit
TriggerMetadata = object keyword_filter*, regex_patterns*, allow_list*: seq[string] presets*: seq[KeywordPresetType] mention_total_limit*: int mention_raid_protection_enabled*: bool
- Source Edit
TypingStart = object channel_id*, user_id*: string guild_id*: Option[string] member*: Option[Member] timestamp*: int
- Source Edit
User = ref object id*, username*, discriminator*: string global_name*, display_name*: Option[string] banner*, banner_color*: Option[string] bot*, system*: bool mfa_enabled*: Option[bool] accent_color*: Option[int] premium_type*: Option[UserPremiumType] flags*: set[UserFlags] public_flags*: set[UserFlags] avatar*, avatar_decoration*, locale*: Option[string]
- The fields for bot and system are false by default simply because they are assumable. Source Edit
VoiceClient = ref object shard*: Shard voice_events*: VoiceEvents endpoint*, token*, secret_key*: string session_id*, guild_id*, channel_id*: string connection*: WebSocket udp*: AsyncSocket lastHBTransmit*, lastHBReceived*: float retry_info*: tuple[ms, attempts: int] hbAck*, hbSent*, stop*: bool gateway_ready*: bool heartbeating*, resuming*, reconnecting*: bool networkError*, ready*, migrate*: bool paused*, stopped*, reconnectable*: bool speaking*, offset_override*: bool adjust_range*: HSlice[float64, float64] adjust_offset*: float64 start*, sleep_offset*: float64 interval*, loops*, sent*: int sequence*, time*, ssrc*: uint32 data*: string srcIP*, dstIP*: string srcPort*, dstPort*: int case encryptMode*: VoiceEncryptionMode of Lite: nonce*: uint32 else: nil
-
Representing VoiceClient object You can also change the values of the fields
For example: v.sleep_offset = 0.96 But this may cause some effects.
Source Edit VoiceEncryptionMode = enum Normal = "xsalsa20_poly1305", Suffix = "xsalsa20_poly1305_suffix", Lite = "xsalsa20_poly1305_lite"
- Source Edit
VoiceEvents = ref object on_dispatch*: proc (v: VoiceClient; d: JsonNode; event: string) {.async.} on_speaking*: proc (v: VoiceClient; speaking: bool) {.async.} on_ready*, on_disconnect*: proc (v: VoiceClient) {.async.}
- Source Edit
VoiceRegion = object id*, name*: string vip*, optimal*: bool deprecated*, custom*: bool
- Source Edit
VoiceState = ref object guild_id*, channel_id*: Option[string] user_id*, session_id*: string deaf*, mute*, suppress*: bool self_deaf*, self_mute*, self_stream*: bool request_to_speak_timestamp*: Option[string]
- Source Edit
Webhook = object id*: string kind*: WebhookType guild_id*, channel_id*, avatar*: Option[string] name*, token*, url*: Option[string] source_guild*: Option[PartialGuild] source_channel*: Option[PartialChannel] user*: Option[User]
- Source Edit
WelcomeChannel = object channel_id*, description*: string emoji_id*, emoji_name*: Option[string]
- Source Edit
Procs
proc `%`(permission: ApplicationCommandPermission): JsonNode {....raises: [], tags: [], forbids: [].}
- Source Edit
proc `%%*`(a: ApplicationCommand): JsonNode {....raises: [Exception], tags: [RootEffect], forbids: [].}
- Source Edit
proc `%%*`(a: ApplicationCommandOption): JsonNode {....raises: [Exception], tags: [RootEffect], forbids: [].}
- Source Edit
proc `%%*`(comp: MessageComponent): JsonNode {....raises: [KeyError], tags: [], forbids: [].}
- Source Edit
proc clear(c: CacheTable) {....raises: [], tags: [], forbids: [].}
- Empties cache. Source Edit
proc getCurrentDiscordHttpError(): DiscordHttpError {....raises: [], tags: [], forbids: [].}
- Use this proc instead of getCurrentException() for advanced details. Source Edit
proc kind(c: CacheTable; channel_id: string): ChannelType {. ...raises: [KeyError, CacheError], tags: [], forbids: [].}
- Checks for a channel kind. (Shortcut) Source Edit
proc newActivity(data: JsonNode): Activity {....raises: [JsonError, ValueError], tags: [], forbids: [].}
- Source Edit
proc newApplication(data: JsonNode): Application {. ...raises: [JsonError, ValueError], tags: [], forbids: [].}
- Source Edit
proc newApplicationCommand(data: JsonNode): ApplicationCommand {. ...raises: [JsonError, ValueError, Exception], tags: [RootEffect], forbids: [].}
- Source Edit
proc newApplicationCommandInteractionData(data: JsonNode): ApplicationCommandInteractionData {. ...raises: [JsonError, ValueError, KeyError, Exception], tags: [RootEffect], forbids: [].}
- Source Edit
proc newApplicationCommandOption(data: JsonNode): ApplicationCommandOption {. ...raises: [JsonError, ValueError, Exception], tags: [RootEffect], forbids: [].}
- Source Edit
proc newApplicationCommandPermission(data: JsonNode): ApplicationCommandPermission {. ...raises: [JsonError, ValueError], tags: [], forbids: [].}
- Source Edit
proc newAuditLog(data: JsonNode): AuditLog {. ...raises: [JsonError, ValueError, Exception, KeyError], tags: [RootEffect], forbids: [].}
- Source Edit
proc newAuditLogEntry(data: JsonNode): AuditLogEntry {. ...raises: [JsonError, ValueError, KeyError], tags: [], forbids: [].}
- Source Edit
proc newDiscordClient(token: string; rest_mode = false; restVersion = 10): DiscordClient {. ...raises: [], tags: [], forbids: [].}
- Creates a Discord Client. Source Edit
proc newDMChannel(data: JsonNode): DMChannel {. ...raises: [JsonError, ValueError, Exception], tags: [RootEffect], forbids: [].}
- Source Edit
proc newGuildApplicationCommandPermissions(data: JsonNode): GuildApplicationCommandPermissions {. ...raises: [JsonError, ValueError], tags: [], forbids: [].}
- Source Edit
proc newGuildBan(data: JsonNode): GuildBan {....raises: [JsonError, ValueError], tags: [], forbids: [].}
- Source Edit
proc newGuildChannel(data: JsonNode): GuildChannel {. ...raises: [JsonError, ValueError, Exception], tags: [RootEffect], forbids: [].}
- Source Edit
proc newGuildMembersChunk(data: JsonNode): GuildMembersChunk {. ...raises: [JsonError, ValueError], tags: [], forbids: [].}
- Source Edit
proc newGuildPreview(data: JsonNode): GuildPreview {. ...raises: [JsonError, ValueError], tags: [], forbids: [].}
- Source Edit
proc newGuildTemplate(data: JsonNode): GuildTemplate {. ...raises: [JsonError, ValueError], tags: [], forbids: [].}
- Source Edit
proc newIntegration(data: JsonNode): Integration {. ...raises: [JsonError, ValueError], tags: [], forbids: [].}
- Source Edit
proc newInteraction(data: JsonNode): Interaction {. ...raises: [JsonError, ValueError, Exception, KeyError], tags: [RootEffect], forbids: [].}
- Source Edit
proc newInteractionData(content: string; embeds: seq[Embed]; flags: set[MessageFlags]; attachments: seq[Attachment]; components: seq[MessageComponent]; allowed_mentions: AllowedMentions; tts: Option[bool]): InteractionCallbackDataMessage {. ...raises: [], tags: [], forbids: [].}
- Source Edit
proc newInviteCreate(data: JsonNode): InviteCreate {. ...raises: [JsonError, ValueError], tags: [], forbids: [].}
- Source Edit
proc newInviteMetadata(data: JsonNode): InviteMetadata {. ...raises: [JsonError, ValueError], tags: [], forbids: [].}
- Source Edit
proc newMessage(data: JsonNode): Message {. ...raises: [JsonError, ValueError, Exception], tags: [RootEffect], forbids: [].}
- Source Edit
proc newOverwrite(data: JsonNode): Overwrite {....raises: [JsonError, ValueError], tags: [], forbids: [].}
- Source Edit
proc newPresence(data: JsonNode): Presence {....raises: [JsonError, ValueError], tags: [], forbids: [].}
- Source Edit
proc newReaction(data: JsonNode): Reaction {....raises: [JsonError, ValueError], tags: [], forbids: [].}
- Source Edit
proc newShard(id: int; client: DiscordClient): Shard {....raises: [], tags: [], forbids: [].}
- Source Edit
proc newStageInstance(data: JsonNode): StageInstance {. ...raises: [JsonError, ValueError], tags: [], forbids: [].}
- Source Edit
proc newSticker(data: JsonNode): Sticker {....raises: [JsonError, ValueError], tags: [], forbids: [].}
- Source Edit
proc newStickerPack(data: JsonNode): StickerPack {. ...raises: [JsonError, ValueError], tags: [], forbids: [].}
- Source Edit
proc newTypingStart(data: JsonNode): TypingStart {. ...raises: [JsonError, ValueError], tags: [], forbids: [].}
- Source Edit
proc newVoiceState(data: JsonNode): VoiceState {. ...raises: [JsonError, ValueError], tags: [], forbids: [].}
- Source Edit
proc newWebhook(data: JsonNode): Webhook {....raises: [JsonError, ValueError], tags: [], forbids: [].}
- Source Edit
proc parseHook(s: string; i: var int; v: var set[GuildMemberFlags]) {. ...raises: [ValueError, JsonError], tags: [], forbids: [].}
- Source Edit
proc parseHook(s: string; i: var int; v: var set[PermissionFlags]) {. ...raises: [ValueError], tags: [], forbids: [].}
- Source Edit
proc updateMessage(m: Message; data: JsonNode): Message {. ...raises: [JsonError, ValueError, Exception, KeyError], tags: [RootEffect], forbids: [].}
- Source Edit
Macros
macro getClient(): DiscordClient
-
Fetch a registered DiscordClient that would be used as the main variable for helper functions.
- You must use mainClient before using this macro!
macro keyCheckBool(obj: typed; obj2: typed; lits: varargs[untyped]): untyped
- Source Edit
macro keyCheckOptBool(obj: typed; obj2: typed; lits: varargs[untyped]): untyped
- Source Edit
macro keyCheckOptInt(obj: typed; obj2: typed; lits: varargs[untyped]): untyped
- Source Edit
macro keyCheckOptStr(obj: typed; obj2: typed; lits: varargs[untyped]): untyped
- Source Edit
macro keyCheckStr(obj: typed; obj2: typed; lits: varargs[untyped]): untyped
- Source Edit
macro mainClient(x: typed): untyped
-
Register a DiscordClient
- Use this variable to use the helper functions. Can be set only once.
# Register the client when declaring it let discord* {.mainClient.} = newDiscordClient("YOUR_TOKEN") # Now you can use the helper functions
Source Edit