Skip to main content
Module

x/discord_api_types/payloads/v9/guild.ts

Up to date Discord API Typings, versioned by the API version
Go to Latest
File
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904
/** * Types extracted from https://discord.com/developers/docs/resources/guild */
import type { APIEmoji } from './emoji.ts';import type { PresenceUpdateStatus } from './gateway.ts';import type { APIRole } from './permissions.ts';import type { APISticker } from './sticker.ts';import type { APIUser } from './user.ts';import type { Permissions, Snowflake } from '../../globals.ts';
/** * https://discord.com/developers/docs/resources/guild#unavailable-guild-object */export interface APIUnavailableGuild { /** * Guild id */ id: Snowflake; /** * `true` if this guild is unavailable due to an outage */ unavailable: boolean;}
/** * https://discord.com/developers/docs/resources/guild#guild-object-guild-structure */export interface APIPartialGuild extends Omit<APIUnavailableGuild, 'unavailable'>, Pick<APIGuild, 'welcome_screen'> { /** * Guild name (2-100 characters, excluding trailing and leading whitespace) */ name: string; /** * Icon hash * * See https://discord.com/developers/docs/reference#image-formatting */ icon: string | null; /** * Splash hash * * See https://discord.com/developers/docs/reference#image-formatting */ splash: string | null; /** * Banner hash * * See https://discord.com/developers/docs/reference#image-formatting */ banner?: string | null; /** * The description for the guild */ description?: string | null; /** * Enabled guild features * * See https://discord.com/developers/docs/resources/guild#guild-object-guild-features */ features?: GuildFeature[]; /** * Verification level required for the guild * * See https://discord.com/developers/docs/resources/guild#guild-object-verification-level */ verification_level?: GuildVerificationLevel; /** * The vanity url code for the guild */ vanity_url_code?: string | null;}
/** * https://discord.com/developers/docs/resources/guild#guild-object-guild-structure */export interface APIGuild extends APIPartialGuild { /** * Icon hash, returned when in the template object * * See https://discord.com/developers/docs/reference#image-formatting */ icon_hash?: string | null; /** * Discovery splash hash; only present for guilds with the "DISCOVERABLE" feature * * See https://discord.com/developers/docs/reference#image-formatting */ discovery_splash: string | null; /** * `true` if the user is the owner of the guild * * **This field is only received from https://discord.com/developers/docs/resources/user#get-current-user-guilds** */ owner?: boolean; /** * ID of owner */ owner_id: Snowflake; /** * Total permissions for the user in the guild (excludes overrides) * * **This field is only received from https://discord.com/developers/docs/resources/user#get-current-user-guilds** * * See https://en.wikipedia.org/wiki/Bit_field */ permissions?: Permissions; /** * Voice region id for the guild * * See https://discord.com/developers/docs/resources/voice#voice-region-object * @deprecated This field has been deprecated in favor of `rtc_region` on the channel. */ region: string; /** * ID of afk channel */ afk_channel_id: Snowflake | null; /** * afk timeout in seconds */ afk_timeout: number; /** * `true` if the guild widget is enabled */ widget_enabled?: boolean; /** * The channel id that the widget will generate an invite to, or `null` if set to no invite */ widget_channel_id?: Snowflake | null; /** * Verification level required for the guild * * See https://discord.com/developers/docs/resources/guild#guild-object-verification-level */ verification_level: GuildVerificationLevel; /** * Default message notifications level * * See https://discord.com/developers/docs/resources/guild#guild-object-default-message-notification-level */ default_message_notifications: GuildDefaultMessageNotifications; /** * Explicit content filter level * * See https://discord.com/developers/docs/resources/guild#guild-object-explicit-content-filter-level */ explicit_content_filter: GuildExplicitContentFilter; /** * Roles in the guild * * See https://discord.com/developers/docs/topics/permissions#role-object */ roles: APIRole[]; /** * Custom guild emojis * * See https://discord.com/developers/docs/resources/emoji#emoji-object */ emojis: APIEmoji[]; /** * Enabled guild features * * See https://discord.com/developers/docs/resources/guild#guild-object-guild-features */ features: GuildFeature[]; /** * Required MFA level for the guild * * See https://discord.com/developers/docs/resources/guild#guild-object-mfa-level */ mfa_level: GuildMFALevel; /** * Application id of the guild creator if it is bot-created */ application_id: Snowflake | null; /** * The id of the channel where guild notices such as welcome messages and boost events are posted */ system_channel_id: Snowflake | null; /** * System channel flags * * See https://discord.com/developers/docs/resources/guild#guild-object-system-channel-flags */ system_channel_flags: GuildSystemChannelFlags; /** * The id of the channel where Community guilds can display rules and/or guidelines */ rules_channel_id: Snowflake | null; /** * The maximum number of presences for the guild (`null` is always returned, apart from the largest of guilds) */ max_presences?: number | null; /** * The maximum number of members for the guild */ max_members?: number; /** * The vanity url code for the guild */ vanity_url_code: string | null; /** * The description for the guild */ description: string | null; /** * Banner hash * * See https://discord.com/developers/docs/reference#image-formatting */ banner: string | null; /** * Premium tier (Server Boost level) * * See https://discord.com/developers/docs/resources/guild#guild-object-premium-tier */ premium_tier: GuildPremiumTier; /** * The number of boosts this guild currently has */ premium_subscription_count?: number; /** * The preferred locale of a Community guild; used in guild discovery and notices from Discord; defaults to "en-US" * * @default "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 | null; /** * The maximum amount of users in a video channel */ max_video_channel_users?: number; /** * **This field is only received from https://discord.com/developers/docs/resources/guild#get-guild with the `with_counts` query parameter set to `true`** */ approximate_member_count?: number; /** * **This field is only received from https://discord.com/developers/docs/resources/guild#get-guild with the `with_counts` query parameter set to `true`** */ approximate_presence_count?: number; /** * The welcome screen of a Community guild, shown to new members * * Returned in the invite object */ welcome_screen?: APIGuildWelcomeScreen; /** * The nsfw level of the guild * * See https://discord.com/developers/docs/resources/guild#guild-object-guild-nsfw-level */ nsfw_level: GuildNSFWLevel; /** * Custom guild stickers * * See https://discord.com/developers/docs/resources/sticker#sticker-object */ stickers: APISticker[]; /** * Whether the guild has the boost progress bar enabled. */ premium_progress_bar_enabled: boolean; /** * The type of Student Hub the guild is */ hub_type: GuildHubType | null;}
/** * https://discord.com/developers/docs/resources/guild#guild-object-default-message-notification-level */export enum GuildDefaultMessageNotifications { AllMessages, OnlyMentions,}
/** * https://discord.com/developers/docs/resources/guild#guild-object-explicit-content-filter-level */export enum GuildExplicitContentFilter { Disabled, MembersWithoutRoles, AllMembers,}
/** * https://discord.com/developers/docs/resources/guild#guild-object-mfa-level */export enum GuildMFALevel { None, Elevated,}
/** * https://discord.com/developers/docs/resources/guild#guild-object-guild-nsfw-level */export enum GuildNSFWLevel { Default, Explicit, Safe, AgeRestricted,}
/** * https://discord.com/developers/docs/resources/guild#guild-object-verification-level */export enum GuildVerificationLevel { /** * 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 guild for longer than 10 minutes */ High, /** * Must have a verified phone number */ VeryHigh,}
/** * https://discord.com/developers/docs/resources/guild#guild-object-premium-tier */export enum GuildPremiumTier { None, Tier1, Tier2, Tier3,}
export enum GuildHubType { Default, HighSchool, College,}
/** * https://discord.com/developers/docs/resources/guild#guild-object-system-channel-flags */export enum GuildSystemChannelFlags { /** * Suppress member join notifications */ SuppressJoinNotifications = 1 << 0, /** * Suppress server boost notifications */ SuppressPremiumSubscriptions = 1 << 1, /** * Suppress server setup tips */ SuppressGuildReminderNotifications = 1 << 2, /** * Hide member join sticker reply buttons */ SuppressJoinNotificationReplies = 1 << 3,}
/** * https://discord.com/developers/docs/resources/guild#guild-object-guild-features */export enum GuildFeature { /** * Guild has access to set an animated guild banner image */ AnimatedBanner = 'ANIMATED_BANNER', /** * Guild has access to set an animated guild icon */ AnimatedIcon = 'ANIMATED_ICON', /** * Guild has access to set a guild banner image */ Banner = 'BANNER', /** * Guild can enable welcome screen, Membership Screening and discovery, and receives community updates */ Community = 'COMMUNITY', /** * Guild is able to be discovered in the directory */ Discoverable = 'DISCOVERABLE', /** * Guild is able to be featured in the directory */ Featurable = 'FEATURABLE', /** * Guild is listed in a directory channel */ HasDirectoryEntry = 'HAS_DIRECTORY_ENTRY', /** * Guild is a Student Hub * * See https://support.discord.com/hc/en-us/articles/4406046651927-Discord-Student-Hubs-FAQ * * @unstable This feature is currently not documented by Discord, but has known value */ Hub = 'HUB', /** * Guild has access to set an invite splash background */ InviteSplash = 'INVITE_SPLASH', /** * Guild is in a Student Hub * * See https://support.discord.com/hc/en-us/articles/4406046651927-Discord-Student-Hubs-FAQ * * @unstable This feature is currently not documented by Discord, but has known value */ LinkedToHub = 'LINKED_TO_HUB', /** * Guild has enabled Membership Screening */ MemberVerificationGateEnabled = 'MEMBER_VERIFICATION_GATE_ENABLED', /** * Guild has enabled monetization */ MonetizationEnabled = 'MONETIZATION_ENABLED', /** * Guild has increased custom sticker slots */ MoreStickers = 'MORE_STICKERS', /** * Guild has access to create news channels */ News = 'NEWS', /** * Guild is partnered */ Partnered = 'PARTNERED', /** * Guild can be previewed before joining via Membership Screening or the directory */ PreviewEnabled = 'PREVIEW_ENABLED', /** * Guild has access to create private threads */ PrivateThreads = 'PRIVATE_THREADS', RelayEnabled = 'RELAY_ENABLED', /** * Guild is able to set role icons */ RoleIcons = 'ROLE_ICONS', /** * Guild has enabled ticketed events */ TicketedEventsEnabled = 'TICKETED_EVENTS_ENABLED', /** * Guild has access to set a vanity URL */ VanityURL = 'VANITY_URL', /** * Guild is verified */ Verified = 'VERIFIED', /** * Guild has access to set 384kbps bitrate in voice (previously VIP voice servers) */ VIPRegions = 'VIP_REGIONS', /** * Guild has enabled the welcome screen */ WelcomeScreenEnabled = 'WELCOME_SCREEN_ENABLED',}
/** * https://discord.com/developers/docs/resources/guild#guild-preview-object */export interface APIGuildPreview { /** * Guild id */ id: Snowflake; /** * Guild name (2-100 characters) */ name: string; /** * Icon hash * * See https://discord.com/developers/docs/reference#image-formatting */ icon: string | null; /** * Splash hash * * See https://discord.com/developers/docs/reference#image-formatting */ splash: string | null; /** * Discovery splash hash; only present for guilds with the "DISCOVERABLE" feature * * See https://discord.com/developers/docs/reference#image-formatting */ discovery_splash: string | null; /** * Custom guild emojis * * See https://discord.com/developers/docs/resources/emoji#emoji-object */ emojis: APIEmoji[]; /** * Enabled guild features * * See https://discord.com/developers/docs/resources/guild#guild-object-guild-features */ features: GuildFeature[]; /** * Approximate number of members in this guild */ approximate_member_count: number; /** * Approximate number of online members in this guild */ approximate_presence_count: number; /** * The description for the guild */ description: string; /** * Custom guild stickers */ stickers: APISticker[];}
/** * https://discord.com/developers/docs/resources/guild#guild-widget-object */export interface APIGuildWidgetSettings { /** * Whether the widget is enabled */ enabled: boolean; /** * The widget channel id */ channel_id: Snowflake | null;}
/** * https://discord.com/developers/docs/resources/guild#guild-member-object */export interface APIGuildMember { /** * The user this guild member represents * * **This field won't be included in the member object attached to `MESSAGE_CREATE` and `MESSAGE_UPDATE` gateway events.** * * See https://discord.com/developers/docs/resources/user#user-object */ user?: APIUser; /** * This users guild nickname */ nick?: string | null; /** * The member's guild avatar hash */ avatar?: string | null; /** * Array of role object ids * * See https://discord.com/developers/docs/topics/permissions#role-object */ roles: Snowflake[]; /** * When the user joined the guild */ joined_at: string; /** * When the user started boosting the guild * * See https://support.discord.com/hc/en-us/articles/360028038352-Server-Boosting- */ premium_since?: string | null; /** * Whether the user is deafened in voice channels */ deaf: boolean; /** * Whether the user is muted in voice channels */ mute: boolean; /** * Whether the user has not yet passed the guild's Membership Screening requirements * * *If this field is not present, it can be assumed as `false`.* */ pending?: boolean; /** * Timestamp of when the time out will be removed; until then, they cannot interact with the guild */ communication_disabled_until?: string | null;}
/** * https://discord.com/developers/docs/resources/guild#integration-object */export interface APIGuildIntegration { /** * Integration id */ id: Snowflake; /** * Integration name */ name: string; /** * Integration type */ type: APIGuildIntegrationType; /** * Is this integration enabled */ enabled?: boolean; /** * Is this integration syncing * * **This field is not provided for `discord` bot integrations.** */ syncing?: boolean; /** * ID that this integration uses for "subscribers" * * **This field is not provided for `discord` bot integrations.** */ role_id?: Snowflake; /** * Whether emoticons should be synced for this integration (`twitch` only currently) * * **This field is not provided for `discord` bot integrations.** */ enable_emoticons?: boolean; /** * The behavior of expiring subscribers * * **This field is not provided for `discord` bot integrations.** * * See https://discord.com/developers/docs/resources/guild#integration-object-integration-expire-behaviors */ expire_behavior?: IntegrationExpireBehavior; /** * The grace period (in days) before expiring subscribers * * **This field is not provided for `discord` bot integrations.** */ expire_grace_period?: number; /** * User for this integration * * **This field is not provided for `discord` bot integrations.** * * See https://discord.com/developers/docs/resources/user#user-object */ user?: APIUser; /** * Integration account information * * See https://discord.com/developers/docs/resources/guild#integration-account-object */ account: APIIntegrationAccount; /** * When this integration was last synced * * **This field is not provided for `discord` bot integrations.** */ synced_at?: string; /** * How many subscribers this integration has * * **This field is not provided for `discord` bot integrations.** */ subscriber_count?: number; /** * Has this integration been revoked * * **This field is not provided for `discord` bot integrations.** */ revoked?: boolean; /** * The bot/OAuth2 application for discord integrations * * See https://discord.com/developers/docs/resources/guild#integration-application-object * * **This field is not provided for `discord` bot integrations.** */ application?: APIGuildIntegrationApplication;}
export type APIGuildIntegrationType = 'twitch' | 'youtube' | 'discord';
/** * https://discord.com/developers/docs/resources/guild#integration-object-integration-expire-behaviors */export enum IntegrationExpireBehavior { RemoveRole, Kick,}
/** * https://discord.com/developers/docs/resources/guild#integration-account-object */export interface APIIntegrationAccount { /** * ID of the account */ id: string; /** * Name of the account */ name: string;}
/** * https://discord.com/developers/docs/resources/guild#integration-application-object */export interface APIGuildIntegrationApplication { /** * The id of the app */ id: Snowflake; /** * The name of the app */ name: string; /** * The icon hash of the app * * See https://discord.com/developers/docs/reference#image-formatting */ icon: string | null; /** * The description of the app */ description: string; /** * The bot associated with this application * * See https://discord.com/developers/docs/resources/user#user-object */ bot?: APIUser;}
/** * https://discord.com/developers/docs/resources/guild#ban-object */export interface APIBan { /** * The reason for the ban */ reason: string | null; /** * The banned user */ user: APIUser;}
/** * https://discord.com/developers/docs/resources/guild#guild-widget-object */export interface APIGuildWidget { id: Snowflake; name: string; instant_invite: string | null; channels: APIGuildWidgetChannel[]; members: APIGuildWidgetMember[]; presence_count: number;}
/** * https://discord.com/developers/docs/resources/guild#guild-widget-object-example-guild-widget */export interface APIGuildWidgetChannel { id: Snowflake; name: string; position: number;}
/** * https://discord.com/developers/docs/resources/guild#guild-widget-object-example-guild-widget */export interface APIGuildWidgetMember { id: string; username: string; discriminator: string; avatar: string | null; status: PresenceUpdateStatus; activity?: { name: string }; avatar_url: string;}
/** * https://discord.com/developers/docs/resources/guild#get-guild-widget-image-widget-style-options */export enum GuildWidgetStyle { /** * Shield style widget with Discord icon and guild members online count */ Shield = 'shield', /** * Large image with guild icon, name and online count. "POWERED BY DISCORD" as the footer of the widget */ Banner1 = 'banner1', /** * Smaller widget style with guild icon, name and online count. Split on the right with Discord logo */ Banner2 = 'banner2', /** * Large image with guild icon, name and online count. In the footer, Discord logo on the left and "Chat Now" on the right */ Banner3 = 'banner3', /** * Large Discord logo at the top of the widget. Guild icon, name and online count in the middle portion of the widget * and a "JOIN MY SERVER" button at the bottom */ Banner4 = 'banner4',}
export interface APIGuildWelcomeScreen { /** * The welcome screen short message */ description: string | null; /** * Array of suggested channels */ welcome_channels: APIGuildWelcomeScreenChannel[];}
export interface APIGuildWelcomeScreenChannel { /** * The channel id that is suggested */ channel_id: Snowflake; /** * The description shown for the channel */ description: string; /** * The emoji id of the emoji that is shown on the left of the channel */ emoji_id: Snowflake | null; /** * The emoji name of the emoji that is shown on the left of the channel */ emoji_name: string | null;}
export interface APIGuildMembershipScreening { /** * When the fields were last updated */ version: string; /** * The steps in the screening form */ form_fields: APIGuildMembershipScreeningField[]; /** * The server description shown in the screening form */ description: string | null;}
// TODO: make this a union based on the type in the future, when new types are added
export interface APIGuildMembershipScreeningField { /** * The type of field */ field_type: MembershipScreeningFieldType; /** * The title of the field */ label: string; /** * The list of rules */ values?: string[]; /** * Whether the user has to fill out this field */ required: boolean;}
export enum MembershipScreeningFieldType { /** * Server Rules */ Terms = 'TERMS',}