From 93b5b0670cbbcd818f867ef594f3b53dcc0f60b0 Mon Sep 17 00:00:00 2001 From: Helloyunho Date: Tue, 27 Aug 2024 20:29:16 +0900 Subject: [PATCH] =?UTF-8?q?=E2=9A=97=EF=B8=8F=20chore:=20sorry=20but=20ser?= =?UTF-8?q?iously=20i=20forgor=20what=20i=20was=20doing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- core/src/rest/http_client.ts | 4 +- framework/src/cache/manager.ts | 8 + framework/src/managers/guildChannels.ts | 2 +- framework/src/managers/guildMembers.ts | 0 framework/src/managers/messages.ts | 87 ++++++++ framework/src/structures/channels/channel.ts | 4 - .../src/structures/channels/groupDMChannel.ts | 3 + .../src/structures/channels/guildChannel.ts | 7 + .../structures/channels/guildForumChannel.ts | 3 + .../structures/channels/guildThreadChannel.ts | 0 framework/src/structures/guilds/member.ts | 62 ++++++ framework/test/client.test.ts | 33 +++ framework/test/client.ts | 37 ++++ framework/test/deps.ts | 1 + types/src/applications/application.ts | 56 ++--- .../applications/roleConnectionMetadata.ts | 6 +- types/src/auditLogs/log.ts | 54 ++--- types/src/autoMod/autoMod.ts | 46 ++--- types/src/channels/base.ts | 11 +- types/src/channels/dm.ts | 10 +- types/src/channels/embed.ts | 40 ++-- types/src/channels/etc.ts | 4 +- types/src/channels/guild.ts | 77 +++---- types/src/channels/message.ts | 122 +++++------ types/src/channels/thread.ts | 58 +++--- types/src/emojis/emoij.ts | 16 +- types/src/entitlements/entitlements.ts | 24 +-- types/src/etc/locales.ts | 20 +- types/src/etc/scopes.ts | 2 +- types/src/gateways/activity.ts | 32 +-- types/src/gateways/gateway.ts | 192 +++++++++--------- types/src/gateways/guild.ts | 24 +-- types/src/gateways/integration.ts | 4 +- types/src/gateways/invite.ts | 4 +- types/src/gateways/message.ts | 12 +- types/src/gateways/thread.ts | 10 +- types/src/guildTemplates/template.ts | 22 +- types/src/guilds/ban.ts | 8 +- types/src/guilds/etc.ts | 44 ++-- types/src/guilds/guild.ts | 170 ++++++++-------- types/src/guilds/integration.ts | 28 +-- types/src/guilds/member.ts | 40 ++-- types/src/guilds/onboarding.ts | 22 +- types/src/guilds/role.ts | 32 +-- types/src/interactions/command.ts | 134 ++++++------ types/src/interactions/components.ts | 46 ++--- types/src/interactions/interaction.ts | 62 +++--- types/src/invites/invite.ts | 22 +- types/src/poll/poll.ts | 16 +- types/src/scheduledEvent/scheduledEvent.ts | 48 ++--- types/src/stageInstances/stage.ts | 16 +- types/src/stickers/sticker.ts | 28 +-- types/src/teams/team.ts | 4 +- types/src/users/connection.ts | 16 +- types/src/users/user.ts | 32 +-- types/src/voices/voice.ts | 14 +- types/src/webhooks/webhook.ts | 48 ++--- 58 files changed, 1084 insertions(+), 845 deletions(-) create mode 100644 framework/src/cache/manager.ts create mode 100644 framework/src/managers/guildMembers.ts create mode 100644 framework/src/managers/messages.ts create mode 100644 framework/src/structures/channels/guildThreadChannel.ts create mode 100644 framework/src/structures/guilds/member.ts create mode 100644 framework/test/client.ts create mode 100644 framework/test/deps.ts diff --git a/README.md b/README.md index f6afaa5b..7c655c21 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![banner](https://cdn.discordapp.com/attachments/783319033730564098/783399012547035176/HarmonyBanner.png) +![banner](https://github.com/harmonyland/harmony/blob/main/assets/banner.png)

An easy to use Discord API Library for Deno.

diff --git a/core/src/rest/http_client.ts b/core/src/rest/http_client.ts index 9f073b81..32f0428a 100644 --- a/core/src/rest/http_client.ts +++ b/core/src/rest/http_client.ts @@ -176,13 +176,15 @@ export class HTTPClient implements HTTPClientOptions { } } + const query = new URLSearchParams(options?.query).toString(); + const abortController = new AbortController(); const timeoutID = setTimeout(() => { abortController.abort(); }, this.timeout); const res = await fetch( - `${this.baseURL}/v${this.version}${endpoint}`, + `${this.baseURL}/v${this.version}${endpoint}${query}`, { method, headers, diff --git a/framework/src/cache/manager.ts b/framework/src/cache/manager.ts new file mode 100644 index 00000000..5d05bf89 --- /dev/null +++ b/framework/src/cache/manager.ts @@ -0,0 +1,8 @@ +// deno-lint-ignore-file no-explicit-any +import { Collection } from "./collection.ts"; + +export class CacheManager extends Collection> { + constructor() { + super(); + } +} diff --git a/framework/src/managers/guildChannels.ts b/framework/src/managers/guildChannels.ts index 149e202d..80e93b23 100644 --- a/framework/src/managers/guildChannels.ts +++ b/framework/src/managers/guildChannels.ts @@ -17,7 +17,7 @@ export class GuildChannelsManager constructor(client: Client, parent: ChannelsManager, guildID: string) { super( client, - parent as unknown as BaseManager, + parent as BaseManager, ); this.guildID = guildID; } diff --git a/framework/src/managers/guildMembers.ts b/framework/src/managers/guildMembers.ts new file mode 100644 index 00000000..e69de29b diff --git a/framework/src/managers/messages.ts b/framework/src/managers/messages.ts new file mode 100644 index 00000000..99b78de0 --- /dev/null +++ b/framework/src/managers/messages.ts @@ -0,0 +1,87 @@ +import type { + GetChannelMessagesParams, + MessagePayload, +} from "../../../types/mod.ts"; +import type { Client } from "../client/mod.ts"; +import { Message } from "../structures/messages/mod.ts"; +import { BaseManager } from "./base.ts"; + +export class MessagesManager extends BaseManager { + constructor(client: Client) { + super(client); + } + + _fill(messages: MessagePayload[]) { + for (const message of messages) { + this.set(message.id!, message); + } + } + + async _fetch( + channelID: string, + id: string, + ): Promise { + try { + const resp: MessagePayload | undefined = await this.client.rest.get( + `/channels/${channelID}/messages/${id}`, + ); + if (!resp) return; + this.set(id, resp); + return resp; + } catch (_err) { + return; + } + } + async _fetchBulk( + channelID: string, + options: GetChannelMessagesParams, + ): Promise { + try { + const query: Record = { + ...options, + limit: "", + }; + if (options.limit) { + if (options.limit > 100 || options.limit < 1) { + throw new Error("Limit must be in range 1-100"); + } + query.limit = options.limit.toString(); + } else { + delete query.limit; + } + const resp: MessagePayload[] | undefined = await this.client.rest.get( + `/channels/${channelID}/messages`, + { + query, + }, + ); + if (!resp) return; + return resp.map((message) => { + this.set(message.id!, message); + return message; + }); + } catch (_err) { + return; + } + } + + get( + id: string, + ) { + const cached = this._get(id); + if (!cached) return; + return new Message(this.client, cached); + } + async fetch( + channelID: string, + id: string, + ) { + try { + const payload = await this._fetch(channelID, id); + if (!payload) return; + return new Message(this.client, payload); + } catch (_err) { + return; + } + } +} diff --git a/framework/src/structures/channels/channel.ts b/framework/src/structures/channels/channel.ts index bd4c7e6e..97227739 100644 --- a/framework/src/structures/channels/channel.ts +++ b/framework/src/structures/channels/channel.ts @@ -17,8 +17,4 @@ export class Channel { get type(): ChannelType { return this.payload.type; } - - get flags(): number { - return this.payload.flags; - } } diff --git a/framework/src/structures/channels/groupDMChannel.ts b/framework/src/structures/channels/groupDMChannel.ts index 792024f5..15d1c687 100644 --- a/framework/src/structures/channels/groupDMChannel.ts +++ b/framework/src/structures/channels/groupDMChannel.ts @@ -16,6 +16,9 @@ export class GroupDMChannel extends DMBasedChannel { get icon(): string | null { return this.payload.icon; } + get ownerID(): string { + return this.payload.owner_id; + } get owner(): User | undefined { return this.client.users.get(this.payload.owner_id); } diff --git a/framework/src/structures/channels/guildChannel.ts b/framework/src/structures/channels/guildChannel.ts index a8c8438c..2bac4f10 100644 --- a/framework/src/structures/channels/guildChannel.ts +++ b/framework/src/structures/channels/guildChannel.ts @@ -1,6 +1,7 @@ import { Channel } from "./channel.ts"; import type { GuildChannelPayload } from "../../../../types/mod.ts"; import type { Client } from "../../client/mod.ts"; +import { Guild } from "../guilds/guild.ts"; export class GuildChannel extends Channel { payload: GuildChannelPayload; @@ -12,6 +13,9 @@ export class GuildChannel extends Channel { get guildID(): string { return this.payload.guild_id; } + get guild(): Guild | undefined { + return this.client.guilds.get(this.payload.guild_id); + } get name(): string { return this.payload.name; } @@ -27,6 +31,9 @@ export class GuildChannel extends Channel { get parentID(): string | null { return this.payload.parent_id; } + get parent(): GuildChannel | undefined { + return this.client.channels.get(this.payload.parent_id!) as GuildChannel; + } get topic(): string | null { return this.payload.topic; } diff --git a/framework/src/structures/channels/guildForumChannel.ts b/framework/src/structures/channels/guildForumChannel.ts index 374b2179..81efe510 100644 --- a/framework/src/structures/channels/guildForumChannel.ts +++ b/framework/src/structures/channels/guildForumChannel.ts @@ -72,4 +72,7 @@ export class GuildForumChannel extends GuildForumChannelSuper { }; }); } + get flags(): number { + return this.payload.flags!; + } } diff --git a/framework/src/structures/channels/guildThreadChannel.ts b/framework/src/structures/channels/guildThreadChannel.ts new file mode 100644 index 00000000..e69de29b diff --git a/framework/src/structures/guilds/member.ts b/framework/src/structures/guilds/member.ts new file mode 100644 index 00000000..f92b5633 --- /dev/null +++ b/framework/src/structures/guilds/member.ts @@ -0,0 +1,62 @@ +import type { GuildMemberPayload } from "../../../../types/mod.ts"; +import type { Client } from "../../client/mod.ts"; + +export class Member { + client: Client; + payload: GuildMemberPayload; + + constructor(client: Client, payload: GuildMemberPayload) { + this.client = client; + this.payload = payload; + if (payload.user) { + this.client.users.set(payload.user.id, payload.user); + } + } + + get id() { + return this.payload.user?.id; + } + get user() { + return this.id ? this.client.users.get(this.id) : undefined; + } + get nick() { + return this.payload.nick ?? this.user?.name; + } + get avatar() { + // TODO: give default avatar + // (also) TODO: give the url instead of hash + return this.payload.avatar ?? this.user?.avatar; + } + get roles() { + return this.payload.roles.map((id) => this.client.roles.get(id)); + } + get joinedAt() { + return Date.parse(this.payload.joined_at); + } + get premiumSince() { + return this.payload.premium_since ?? null; + } + get deaf() { + return this.payload.deaf; + } + get mute() { + return this.payload.mute; + } + get flags() { + // TODO: make flags class + return this.payload.flags; + } + get pending() { + return this.payload.pending ?? false; + } + get permissions() { + // TODO: make permissions class + // also TODO: use roles to calculate permissions - permissions in payload is not available in all cases + return this.payload.permissions; + } + get timeOutEnd() { + return this.payload.communication_disabled_until + ? Date.parse(this.payload.communication_disabled_until) + : null; + } +} diff --git a/framework/test/client.test.ts b/framework/test/client.test.ts index e69de29b..117861ee 100644 --- a/framework/test/client.test.ts +++ b/framework/test/client.test.ts @@ -0,0 +1,33 @@ +import { GatewayIntent } from "../../mod.ts"; +import { Client } from "../mod.ts"; + +const token = Deno.env.get("BOT_TOKEN"); +if (!token) { + throw new Error("No token provided"); +} + +Deno.test("client", { + sanitizeOps: false, +}, async (t) => { + await t.step("ready event", async () => { + const client = new Client(token); + await client.connect(); + for await (const _ of client.on("ready")) { + await client.gateway.destroyAll(); + break; + } + }); + + await t.step("guild create event", async () => { + const client = new Client(token, { + intents: GatewayIntent.GUILDS, + }); + await client.connect(); + for await (const [guild] of client.on("guildCreate")) { + if (guild.id === "783319033205751809") { + await client.gateway.destroyAll(); + break; + } + } + }); +}); diff --git a/framework/test/client.ts b/framework/test/client.ts new file mode 100644 index 00000000..736c9b00 --- /dev/null +++ b/framework/test/client.ts @@ -0,0 +1,37 @@ +import { GatewayIntent } from "../../mod.ts"; +import { Client, GuildChannel } from "../mod.ts"; + +const TOKEN = Deno.env.get("BOT_TOKEN"); +if (!TOKEN) { + throw new Error("No token provided"); +} + +const client = new Client(TOKEN, { + intents: GatewayIntent.GUILDS | GatewayIntent.GUILD_MESSAGES, +}); + +client.on("guildCreate", (guild) => { + console.log(guild.name); +}); + +client.on("messageCreate", (msg) => { + if (msg.author.bot) return; + console.log(msg.guild!.id); + msg.channel?.send(`${msg.guild!.id}: ${msg.channel.id}`); +}); + +client.on("channelCreate", (channel) => { + if (channel instanceof GuildChannel) { + console.log(channel.name); + console.log(client.channels.cache.size); + } +}); + +client.on("channelDelete", (channel) => { + if (channel instanceof GuildChannel) { + console.log(channel.name); + console.log(client.channels.cache.size); + } +}); + +client.connect(); diff --git a/framework/test/deps.ts b/framework/test/deps.ts new file mode 100644 index 00000000..6f968999 --- /dev/null +++ b/framework/test/deps.ts @@ -0,0 +1 @@ +export * from "https://deno.land/std@0.201.0/assert/mod.ts"; diff --git a/types/src/applications/application.ts b/types/src/applications/application.ts index f36076b5..6bb54ac0 100644 --- a/types/src/applications/application.ts +++ b/types/src/applications/application.ts @@ -1,39 +1,39 @@ -import { UserPayload } from "../users/user.ts"; -import { TeamPayload } from "../teams/team.ts"; import { snowflake } from "../common.ts"; +import { TeamPayload } from "../teams/team.ts"; +import { UserPayload } from "../users/user.ts"; export interface ApplicationPayload { - id: snowflake; - name: string; - icon: string | null; - description: string; - rpc_origins?: string[]; + approximate_guild_count?: number; bot_public: boolean; bot_require_code_grant: boolean; - terms_of_service_url?: string; - privacy_policy_url?: string; - owner?: UserPayload; - /** @deprecated It will be removed in v11. */ - summary: string; - verify_key: string; - team: TeamPayload | null; - guild_id?: snowflake; - primary_sku_id?: snowflake; - slug?: string; cover_image?: string; + custom_install_url?: string; + description: string; /** Use it with ApplicationFlags. */ flags?: number; - approximate_guild_count?: number; - redirect_uris?: string[]; - interactions_endpoint_url?: string; - tags?: string[]; + guild_id?: snowflake; + icon: null | string; + id: snowflake; install_params?: ApplicationInstallParams; - custom_install_url?: string; - role_connections_verification_url?: string; integration_types_config?: Record< keyof ApplicationIntegrationType, ApplicationIntegrationTypeConfig >; + interactions_endpoint_url?: string; + name: string; + owner?: UserPayload; + primary_sku_id?: snowflake; + privacy_policy_url?: string; + redirect_uris?: string[]; + role_connections_verification_url?: string; + rpc_origins?: string[]; + slug?: string; + /** @deprecated It will be removed in v11. */ + summary: string; + tags?: string[]; + team: null | TeamPayload; + terms_of_service_url?: string; + verify_key: string; } export enum ApplicationIntegrationType { @@ -46,8 +46,8 @@ export interface ApplicationIntegrationTypeConfig { } export interface ApplicationInstallParams { - scopes: string[]; permissions: string; + scopes: string[]; } export enum ApplicationFlags { @@ -64,17 +64,17 @@ export enum ApplicationFlags { } export interface EditApplicationPayload { + cover_image?: null | string; custom_install_url?: string; description?: string; - role_connections_verification_url?: string; + flags?: number; + icon?: null | string; install_params?: ApplicationInstallParams; integration_types_config?: Record< keyof ApplicationIntegrationType, ApplicationIntegrationTypeConfig >; - flags?: number; - icon?: string | null; - cover_image?: string | null; interactions_endpoint_url?: string; + role_connections_verification_url?: string; tags?: string[]; } diff --git a/types/src/applications/roleConnectionMetadata.ts b/types/src/applications/roleConnectionMetadata.ts index 3cc4022d..b9c33991 100644 --- a/types/src/applications/roleConnectionMetadata.ts +++ b/types/src/applications/roleConnectionMetadata.ts @@ -1,12 +1,12 @@ import { Locales } from "../etc/locales.ts"; export interface ApplicationRoleConnectionMetadata { - type: ApplicationRoleConnectionMetadataType; + description: string; + description_localization?: Record; key: string; name: string; name_localization?: Record; - description: string; - description_localization?: Record; + type: ApplicationRoleConnectionMetadataType; } export enum ApplicationRoleConnectionMetadataType { diff --git a/types/src/auditLogs/log.ts b/types/src/auditLogs/log.ts index 9a231875..c0f04e0f 100644 --- a/types/src/auditLogs/log.ts +++ b/types/src/auditLogs/log.ts @@ -1,16 +1,21 @@ import { AutoModerationRulePayload } from "../autoMod/autoMod.ts"; +import { ChannelPayload } from "../channels/base.ts"; import { OverwritePayload } from "../channels/guild.ts"; import { GuildThreadChannelPayload, ThreadMetadataPayload, } from "../channels/thread.ts"; -import { IntegrationPayload } from "../guilds/integration.ts"; +import { snowflake } from "../common.ts"; +import { EmojiPayload } from "../emojis/emoij.ts"; import { GuildPayload } from "../guilds/guild.ts"; +import { IntegrationPayload } from "../guilds/integration.ts"; +import { GuildMemberPayload } from "../guilds/member.ts"; import { RolePayload } from "../guilds/role.ts"; import { ApplicationCommandPayload, ApplicationCommandPermissions, } from "../interactions/command.ts"; +import { InvitePayload } from "../invites/invite.ts"; import { ScheduledEventPayload, ScheduledEventPrivacyLevel, @@ -23,11 +28,6 @@ import { import { StickerFormatType, StickerPayload } from "../stickers/sticker.ts"; import { UserPayload } from "../users/user.ts"; import { WebhookPayload } from "../webhooks/webhook.ts"; -import { ChannelPayload } from "../channels/base.ts"; -import { GuildMemberPayload } from "../guilds/member.ts"; -import { InvitePayload } from "../invites/invite.ts"; -import { EmojiPayload } from "../emojis/emoij.ts"; -import { snowflake } from "../common.ts"; export interface AuditLogPayload { application_commands: ApplicationCommandPayload[]; @@ -41,13 +41,13 @@ export interface AuditLogPayload { } export interface AuditLogEntryPayload { - target_id: string | null; + action_type: AuditLogEvents; changes?: AuditLogChangePayload[]; - user_id: snowflake | null; id: snowflake; - action_type: AuditLogEvents; options?: AuditLogEntryInfoPayload; reason?: string; + target_id: null | string; + user_id: null | snowflake; } export enum AuditLogEvents { @@ -117,47 +117,47 @@ export interface AuditLogEntryInfoPayload { count?: string; delete_member_days?: string; id?: snowflake; + integration_type?: string; members_removed?: string; message_id?: snowflake; role_name?: string; type?: string; - integration_type?: string; } type AuditLogChangeValue = - | string - | number + | ApplicationCommandPermissions + | AutoModerationRulePayload | boolean - | StickerFormatType - | OverwritePayload - | StagePrivacyLevel - | ScheduledEventPrivacyLevel - | ScheduledEventStatus - | RolePayload - | GuildPayload | ChannelPayload - | GuildMemberPayload - | InvitePayload - | WebhookPayload | EmojiPayload + | GuildMemberPayload + | GuildPayload | IntegrationPayload + | InvitePayload + | number + | OverwritePayload + | RolePayload + | ScheduledEventPrivacyLevel + | ScheduledEventStatus | StageInstancePayload + | StagePrivacyLevel + | StickerFormatType | StickerPayload // | GuildScheduledEventPayload + | string | ThreadMetadataPayload - | ApplicationCommandPermissions - | AutoModerationRulePayload; + | WebhookPayload; export interface AuditLogChangePayload { + key: string; new_value?: AuditLogChangeValue; old_value?: AuditLogChangeValue; - key: string; } export interface GetAuditLogParams { - user_id?: snowflake; action_type?: AuditLogEvents; - before?: snowflake; after?: snowflake; + before?: snowflake; limit?: number; + user_id?: snowflake; } diff --git a/types/src/autoMod/autoMod.ts b/types/src/autoMod/autoMod.ts index f626c0a9..3c05e31c 100644 --- a/types/src/autoMod/autoMod.ts +++ b/types/src/autoMod/autoMod.ts @@ -1,17 +1,17 @@ import { snowflake } from "../common.ts"; export interface AutoModerationRulePayload { - id: snowflake; - guild_id: snowflake; - name: string; - creator_id: snowflake; - event_type: AutoModerationRuleEventType; - trigger_type: AutoModerationRuleTriggerType; - trigger_metadata: AutoModerationRuleTriggerMetadata; actions: AutoModerationRuleAction[]; + creator_id: snowflake; enabled: boolean; - exempt_roles: snowflake[]; + event_type: AutoModerationRuleEventType; exempt_channels: snowflake[]; + exempt_roles: snowflake[]; + guild_id: snowflake; + id: snowflake; + name: string; + trigger_metadata: AutoModerationRuleTriggerMetadata; + trigger_type: AutoModerationRuleTriggerType; } export enum AutoModerationRuleEventType { @@ -26,12 +26,12 @@ export enum AutoModerationRuleTriggerType { } export interface AutoModerationRuleTriggerMetadata { - keyword_filter: string[]; - regex_patterns: string[]; - presets: AutoModerationRuleKeywordPreset[]; allow_list: string[]; - mention_total_limit: number; + keyword_filter: string[]; mention_raid_protection_enabled: boolean; + mention_total_limit: number; + presets: AutoModerationRuleKeywordPreset[]; + regex_patterns: string[]; } export enum AutoModerationRuleKeywordPreset { @@ -41,8 +41,8 @@ export enum AutoModerationRuleKeywordPreset { } export interface AutoModerationRuleAction { - type: AutoModerationRuleActionType; metadata?: AutoModerationRuleActionMetadata; + type: AutoModerationRuleActionType; } export enum AutoModerationRuleActionType { @@ -53,27 +53,27 @@ export enum AutoModerationRuleActionType { export interface AutoModerationRuleActionMetadata { channel_id: snowflake; - duration_seconds: number; custom_message?: string; + duration_seconds: number; } export interface AutoModerationRuleCreatePayload { - name: string; - event_type: AutoModerationRuleEventType; - trigger_type: AutoModerationRuleTriggerType; - trigger_metadata?: AutoModerationRuleTriggerMetadata; actions: AutoModerationRuleAction[]; enabled?: boolean; - exempt_roles?: snowflake[]; + event_type: AutoModerationRuleEventType; exempt_channels?: snowflake[]; + exempt_roles?: snowflake[]; + name: string; + trigger_metadata?: AutoModerationRuleTriggerMetadata; + trigger_type: AutoModerationRuleTriggerType; } export interface AutoModerationRuleUpdatePayload { - name?: string; - event_type?: AutoModerationRuleEventType; - trigger_metadata?: AutoModerationRuleTriggerMetadata; actions?: AutoModerationRuleAction[]; enabled?: boolean; - exempt_roles?: snowflake[]; + event_type?: AutoModerationRuleEventType; exempt_channels?: snowflake[]; + exempt_roles?: snowflake[]; + name?: string; + trigger_metadata?: AutoModerationRuleTriggerMetadata; } diff --git a/types/src/channels/base.ts b/types/src/channels/base.ts index 3888077b..0e94c039 100644 --- a/types/src/channels/base.ts +++ b/types/src/channels/base.ts @@ -23,7 +23,6 @@ export enum ChannelType { export interface ChannelPayload { id: snowflake; type: ChannelType; - flags?: number; } export enum ChannelFlags { @@ -33,16 +32,16 @@ export enum ChannelFlags { } export interface TextChannelPayload extends ChannelPayload { - last_pin_timestamp: string | null; - last_message_id: snowflake | null; + last_message_id: null | snowflake; + last_pin_timestamp: null | string; } export interface CreateChannelInvitePayload extends Reasonable { max_age?: number; max_uses?: number; - temporary?: boolean; - unique?: boolean; + target_applicaton_id?: snowflake; target_type?: InviteTargetType; target_user_id?: snowflake; - target_applicaton_id?: snowflake; + temporary?: boolean; + unique?: boolean; } diff --git a/types/src/channels/dm.ts b/types/src/channels/dm.ts index 0ebb3a79..af9f4ce0 100644 --- a/types/src/channels/dm.ts +++ b/types/src/channels/dm.ts @@ -14,18 +14,18 @@ export interface DMChannelPayload extends DMBasedChannelPayload { /** @link https://discord.com/developers/docs/resources/channel#channel-object-example-group-dm-channel */ export interface GroupDMChannelPayload extends DMBasedChannelPayload { - type: ChannelType.GROUP_DM; - name: string; - icon: string | null; - owner_id: snowflake; application_id?: snowflake; + icon: null | string; managed: boolean; + name: string; + owner_id: snowflake; + type: ChannelType.GROUP_DM; } /** @link https://discord.com/developers/docs/resources/channel#modify-channel-json-params-group-dm */ export interface EditGroupDMChannelPayload extends Reasonable { - name?: string; icon?: string; + name?: string; } export interface GroupDMAddRecipientPayload { diff --git a/types/src/channels/embed.ts b/types/src/channels/embed.ts index bcf42e9d..7f857e1a 100644 --- a/types/src/channels/embed.ts +++ b/types/src/channels/embed.ts @@ -1,26 +1,26 @@ /** @link https://discord.com/developers/docs/resources/channel#embed-object-embed-types */ export enum EmbedType { - RICH = "rich", - IMAGE = "image", - VIDEO = "video", - GIFV = "gifv", ARTICLE = "article", + GIFV = "gifv", + IMAGE = "image", LINK = "link", + RICH = "rich", + VIDEO = "video", } /** @link https://discord.com/developers/docs/resources/channel#embed-object-embed-video-structure */ export interface EmbedVideoPayload { - url: string; - proxy_url?: string; height?: number; + proxy_url?: string; + url: string; width?: number; } /** @link https://discord.com/developers/docs/resources/channel#embed-object-embed-image-structure */ export interface EmbedImagePayload { - url: string; - proxy_url?: string; height?: number; + proxy_url?: string; + url: string; width?: number; } @@ -35,39 +35,39 @@ export interface EmbedProviderPayload { /** @link https://discord.com/developers/docs/resources/channel#embed-object-embed-author-structure */ export interface EmbedAuthorPayload { - name: string; - url?: string; icon_url?: string; + name: string; proxy_icon_url?: string; + url?: string; } /** @link https://discord.com/developers/docs/resources/channel#embed-object-embed-footer-structure */ export interface EmbedFooterPayload { - text: string; icon_url?: string; proxy_icon_url?: string; + text: string; } /** @link https://discord.com/developers/docs/resources/channel#embed-object-embed-field-structure */ export interface EmbedFieldPayload { + inline?: boolean; name: string; value: string; - inline?: boolean; } /** @link https://discord.com/developers/docs/resources/channel#embed-object-embed-structure */ export interface EmbedPayload { - title?: string; - type?: EmbedType; - description?: string; - url?: string; - timestamp?: string; + author?: EmbedAuthorPayload; color?: number; + description?: string; + fields?: EmbedFieldPayload[]; footer?: EmbedFooterPayload; image?: EmbedImagePayload; + provider?: EmbedProviderPayload; thumbnail?: EmbedThumbnailPayload; + timestamp?: string; + title?: string; + type?: EmbedType; + url?: string; video?: EmbedVideoPayload; - provider?: EmbedProviderPayload; - author?: EmbedAuthorPayload; - fields?: EmbedFieldPayload[]; } diff --git a/types/src/channels/etc.ts b/types/src/channels/etc.ts index cbb867db..a18927de 100644 --- a/types/src/channels/etc.ts +++ b/types/src/channels/etc.ts @@ -8,15 +8,15 @@ export interface FollowedChannelPayload { /** @link https://discord.com/developers/docs/resources/channel#allowed-mentions-object-allowed-mention-types */ export enum AllowedMentionType { + EVERYONE = "everyone", ROLES = "roles", USERS = "users", - EVERYONE = "everyone", } /** @link https://discord.com/developers/docs/resources/channel#allowed-mentions-object-allowed-mentions-structure */ export interface AllowedMentionsPayload { parse: AllowedMentionType[]; + replied_user: boolean; roles: snowflake[]; users: snowflake[]; - replied_user: boolean; } diff --git a/types/src/channels/guild.ts b/types/src/channels/guild.ts index bb009383..2353862f 100644 --- a/types/src/channels/guild.ts +++ b/types/src/channels/guild.ts @@ -11,24 +11,24 @@ export enum OverwriteType { /** @link https://discord.com/developers/docs/resources/channel#overwrite-object-overwrite-structure */ export interface OverwritePayload { - id: snowflake; - type: OverwriteType; allow: string; deny: string; + id: snowflake; + type: OverwriteType; } export interface GuildForumTagPayload { + emoji_id: null | snowflake; + emoji_name: null | string; id: snowflake; - name: string; moderated: boolean; - emoji_id: snowflake | null; - emoji_name: string | null; + name: string; } export interface GuildVoiceBasedChannelPayload extends GuildChannelPayload { bitrate: number; + rtc_region: null | string; user_limit: number; - rtc_region: string | null; } export interface GuildTextBasedChannelPayload @@ -45,20 +45,21 @@ export interface GuildThreadAvailableChannelPayload export interface GuildChannelPayload extends ChannelPayload { guild_id: snowflake; name: string; - position: number; - permission_overwrites: OverwritePayload[]; nsfw: boolean; - parent_id: snowflake | null; - topic: string | null; + parent_id: null | snowflake; + permission_overwrites: OverwritePayload[]; + position: number; + topic: null | string; } export interface GuildForumChannelPayload extends GuildThreadAvailableChannelPayload, GuildTextBasedChannelPayload { - type: ChannelType.GUILD_FORUM; + available_tags: GuildForumTagPayload[]; + default_forum_layout?: ForumLayout; default_reaction_emoji?: ForumDefaultReactionPayload | null; default_sort_order?: ForumSortOrder; - default_forum_layout?: ForumLayout; - available_tags: GuildForumTagPayload[]; + flags?: number; + type: ChannelType.GUILD_FORUM; } export enum ForumSortOrder { @@ -73,8 +74,8 @@ export enum ForumLayout { } export interface ForumDefaultReactionPayload { - emoji_id: snowflake | null; - emoji_name: string | null; + emoji_id: null | snowflake; + emoji_name: null | string; } /** @link https://discord.com/developers/docs/resources/channel#channel-object-example-guild-text-channel */ @@ -115,54 +116,54 @@ export interface GuildStageChannelPayload /** @link https://discord.com/developers/docs/resources/channel#modify-channel-json-params-guild-channel */ export interface EditGuildChannelPayload extends Reasonable { name?: string; - position?: number | null; - permission_overwrites?: OverwritePayload[] | null; + permission_overwrites?: null | OverwritePayload[]; + position?: null | number; } export type EditGuildCategoryPayload = EditGuildChannelPayload; export interface EditGuildAnnouncementChannelPayload extends EditGuildChannelPayload { - type?: ChannelType.GUILD_TEXT | ChannelType.GUILD_ANNOUNCEMENT; - topic?: string | null; - parent_id?: snowflake | null; - default_auto_archive_duration?: number | null; + default_auto_archive_duration?: null | number; nsfw?: boolean | null; + parent_id?: null | snowflake; + topic?: null | string; + type?: ChannelType.GUILD_ANNOUNCEMENT | ChannelType.GUILD_TEXT; } export interface EditGuildTextChannelPayload extends EditGuildChannelPayload { - type?: ChannelType.GUILD_TEXT | ChannelType.GUILD_ANNOUNCEMENT; - topic?: string | null; - parent_id?: snowflake | null; - rate_limit_per_user?: number | null; + default_auto_archive_duration?: null | number; default_thread_rate_limit_per_user?: number; - default_auto_archive_duration?: number | null; nsfw?: boolean | null; + parent_id?: null | snowflake; + rate_limit_per_user?: null | number; + topic?: null | string; + type?: ChannelType.GUILD_ANNOUNCEMENT | ChannelType.GUILD_TEXT; } export interface EditGuildVoiceChannelPayload extends EditGuildChannelPayload { - bitrate?: number | null; - user_limit?: number | null; - rtc_region?: string | null; - video_quality_mode?: VideoQualityModes | null; - parent_id?: snowflake | null; + bitrate?: null | number; nsfw?: boolean | null; + parent_id?: null | snowflake; + rtc_region?: null | string; + user_limit?: null | number; + video_quality_mode?: null | VideoQualityModes; } export type EditGuildStageChannelPayload = EditGuildVoiceChannelPayload; export interface EditGuildForumChannelPayload extends EditGuildChannelPayload { - flags?: number; available_tags?: GuildForumTagPayload[]; + default_auto_archive_duration?: null | number; + default_forum_layout?: ForumLayout; default_reaction_emoji?: ForumDefaultReactionPayload | null; - default_thread_rate_limit_per_user?: number; default_sort_order?: ForumSortOrder | null; - default_forum_layout?: ForumLayout; - parent_id?: snowflake | null; + default_thread_rate_limit_per_user?: number; + flags?: number; nsfw?: boolean | null; - topic?: string | null; - rate_limit_per_user?: number | null; - default_auto_archive_duration?: number | null; + parent_id?: null | snowflake; + rate_limit_per_user?: null | number; + topic?: null | string; } export interface EditChannelPermissionsPayload extends Reasonable { diff --git a/types/src/channels/message.ts b/types/src/channels/message.ts index 446672e7..160039f1 100644 --- a/types/src/channels/message.ts +++ b/types/src/channels/message.ts @@ -22,27 +22,27 @@ import { GuildThreadChannelPayload } from "./thread.ts"; /** @link https://discord.com/developers/docs/resources/channel#channel-mention-object-channel-mention-structure */ export interface ChannelMentionPayload { - id: snowflake; guild_id: snowflake; - type: ChannelType; + id: snowflake; name: string; + type: ChannelType; } /** @link https://discord.com/developers/docs/resources/channel#attachment-object-attachment-structure */ export interface AttachmentPayload { - id: snowflake; - filename: string; - description?: string; content_type?: string; + description?: string; + duration_secs?: number; + ephemeral?: boolean; + filename: string; + flags?: number; + height?: number; + id: snowflake; + proxy_url: string; size: number; url: string; - proxy_url: string; - height?: number; - width?: number; - ephemeral?: boolean; - duration_secs?: number; waveform?: string; - flags?: number; + width?: number; } export enum AttachmentFlags { @@ -51,12 +51,12 @@ export enum AttachmentFlags { /** @link https://discord.com/developers/docs/resources/channel#reaction-object-reaction-structure */ export interface ReactionPayload { + burst_colors: string[]; count: number; count_details: ReactionCountDetailsPayload; + emoji: EmojiPayload; me: boolean; me_burst: boolean; - emoji: EmojiPayload; - burst_colors: string[]; } export interface ReactionCountDetailsPayload { @@ -109,16 +109,16 @@ export enum MessageActivityType { /** @link https://discord.com/developers/docs/resources/channel#message-object-message-activity-structure */ export interface MessageActivityPayload { - type: MessageActivityType; party_id?: string; + type: MessageActivityType; } /** @link https://discord.com/developers/docs/resources/channel#message-reference-object */ export interface MessageReferencePayload { - message_id?: snowflake; channel_id?: snowflake; - guild_id?: snowflake; fail_if_not_exists?: boolean; + guild_id?: snowflake; + message_id?: snowflake; } /** @link https://discord.com/developers/docs/resources/channel#message-object-message-flags */ @@ -137,82 +137,82 @@ export enum MessageFlags { } export interface RoleSubscriptionDataPayload { + is_renewal: boolean; role_subscription_listing_id: snowflake; tier_name: string; total_months_subscribed: number; - is_renewal: boolean; } // https://discord.com/developers/docs/resources/channel#message-object-message-structure export interface MessagePayload { - id: snowflake; - channel_id: snowflake; - guild_id?: snowflake; - author: UserPayload; - member?: GuildMemberPayload; - content?: string; // Check second note on https://discord.com/developers/docs/resources/channel#message-object-message-structure - timestamp: string; - edited_timestamp: string | null; - tts: boolean; - mention_everyone: boolean; - mentions: UserPayload[]; - mention_roles: string[]; - mention_channels?: ChannelMentionPayload[]; - attachments?: AttachmentPayload[]; - embeds?: EmbedPayload[]; - reactions?: ReactionPayload[]; - nonce?: string | number; - pinned: boolean; - webhook_id?: snowflake; - type: MessageType; activity?: MessageActivityPayload; application?: ApplicationPayload; application_id?: snowflake; - message_reference?: MessageReferencePayload; + attachments?: AttachmentPayload[]; + author: UserPayload; + channel_id: snowflake; + components?: ComponentPayload[]; + content?: string; // Check second note on https://discord.com/developers/docs/resources/channel#message-object-message-structure + edited_timestamp: null | string; + embeds?: EmbedPayload[]; flags?: number; - referenced_message?: MessagePayload | null; + guild_id?: snowflake; + id: snowflake; interaction?: MessageInteractionPayload; interaction_metadata?: MessageInteractionMetadataPayload; - thread?: GuildThreadChannelPayload; - components?: ComponentPayload[]; - sticker_items?: StickerItemPayload[]; + member?: GuildMemberPayload; + mention_channels?: ChannelMentionPayload[]; + mention_everyone: boolean; + mention_roles: string[]; + mentions: UserPayload[]; + message_reference?: MessageReferencePayload; + nonce?: number | string; + pinned: boolean; + poll?: PollCreateRequestPayload; position?: number; - role_subscription_data?: RoleSubscriptionDataPayload; + reactions?: ReactionPayload[]; + referenced_message?: MessagePayload | null; resolved?: ResolvedDataPayload; - poll?: PollCreateRequestPayload; + role_subscription_data?: RoleSubscriptionDataPayload; + sticker_items?: StickerItemPayload[]; + thread?: GuildThreadChannelPayload; + timestamp: string; + tts: boolean; + type: MessageType; + webhook_id?: snowflake; } export interface MessageInteractionMetadataPayload { - id: snowflake; - type: InteractionType; - user: UserPayload; authorizing_integration_owners: Record; - original_response_message_id?: snowflake; + id: snowflake; interacted_message_id?: snowflake; + original_response_message_id?: snowflake; triggering_interaction_metadata?: MessageInteractionMetadataPayload; + type: InteractionType; + user: UserPayload; } export interface GetChannelMessagesParams { + after?: snowflake; around?: snowflake; before?: snowflake; - after?: snowflake; limit?: number; } export interface CreateMessagePayload { - content: string; - nonce?: number | string; - tts?: boolean; - embeds?: EmbedPayload[]; allowed_mentions?: AllowedMentionsPayload; - message_reference?: MessageReferencePayload; + attachments?: AttachmentPayload[]; components: ComponentPayload[]; - sticker_ids?: snowflake[]; + content: string; + embeds?: EmbedPayload[]; + enforce_nonce?: boolean; file?: AttachmentPayload; - attachments?: AttachmentPayload[]; flags?: number; - enforce_nonce?: boolean; + message_reference?: MessageReferencePayload; + nonce?: number | string; poll?: PollCreateRequestPayload; + sticker_ids?: snowflake[]; + tts?: boolean; } export interface GetMessageReactionParams { @@ -221,13 +221,13 @@ export interface GetMessageReactionParams { } export interface EditMessagePayload { - content?: string | null; - embeds?: EmbedPayload[] | null; - flags?: number | null; - file?: AttachmentPayload | null; allowed_mentions?: AllowedMentionsPayload | null; attachments?: AttachmentPayload[] | null; components?: ComponentPayload[] | null; + content?: null | string; + embeds?: EmbedPayload[] | null; + file?: AttachmentPayload | null; + flags?: null | number; } export interface BulkDeleteMessagesPayload extends Reasonable { diff --git a/types/src/channels/thread.ts b/types/src/channels/thread.ts index dccb5251..a476448f 100644 --- a/types/src/channels/thread.ts +++ b/types/src/channels/thread.ts @@ -10,83 +10,83 @@ import { AttachmentPayload } from "./message.ts"; /** @link https://discord.com/developers/docs/resources/channel#thread-metadata-object-thread-metadata-structure */ export interface ThreadMetadataPayload { + archive_timestamp: string; archived: boolean; auto_archive_duration: number; - archive_timestamp: string; - locked: boolean; + create_timestamp?: null | string; invitable?: boolean; - create_timestamp?: string | null; + locked: boolean; } /** @link https://discord.com/developers/docs/resources/channel#thread-member-object-thread-member-structure */ export interface ThreadMemberPayload { + flags: number; id?: snowflake; - user_id?: snowflake; join_timestamp: string; - flags: number; member?: GuildMemberPayload; + user_id?: snowflake; } /** @link https://discord.com/developers/docs/resources/channel#channel-object-example-thread-channel */ export interface GuildThreadChannelPayload extends GuildTextChannelPayload { - message_count: number; - member_count: number; - thread_metadata: ThreadMetadataPayload; + applied_tags?: snowflake[]; member: ThreadMemberPayload; + member_count: number; + message_count: number; permissions: string; - applied_tags?: snowflake[]; + thread_metadata: ThreadMetadataPayload; } // https://discord.com/developers/docs/resources/channel#modify-channel-json-params-thread export interface EditGuildThreadChannelPayload extends Reasonable { - name?: string; + applied_tags?: snowflake[]; archived?: boolean; /** Duration in minute */ auto_archive_duration?: number; - locked?: boolean; + flags?: number; invitable?: boolean; + locked?: boolean; + name?: string; /** Duration in second */ - rate_limit_per_user?: number | null; - flags?: number; - applied_tags?: snowflake[]; + rate_limit_per_user?: null | number; } export interface StartThreadWithMessagePayload extends Reasonable { - name: string; auto_archive_duration?: number; - rate_limit_per_user?: number | null; + name: string; + rate_limit_per_user?: null | number; } export interface StartThreadWithoutMessagePayload extends Reasonable { - name: string; auto_archive_duration?: number; - type?: ChannelType; invitable?: boolean; - rate_limit_per_user?: number | null; + name: string; + rate_limit_per_user?: null | number; + type?: ChannelType; } export interface ForumThreadMessageParams { - content?: string; - embeds?: EmbedPayload[]; allowed_mentions?: AllowedMentionsPayload; - components?: ComponentPayload[]; - sticker_ids?: snowflake[]; attachments?: AttachmentPayload[]; + components?: ComponentPayload[]; + content?: string; + embeds?: EmbedPayload[]; flags?: number; + sticker_ids?: snowflake[]; } export interface StartThreadInForumChannelPayload extends Reasonable { - name: string; + applied_tags?: snowflake[]; auto_archive_duration?: number; - rate_limit_per_user?: number | null; message: ForumThreadMessageParams; - applied_tags?: snowflake[]; + name: string; + rate_limit_per_user?: null | number; } export interface ListThreadsPayload { - threads: GuildThreadChannelPayload[]; - members: ThreadMemberPayload[]; has_more: boolean; + members: ThreadMemberPayload[]; + threads: GuildThreadChannelPayload[]; } export interface ListThreadsParams { @@ -99,9 +99,9 @@ export interface GetThreadMemberPayload { } export interface ListThreadMembersPayload { - with_member?: boolean; after?: snowflake; limit?: number; + with_member?: boolean; } export type ListPublicArchivedThreadsPayload = ListThreadsPayload; diff --git a/types/src/emojis/emoij.ts b/types/src/emojis/emoij.ts index db7ac0d3..8aa1e245 100644 --- a/types/src/emojis/emoij.ts +++ b/types/src/emojis/emoij.ts @@ -3,23 +3,23 @@ import { Reasonable } from "../etc/reasonable.ts"; import { UserPayload } from "../users/user.ts"; export interface EmojiPayload { - id: snowflake | null; - name: string | null; - roles?: string[]; - user?: UserPayload; - require_colons?: boolean; - managed?: boolean; animated?: boolean; available?: boolean; + id: null | snowflake; + managed?: boolean; + name: null | string; + require_colons?: boolean; + roles?: string[]; + user?: UserPayload; } export interface CreateGuildEmojiPayload extends Reasonable { - name: string; image: string; + name: string; roles: snowflake[]; } export interface EditGuildEmojiPayload extends Reasonable { name?: string; - roles?: snowflake[] | null; + roles?: null | snowflake[]; } diff --git a/types/src/entitlements/entitlements.ts b/types/src/entitlements/entitlements.ts index 71e8960b..2087056e 100644 --- a/types/src/entitlements/entitlements.ts +++ b/types/src/entitlements/entitlements.ts @@ -1,16 +1,16 @@ import { snowflake } from "../common.ts"; export interface EntitlementPayload { - id: snowflake; - sku_id: snowflake; application_id: snowflake; - user_id?: snowflake; - type: EntitlementType; + consumed?: boolean; deleted: boolean; - starts_at?: string; ends_at?: string; guild_id?: snowflake; - consumed?: boolean; + id: snowflake; + sku_id: snowflake; + starts_at?: string; + type: EntitlementType; + user_id?: snowflake; } export enum EntitlementType { @@ -25,19 +25,19 @@ export enum EntitlementType { } export interface ListEntitlementsParams { - user_id?: snowflake; - sku_id?: string; - before?: snowflake; after?: snowflake; - limit?: number; - guild_id?: snowflake; + before?: snowflake; exclude_ended?: boolean; + guild_id?: snowflake; + limit?: number; + sku_id?: string; + user_id?: snowflake; } export interface CreateTestEntitlementPayload { - sku_id: snowflake; owner_id: snowflake; owner_type: TestEntitlementOwnerType; + sku_id: snowflake; } export enum TestEntitlementOwnerType { diff --git a/types/src/etc/locales.ts b/types/src/etc/locales.ts index 062d0c11..9f8ea618 100644 --- a/types/src/etc/locales.ts +++ b/types/src/etc/locales.ts @@ -1,30 +1,30 @@ export type Locales = - | "en-US" - | "en-GB" | "bg" - | "zh-CN" - | "zh-TW" - | "hr" | "cs" | "da" - | "nl" - | "fi" - | "fr" | "de" | "el" + | "en-GB" + | "en-US" + | "es-ES" + | "fi" + | "fr" | "hi" + | "hr" | "hu" | "it" | "ja" | "ko" | "lt" + | "nl" | "no" | "pl" | "pt-BR" | "ro" | "ru" - | "es-ES" | "sv-SE" | "th" | "tr" - | "uk"; + | "uk" + | "zh-CN" + | "zh-TW"; diff --git a/types/src/etc/scopes.ts b/types/src/etc/scopes.ts index c2f3903f..83deda6a 100644 --- a/types/src/etc/scopes.ts +++ b/types/src/etc/scopes.ts @@ -4,9 +4,9 @@ export enum Scopes { APPLICATIONS_BUILDS_READ = "applications.builds.read", APPLICATIONS_BUILDS_UPLOAD = "applications.builds.upload", APPLICATIONS_COMMANDS = "applications.commands", - APPLICATIONS_COMMANDS_UPDATE = "applications.commands.update", APPLICATIONS_COMMANDS_PERMISSIONS_UPDATE = "applications.commands.permissions.update", + APPLICATIONS_COMMANDS_UPDATE = "applications.commands.update", APPLICATIONS_ENTITLEMENTS = "applications.entitlements", APPLICATIONS_STORE_UPDATE = "applications.store.update", BOT = "bot", diff --git a/types/src/gateways/activity.ts b/types/src/gateways/activity.ts index caf9a4a2..99883923 100644 --- a/types/src/gateways/activity.ts +++ b/types/src/gateways/activity.ts @@ -1,21 +1,21 @@ import { snowflake } from "../common.ts"; export interface ActivityPayload { - name: string; - type: ActivityType; - url?: string | null; - created_at: number; - timestamps?: ActivityTimestamps; application_id?: snowflake; - details?: string | null; - state?: string | null; + assets?: ActivityAsset; + buttons?: ActivityButton[]; + created_at: number; + details?: null | string; emoji?: ActivityEmoji | null; + flags?: number; + instance?: boolean; + name: string; party?: ActivityParty; - assets?: ActivityAsset; secrets?: ActivitySecret; - instance?: boolean; - flags?: number; - buttons?: ActivityButton[]; + state?: null | string; + timestamps?: ActivityTimestamps; + type: ActivityType; + url?: null | string; } export enum ActivityType { @@ -28,14 +28,14 @@ export enum ActivityType { } export interface ActivityTimestamps { - start?: number; end?: number; + start?: number; } export interface ActivityEmoji { - name: string; - id?: snowflake; animated?: boolean; + id?: snowflake; + name: string; } export interface ActivityParty { @@ -52,12 +52,11 @@ export interface ActivityAsset { export interface ActivitySecret { join?: string; - spectate?: string; match?: string; + spectate?: string; } export enum ActivityFlag { - INSTANCE = 1, JOIN = 1 << 1, SPECTATE = 1 << 2, JOIN_REQUEST = 1 << 3, @@ -66,6 +65,7 @@ export enum ActivityFlag { PARTY_PRIVACY_FRIENDS = 1 << 6, PARTY_PRIVACY_VOICE_CHANNEL = 1 << 7, EMBEDDED = 1 << 8, + INSTANCE = 1, } export interface ActivityButton { diff --git a/types/src/gateways/gateway.ts b/types/src/gateways/gateway.ts index 60dadf63..1925d579 100644 --- a/types/src/gateways/gateway.ts +++ b/types/src/gateways/gateway.ts @@ -55,129 +55,129 @@ import { } from "./thread.ts"; export interface GatewayPayload { - op: GatewayOpcode; d: GatewayDataType | null; - s: number | null; + op: GatewayOpcode; + s: null | number; t: GatewayEventNames | null; } export type GatewayEventNames = - | "READY" - | "RESUMED" | "CHANNEL_CREATE" - | "CHANNEL_UPDATE" | "CHANNEL_DELETE" | "CHANNEL_PINS_UPDATE" - | "THREAD_CREATE" - | "THREAD_UPDATE" - | "THREAD_DELETE" - | "THREAD_LIST_SYNC" - | "THREAD_MEMBER_UPDATE" - | "THREAD_MEMBERS_UPDATE" - | "GUILD_CREATE" - | "GUILD_UPDATE" - | "GUILD_DELETE" + | "CHANNEL_UPDATE" | "GUILD_BAN_ADD" | "GUILD_BAN_REMOVE" + | "GUILD_CREATE" + | "GUILD_DELETE" | "GUILD_EMOJIS_UPDATE" - | "GUILD_STICKERS_UPDATE" | "GUILD_INTEGRATIONS_UPDATE" | "GUILD_MEMBER_ADD" | "GUILD_MEMBER_REMOVE" | "GUILD_MEMBER_UPDATE" | "GUILD_MEMBERS_CHUNK" | "GUILD_ROLE_CREATE" - | "GUILD_ROLE_UPDATE" | "GUILD_ROLE_DELETE" + | "GUILD_ROLE_UPDATE" | "GUILD_SCHEDULED_EVENT_CREATE" - | "GUILD_SCHEDULED_EVENT_UPDATE" | "GUILD_SCHEDULED_EVENT_DELETE" + | "GUILD_SCHEDULED_EVENT_UPDATE" | "GUILD_SCHEDULED_EVENT_USER_ADD" | "GUILD_SCHEDULED_EVENT_USER_REMOVE" + | "GUILD_STICKERS_UPDATE" + | "GUILD_UPDATE" | "INTEGRATION_CREATE" - | "INTEGRATION_UPDATE" | "INTEGRATION_DELETE" + | "INTEGRATION_UPDATE" | "INTERACTION_CREATE" | "INVITE_CREATE" | "INVITE_DELETE" | "MESSAGE_CREATE" - | "MESSAGE_UPDATE" | "MESSAGE_DELETE" | "MESSAGE_DELETE_BULK" + | "MESSAGE_POLL_VOTE_ADD" + | "MESSAGE_POLL_VOTE_REMOVE" | "MESSAGE_REACTION_ADD" | "MESSAGE_REACTION_REMOVE" | "MESSAGE_REACTION_REMOVE_ALL" | "MESSAGE_REACTION_REMOVE_EMOJI" + | "MESSAGE_UPDATE" | "PRESENCE_UPDATE" + | "READY" + | "RESUMED" | "STAGE_INSTANCE_CREATE" | "STAGE_INSTANCE_DELETE" | "STAGE_INSTANCE_UPDATE" + | "THREAD_CREATE" + | "THREAD_DELETE" + | "THREAD_LIST_SYNC" + | "THREAD_MEMBER_UPDATE" + | "THREAD_MEMBERS_UPDATE" + | "THREAD_UPDATE" | "TYPING_START" | "USER_UPDATE" - | "VOICE_STATE_UPDATE" | "VOICE_SERVER_UPDATE" - | "WEBHOOKS_UPDATE" - | "MESSAGE_POLL_VOTE_ADD" - | "MESSAGE_POLL_VOTE_REMOVE"; + | "VOICE_STATE_UPDATE" + | "WEBHOOKS_UPDATE"; export type GatewayDataType = - | GatewayHelloPayload - | GatewayIdentifyPayload - | GatewayResumePayload - | HeartbeatPayload - | GetGatewayGuildMembersPayload - | EditGatewayPresencePayload - | GatewayReadyPayload - | Reasumable | ChannelPayload - | GatewayThreadListSyncPayload - | GatewayThreadMemberUpdatePayload - | GatewayThreadMembersUpdatePayload + | EditGatewayPresencePayload + | GatewayAutoModerationActionExecutionEventPayload | GatewayChannelPinsUpdatePayload - | GuildPayload | GatewayGuildBanAddPayload | GatewayGuildBanRemovePayload | GatewayGuildEmojisUpdatePayload - | GatewayGuildStickersUpdatePayload | GatewayGuildIntegrationsUpdatePayload | GatewayGuildMemberAddPayload + | GatewayGuildMemberChunkPayload | GatewayGuildMemberRemovePayload | GatewayGuildMemberUpdatePayload - | GatewayGuildMemberChunkPayload | GatewayGuildRoleCreatePayload - | GatewayGuildRoleUpdatePayload | GatewayGuildRoleDeletePayload - | ScheduledEventPayload - | GatewayScheduledEventUserAddPayload - | GatewayScheduledEventUserRemovePayload + | GatewayGuildRoleUpdatePayload + | GatewayGuildStickersUpdatePayload + | GatewayHelloPayload + | GatewayIdentifyPayload | GatewayIntegrationCreatePayload - | GatewayIntegrationUpdatePayload | GatewayIntegrationDeletePayload - | InteractionPayload + | GatewayIntegrationUpdatePayload | GatewayInviteCreatePayload | GatewayInviteDeletePayload - | MessagePayload - | GatewayMessageDeletePayload | GatewayMessageDeleteBulkPayload + | GatewayMessageDeletePayload | GatewayMessageReactionAddPayload - | GatewayMessageReactionRemovePayload | GatewayMessageReactionRemoveAllPayload | GatewayMessageReactionRemoveEmojiPayload - | GatewayWebhookUpdatePayload - | StageInstancePayload - | UserPayload - | VoiceStatePayload + | GatewayMessageReactionRemovePayload | GatewayPresenceUpdatePayload + | GatewayReadyPayload + | GatewayResumePayload + | GatewayScheduledEventUserAddPayload + | GatewayScheduledEventUserRemovePayload + | GatewayThreadListSyncPayload + | GatewayThreadMembersUpdatePayload + | GatewayThreadMemberUpdatePayload | GatewayTypingStartPayload | GatewayVoiceServerUpdatePayload - | GatewayAutoModerationActionExecutionEventPayload + | GatewayWebhookUpdatePayload + | GetGatewayGuildMembersPayload + | GuildPayload + | HeartbeatPayload + | InteractionPayload + | MessagePayload | MessagePollVoteAddPayload - | MessagePollVoteRemovePayload; + | MessagePollVoteRemovePayload + | Reasumable + | ScheduledEventPayload + | StageInstancePayload + | UserPayload + | VoiceStatePayload; export interface ConnectGatewayParams { - v: number; - encoding: "json" | "etf"; compress?: "zlib-stream"; + encoding: "etf" | "json"; + v: number; } export interface GatewayHelloPayload { @@ -185,81 +185,81 @@ export interface GatewayHelloPayload { } export interface GatewayIdentifyPayload { - token: string; + compress?: boolean; intents: number; + large_threshold?: number; + presence?: EditGatewayPresencePayload; properties: { - os: string; browser: string; device: string; + os: string; }; - compress?: boolean; - large_threshold?: number; shard?: [number, number]; - presence?: EditGatewayPresencePayload; + token: string; } export interface GatewayResumePayload { - token: string; - session_id: snowflake; seq: number; + session_id: snowflake; + token: string; } -export type HeartbeatPayload = number | null; +export type HeartbeatPayload = null | number; export type Reasumable = boolean; export interface GetGatewayGuildMembersPayload { guild_id: snowflake; - query?: string; limit: number; + nonce?: string; presence?: boolean; + query?: string; user_ids?: snowflake | snowflake[]; - nonce?: string; } export interface EditGatewayPresencePayload { - since: number | null; activities: ActivityPayload[]; - status: StatusType; afk: boolean; + since: null | number; + status: StatusType; } -export type StatusType = "online" | "dnd" | "idle" | "invisible" | "offline"; +export type StatusType = "dnd" | "idle" | "invisible" | "offline" | "online"; export interface GatewayReadyPayload { - v: number; - user: UserPayload; + application: ApplicationPayload; guilds: GuildPayload[]; + resume_gateway_url: string; session_id: string; shard?: [number, number]; - application: ApplicationPayload; - resume_gateway_url: string; + user: UserPayload; + v: number; } export interface GatewayChannelPinsUpdatePayload { - guild_id?: snowflake; channel_id: snowflake; - last_pin_timestamp?: string | null; + guild_id?: snowflake; + last_pin_timestamp?: null | string; } export interface GatewayWebhookUpdatePayload { - guild_id: snowflake; channel_id: snowflake; + guild_id: snowflake; } export interface GetGatewayBotPayload { - url: string; - shards: number; session_start_limit: SessionStartLimitPayload; + shards: number; + url: string; } export interface SessionStartLimitPayload { - total: number; + max_concurrency: number; remaning: number; reset_after: number; - max_concurrency: number; + total: number; } -export type ClientStatusType = "online" | "idle" | "dnd"; +export type ClientStatusType = "dnd" | "idle" | "online"; export interface ClientStatusPayload { desktop?: ClientStatusType; @@ -268,47 +268,47 @@ export interface ClientStatusPayload { } export interface GatewayPresenceUpdatePayload { - user: UserPayload; - guild_id: snowflake; - status: StatusType; activities: ActivityPayload[]; client_status: ClientStatusPayload; + guild_id: snowflake; + status: StatusType; + user: UserPayload; } export interface GatewayTypingStartPayload { channel_id: snowflake; guild_id?: snowflake; - user_id: snowflake; - timestamp: number; member?: GuildMemberPayload; + timestamp: number; + user_id: snowflake; } export interface GatewayVoiceServerUpdatePayload { - token: string; + endpoint: null | string; guild_id: snowflake; - endpoint: string | null; + token: string; } export interface GatewayAutoModerationActionExecutionEventPayload { - guild_id: snowflake; action: AutoModerationRuleAction; + alert_system_message_id?: snowflake; + channel_id?: snowflake; + content?: string; + guild_id: snowflake; + matched_content?: null | string; + matched_keyword: null | string; + message_id?: snowflake; rule_id: string; rule_trigger_type: AutoModerationRuleTriggerType; user_id: snowflake; - channel_id?: snowflake; - message_id?: snowflake; - alert_system_message_id?: snowflake; - content?: string; - matched_keyword: string | null; - matched_content?: string | null; } export interface MessagePollVoteAddPayload { - user_id: snowflake; + answer_id: number; channel_id: snowflake; - message_id: snowflake; guild_id?: snowflake; - answer_id: number; + message_id: snowflake; + user_id: snowflake; } export type MessagePollVoteRemovePayload = MessagePollVoteAddPayload; diff --git a/types/src/gateways/guild.ts b/types/src/gateways/guild.ts index d9968ea3..f389c00a 100644 --- a/types/src/gateways/guild.ts +++ b/types/src/gateways/guild.ts @@ -14,8 +14,8 @@ export interface GatewayGuildBanAddPayload { export type GatewayGuildBanRemovePayload = GatewayGuildBanAddPayload; export interface GatewayGuildEmojisUpdatePayload { - guild_id: snowflake; emojis: EmojiPayload[]; + guild_id: snowflake; } export interface GatewayGuildStickersUpdatePayload { @@ -37,27 +37,27 @@ export interface GatewayGuildMemberRemovePayload { } export interface GatewayGuildMemberUpdatePayload { - guild_id: snowflake; - roles: snowflake[]; - user: UserPayload; - nick?: string | null; - avatar: string | null; - joined_at: string | null; - premium_since?: string | null; + avatar: null | string; + communication_disabled_until?: null | string; deaf?: boolean; + guild_id: snowflake; + joined_at: null | string; mute?: boolean; + nick?: null | string; pending?: boolean; - communication_disabled_until?: string | null; + premium_since?: null | string; + roles: snowflake[]; + user: UserPayload; } export interface GatewayGuildMemberChunkPayload { + chunk_count: number; + chunk_index: number; guild_id: snowflake; members: GuildMemberPayload[]; - chunk_index: number; - chunk_count: number; + nonce?: string; not_found?: string[]; presences?: EditGatewayPresencePayload; - nonce?: string; } export interface GatewayGuildRoleCreatePayload { diff --git a/types/src/gateways/integration.ts b/types/src/gateways/integration.ts index f4d7a104..7e8b153d 100644 --- a/types/src/gateways/integration.ts +++ b/types/src/gateways/integration.ts @@ -8,7 +8,7 @@ export interface GatewayIntegrationCreatePayload extends IntegrationPayload { export type GatewayIntegrationUpdatePayload = GatewayIntegrationCreatePayload; export interface GatewayIntegrationDeletePayload { - id: string; - guild_id: snowflake; application_id?: snowflake; + guild_id: snowflake; + id: string; } diff --git a/types/src/gateways/invite.ts b/types/src/gateways/invite.ts index c4c0d737..080cde50 100644 --- a/types/src/gateways/invite.ts +++ b/types/src/gateways/invite.ts @@ -11,15 +11,15 @@ export interface GatewayInviteCreatePayload { inviter?: UserPayload; max_age: number; max_uses: number; + target_application?: ApplicationPayload; target_type?: InviteTargetType; target_user?: UserPayload; - target_application?: ApplicationPayload; temporary: boolean; uses: number; } export interface GatewayInviteDeletePayload { channel_id: snowflake; - guild_id?: snowflake; code: string; + guild_id?: snowflake; } diff --git a/types/src/gateways/message.ts b/types/src/gateways/message.ts index 1550e0a7..ebecf736 100644 --- a/types/src/gateways/message.ts +++ b/types/src/gateways/message.ts @@ -3,25 +3,25 @@ import { EmojiPayload } from "../emojis/emoij.ts"; import { GuildMemberPayload } from "../guilds/member.ts"; export interface GatewayMessageDeletePayload { - id: snowflake; channel_id: snowflake; guild_id?: snowflake; + id: snowflake; } export interface GatewayMessageDeleteBulkPayload { - ids: snowflake; channel_id: snowflake; guild_id?: snowflake; + ids: snowflake; } export interface GatewayMessageReactionAddPayload { - user_id: snowflake; channel_id: snowflake; - message_id: snowflake; + emoji: EmojiPayload; guild_id?: snowflake; member?: GuildMemberPayload; - emoji: EmojiPayload; message_author_id?: snowflake; + message_id: snowflake; + user_id: snowflake; } export type GatewayMessageReactionRemovePayload = Omit< GatewayMessageReactionAddPayload, @@ -30,8 +30,8 @@ export type GatewayMessageReactionRemovePayload = Omit< export interface GatewayMessageReactionRemoveAllPayload { channel_id: snowflake; - message_id: snowflake; guild_id?: snowflake; + message_id: snowflake; } export interface GatewayMessageReactionRemoveEmojiPayload diff --git a/types/src/gateways/thread.ts b/types/src/gateways/thread.ts index e8d11939..2b406783 100644 --- a/types/src/gateways/thread.ts +++ b/types/src/gateways/thread.ts @@ -5,10 +5,10 @@ import { import { snowflake } from "../common.ts"; export interface GatewayThreadListSyncPayload { - guild_id: snowflake; channel_ids?: snowflake[]; - threads: GuildThreadChannelPayload[]; + guild_id: snowflake; members: ThreadMemberPayload[]; + threads: GuildThreadChannelPayload[]; } export interface GatewayThreadMemberUpdatePayload extends ThreadMemberPayload { @@ -16,17 +16,17 @@ export interface GatewayThreadMemberUpdatePayload extends ThreadMemberPayload { } export interface GatewayThreadMembersUpdatePayload { - id: snowflake; + added_members?: ThreadMemberPayload[]; guild_id: snowflake; + id: snowflake; member_count: number; - added_members?: ThreadMemberPayload[]; removed_member_ids?: snowflake[]; } export interface GatewayScheduledEventUserAddPayload { + guild_id: snowflake; guild_scheduled_event_id: snowflake; user_id: snowflake; - guild_id: snowflake; } export type GatewayScheduledEventUserRemovePayload = diff --git a/types/src/guildTemplates/template.ts b/types/src/guildTemplates/template.ts index 473f7fa1..e92899ad 100644 --- a/types/src/guildTemplates/template.ts +++ b/types/src/guildTemplates/template.ts @@ -4,29 +4,29 @@ import { UserPayload } from "../users/user.ts"; export interface GuildTemplatePayload { code: string; - name: string; - description: string | null; - usage_count: number; - creator_id: snowflake; - creator: UserPayload; created_at: string; - updated_at: string; - source_guild_id: snowflake; - serialized_source_guild: GuildPayload; + creator: UserPayload; + creator_id: snowflake; + description: null | string; is_dirty: boolean | null; + name: string; + serialized_source_guild: GuildPayload; + source_guild_id: snowflake; + updated_at: string; + usage_count: number; } export interface CreateGuildFromGuildTemplatePayload { - name: string; icon?: string; + name: string; } export interface CreateGuildTemplatePayload { + description?: null | string; name: string; - description?: string | null; } export interface EditGuildTemplatePayload { + description?: null | string; name?: string; - description?: string | null; } diff --git a/types/src/guilds/ban.ts b/types/src/guilds/ban.ts index 33ed74c8..b2c4afd1 100644 --- a/types/src/guilds/ban.ts +++ b/types/src/guilds/ban.ts @@ -3,8 +3,8 @@ import { Reasonable } from "../etc/reasonable.ts"; import { UserPayload } from "../users/user.ts"; export interface GuildBanPayload { + reason: null | string; user: UserPayload; - reason: string | null; } export interface CreateGuildBanPayload extends Reasonable { @@ -12,14 +12,14 @@ export interface CreateGuildBanPayload extends Reasonable { } export interface GetGuildBansParams { - limit?: number; - before?: snowflake; after?: snowflake; + before?: snowflake; + limit?: number; } export interface CreateBulkGuildBanPayload extends Reasonable { - user_ids: snowflake[]; delete_message_seconds?: number; + user_ids: snowflake[]; } export interface BulkGuildBanResponsePayload { diff --git a/types/src/guilds/etc.ts b/types/src/guilds/etc.ts index a7759880..31bd4512 100644 --- a/types/src/guilds/etc.ts +++ b/types/src/guilds/etc.ts @@ -10,48 +10,48 @@ import { UserPayload } from "../users/user.ts"; import { GuildFeature, MFALevel, PartialGuildChannelPayload } from "./guild.ts"; export interface GuildPreviewPayload { - id: snowflake; - name: string; - icon: string | null; - splash: string | null; - discovery_splash: string | null; - emojis: EmojiPayload[]; - features: GuildFeature[]; approximate_member_count: number; approximate_presence_count: number; - description: string | null; + description: null | string; + discovery_splash: null | string; + emojis: EmojiPayload[]; + features: GuildFeature[]; + icon: null | string; + id: snowflake; + name: string; + splash: null | string; stickers: StickerPayload[]; } export interface GuildWidgetSettingsPayload { + channel_id: null | snowflake; enabled: boolean; - channel_id: snowflake | null; } export interface GuildWidgetPayload { - id: snowflake; - name: string; - instant_invite: string | null; channels: PartialGuildChannelPayload[]; + id: snowflake; + instant_invite: null | string; members: UserPayload[]; + name: string; presence_count: number; } export interface WelcomeScreenChannelPayload { channel_id: snowflake; description: string; - emoji_id: snowflake | null; - emoji_name: string | null; + emoji_id: null | snowflake; + emoji_name: null | string; } export interface WelcomeScreenPayload { - description: string | null; + description: null | string; welcome_channels: WelcomeScreenChannelPayload[]; } export interface ActiveThreadsPayload { - threads: GuildThreadChannelPayload[]; members: ThreadMemberPayload[]; + threads: GuildThreadChannelPayload[]; } export interface GetGuildPruneCountParams { @@ -60,32 +60,32 @@ export interface GetGuildPruneCountParams { } export interface BeginGuildPrunePayload extends Reasonable { - days?: number; compute_prune_count?: boolean; + days?: number; include_roles?: snowflake[]; } type GuildWidgetImageStyle = - | "shield" | "banner1" | "banner2" | "banner3" - | "banner4"; + | "banner4" + | "shield"; export interface GetGuildWidgetImageParams { style?: GuildWidgetImageStyle; } export interface EditWelcomeScreenPayload extends Reasonable { + description?: null | string; enabled?: boolean | null; - welcome_channels?: WelcomeScreenChannelPayload[] | null; - description?: string | null; + welcome_channels?: null | WelcomeScreenChannelPayload[]; } export interface EditCurrentUserVoiceStatePayload { channel_id?: snowflake; + request_to_speak_timestamp?: null | string; suppress?: boolean; - request_to_speak_timestamp?: string | null; } export interface EditUserVoiceStatePayload { diff --git a/types/src/guilds/guild.ts b/types/src/guilds/guild.ts index f860729a..b049ea25 100644 --- a/types/src/guilds/guild.ts +++ b/types/src/guilds/guild.ts @@ -23,60 +23,60 @@ import { GuildMemberPayload } from "./member.ts"; import { RolePayload } from "./role.ts"; export interface GuildPayload { - id: snowflake; - name: string; - icon: string | null; - icon_hash?: string | null; - splash: string | null; - discovery_splash: string | null; - owner?: boolean; - owner_id: snowflake; - permissions?: string; - region?: string | null; - afk_channel_id: snowflake | null; + afk_channel_id: null | snowflake; afk_timeout: number; - widget_enabled: boolean; - widget_channel_id?: snowflake | null; - verification_level: VerificationLevel; + application_id: null | snowflake; + approximate_member_count?: number; + approximate_presence_count?: number; + banner: null | string; + channels?: GuildChannelPayload[]; default_message_notifications: DefaultMessageNotificationLevel; - explicit_content_filter: ExplicitContentFilterLevel; - roles: RolePayload[]; + description: null | string; + discovery_splash: null | string; emojis: EmojiPayload[]; + explicit_content_filter: ExplicitContentFilterLevel; features: GuildFeature[]; - mfa_level: MFALevel; - application_id: snowflake | null; - system_channel_id: snowflake | null; - system_channel_flags: number; - rules_channel_id: snowflake | null; + guild_scheduled_events?: ScheduledEventPayload[]; + icon: null | string; + icon_hash?: null | string; + id: snowflake; joined_at?: string; large?: boolean; - unavailable?: boolean; - member_count?: number; - voice_states?: VoiceStatePayload[]; - members?: GuildMemberPayload[]; - channels?: GuildChannelPayload[]; - threads?: GuildThreadChannelPayload[]; - presences?: GatewayPresenceUpdatePayload[]; - max_presences?: number | null; max_members?: number; - vanity_url_code: string | null; - description: string | null; - banner: string | null; - premium_tier: PremiumTier; - premium_subscription_count?: number; - preferred_locale: Locales; - public_updates_channel_id: snowflake | null; - max_video_channel_users?: number; + max_presences?: null | number; max_stage_video_channel_users?: number; - approximate_member_count?: number; - approximate_presence_count?: number; - welcome_screen?: WelcomeScreenPayload; + max_video_channel_users?: number; + member_count?: number; + members?: GuildMemberPayload[]; + mfa_level: MFALevel; + name: string; nsfw_level: GuildNSFWLevel; + owner?: boolean; + owner_id: snowflake; + permissions?: string; + preferred_locale: Locales; + premium_progress_bar_enabled: boolean; + premium_subscription_count?: number; + premium_tier: PremiumTier; + presences?: GatewayPresenceUpdatePayload[]; + public_updates_channel_id: null | snowflake; + region?: null | string; + roles: RolePayload[]; + rules_channel_id: null | snowflake; + safety_alerts_channel_id: null | snowflake; + splash: null | string; stage_instances?: StageInstancePayload[]; stickers?: StickerPayload[]; - guild_scheduled_events?: ScheduledEventPayload[]; - premium_progress_bar_enabled: boolean; - safety_alerts_channel_id: snowflake | null; + system_channel_flags: number; + system_channel_id: null | snowflake; + threads?: GuildThreadChannelPayload[]; + unavailable?: boolean; + vanity_url_code: null | string; + verification_level: VerificationLevel; + voice_states?: VoiceStatePayload[]; + welcome_screen?: WelcomeScreenPayload; + widget_channel_id?: null | snowflake; + widget_enabled: boolean; } export enum DefaultMessageNotificationLevel { @@ -138,13 +138,14 @@ export enum GuildFeature { DEVELOPER_SUPPORT_SERVER = "DEVELOPER_SUPPORT_SERVER", DISCOVERABLE = "DISCOVERABLE", FEATURABLE = "FEATURABLE", - INVITES_DISABLED = "INVITES_DISABLED", INVITE_SPLASH = "INVITE_SPLASH", + INVITES_DISABLED = "INVITES_DISABLED", MEMBER_VERIFICATION_GATE_ENABLED = "MEMBER_VERIFICATION_GATE_ENABLED", MORE_STICKERS = "MORE_STICKERS", NEWS = "NEWS", PARTNERED = "PARTNERED", PREVIEW_ENABLED = "PREVIEW_ENABLED", + RAID_ALERTS_DISABLED = "RAID_ALERTS_DISABLED", ROLE_ICONS = "ROLE_ICONS", ROLE_SUBSCRIPTIONS_AVAILABLE_FOR_PURCHASE = "ROLE_SUBSCRIPTIONS_AVAILABLE_FOR_PURCHASE", @@ -154,28 +155,27 @@ export enum GuildFeature { VERIFIED = "VERIFIED", VIP_REGIONS = "VIP_REGIONS", WELCOME_SCREEN_ENABLED = "WELCOME_SCREEN_ENABLED", - RAID_ALERTS_DISABLED = "RAID_ALERTS_DISABLED", } export interface PartialGuildChannelPayload { - name: string; - type: ChannelType; id?: number; + name: string; parent_id?: number; + type: ChannelType; } export interface CreateGuildPayload { - name: string; - icon?: string | null; - verification_level?: VerificationLevel; + afk_channel_id?: snowflake; + afk_timeout?: number; + channels?: PartialGuildChannelPayload[]; default_message_notifications?: DefaultMessageNotificationLevel; explicit_content_filter?: ExplicitContentFilterLevel; + icon?: null | string; + name: string; roles?: RolePayload[]; - channels?: PartialGuildChannelPayload[]; - afk_channel_id?: snowflake; - afk_timeout?: number; - system_channel_id?: snowflake; system_channel_flags?: SystemChannelFlags; + system_channel_id?: snowflake; + verification_level?: VerificationLevel; } export interface GetGuildParams { @@ -183,52 +183,52 @@ export interface GetGuildParams { } export interface EditGuildPayload extends Reasonable { - name?: string; - verification_level?: VerificationLevel | null; + afk_channel_id?: null | snowflake; + afk_timeout?: number; + banner?: null | string; default_message_notifications?: DefaultMessageNotificationLevel | null; + description?: null | string; + discovery_splash?: null | string; explicit_content_filter?: ExplicitContentFilterLevel | null; - afk_channel_id?: snowflake | null; - afk_timeout?: number; - icon?: string | null; - owner_id?: snowflake; - splash?: string | null; - discovery_splash?: string | null; - banner?: string | null; - system_channel_id?: snowflake | null; - system_channel_flags?: SystemChannelFlags; - rules_channel_id?: snowflake | null; - public_updates_channel_id?: snowflake | null; - preferred_locale?: string | null; features?: GuildFeature[]; - description?: string | null; + icon?: null | string; + name?: string; + owner_id?: snowflake; + preferred_locale?: null | string; premium_progress_bar_enabled?: boolean; - safety_alerts_channel_id?: snowflake | null; + public_updates_channel_id?: null | snowflake; + rules_channel_id?: null | snowflake; + safety_alerts_channel_id?: null | snowflake; + splash?: null | string; + system_channel_flags?: SystemChannelFlags; + system_channel_id?: null | snowflake; + verification_level?: null | VerificationLevel; } export interface CreateGuildChannelPayload extends Reasonable { - name: string; - type?: ChannelType; - topic?: string; + available_tags?: GuildForumTagPayload[]; bitrate?: number; - user_limit?: number; - rate_limit_per_user?: number; - position?: number; - permission_overwrites?: OverwritePayload[]; - parent_id?: snowflake; - nsfw?: boolean; - rtc_region?: VoiceRegionPayload; - video_quality_mode?: VideoQualityModes; default_auto_archive_duration?: number; + default_forum_layout?: ForumLayout; default_reaction_emoji?: ForumDefaultReactionPayload; - available_tags?: GuildForumTagPayload[]; default_sort_order?: ForumSortOrder; - default_forum_layout?: ForumLayout; default_thread_rate_limit_per_user?: number; + name: string; + nsfw?: boolean; + parent_id?: snowflake; + permission_overwrites?: OverwritePayload[]; + position?: number; + rate_limit_per_user?: number; + rtc_region?: VoiceRegionPayload; + topic?: string; + type?: ChannelType; + user_limit?: number; + video_quality_mode?: VideoQualityModes; } export interface EditGuildChannelPositionPayload { id: snowflake; - position?: number | null; lock_permissions?: boolean | null; - parent_id?: snowflake | null; + parent_id?: null | snowflake; + position?: null | number; } diff --git a/types/src/guilds/integration.ts b/types/src/guilds/integration.ts index c8935490..a3d191ac 100644 --- a/types/src/guilds/integration.ts +++ b/types/src/guilds/integration.ts @@ -13,28 +13,28 @@ export interface IntegrationAccountPayload { } export interface IntegrationApplicationPayload { + bot?: UserPayload; + description: string; + icon: null | string; id: snowflake; name: string; - icon: string | null; - description: string; - bot?: UserPayload; } export interface IntegrationPayload { - id: snowflake; - name: string; - type: string; - enabled: boolean; - syncing?: boolean; - role_id?: snowflake; + account: IntegrationAccountPayload; + application?: IntegrationApplicationPayload; enable_emoticons?: boolean; + enabled: boolean; expire_behavior?: IntegrationExpireBehaviors; expire_grace_period?: number; - user?: UserPayload; - account: IntegrationAccountPayload; - synced_at?: string; - subscriber_count?: number; + id: snowflake; + name: string; revoked?: boolean; - application?: IntegrationApplicationPayload; + role_id?: snowflake; scopes?: Scopes[]; + subscriber_count?: number; + synced_at?: string; + syncing?: boolean; + type: string; + user?: UserPayload; } diff --git a/types/src/guilds/member.ts b/types/src/guilds/member.ts index 0f35a70c..67d4efef 100644 --- a/types/src/guilds/member.ts +++ b/types/src/guilds/member.ts @@ -3,55 +3,55 @@ import { Reasonable } from "../etc/reasonable.ts"; import { UserPayload } from "../users/user.ts"; export interface GuildMemberPayload { - user?: UserPayload; - nick?: string | null; - avatar?: string | null; - roles: snowflake[]; - joined_at: string; - premium_since?: string | null; + avatar?: null | string; + communication_disabled_until?: null | string; deaf: boolean; - mute: boolean; flags: number; + joined_at: string; + mute: boolean; + nick?: null | string; pending?: boolean; permissions?: string; - communication_disabled_until?: string | null; + premium_since?: null | string; + roles: snowflake[]; + user?: UserPayload; } export enum GuildMemberFlags { - DID_REJOIN = 1, COMPLETED_ONBOARDING = 1 << 1, BYPASSES_VERIFICATION = 1 << 2, STARTED_ONBOARDING = 1 << 3, + DID_REJOIN = 1, } export interface ListGuildMembersParams { - limit?: number; after?: snowflake; + limit?: number; } export interface SearchGuildMembersParams { - query: string; limit?: number; + query: string; } export interface AddGuildMemberPayload { access_token: string; + deaf?: boolean; + mute?: boolean; nick?: string; roles?: snowflake[]; - mute?: boolean; - deaf?: boolean; } export interface EditGuildMemberPayload extends Reasonable { - nick?: string | null; - roles?: snowflake[] | null; - mute?: boolean | null; + channel_id?: null | snowflake; + communication_disabled_until?: null | string; deaf?: boolean | null; - channel_id?: snowflake | null; - communication_disabled_until?: string | null; - flags?: number | null; + flags?: null | number; + mute?: boolean | null; + nick?: null | string; + roles?: null | snowflake[]; } export interface EditGuildCurrentMemberPayload extends Reasonable { - nick?: string | null; + nick?: null | string; } diff --git a/types/src/guilds/onboarding.ts b/types/src/guilds/onboarding.ts index 934c2f3f..ba80d8f0 100644 --- a/types/src/guilds/onboarding.ts +++ b/types/src/guilds/onboarding.ts @@ -3,11 +3,11 @@ import { EmojiPayload } from "../emojis/emoij.ts"; import { Reasonable } from "../etc/reasonable.ts"; export interface GuildOnboardingPayload { - guild_id: snowflake; - prompts: GuildOnboardingPromptPayload[]; default_channel_ids: snowflake[]; enabled: boolean; + guild_id: snowflake; mode: GuildOnboardingMode; + prompts: GuildOnboardingPromptPayload[]; } export enum GuildOnboardingMode { @@ -17,24 +17,24 @@ export enum GuildOnboardingMode { export interface GuildOnboardingPromptPayload { id: snowflake; - type: GuildOnboardingPromptType; + in_onboarding: boolean; options: GuildOnboardingPromptOptions; - title: string; - single_select: boolean; required: boolean; - in_onboarding: boolean; + single_select: boolean; + title: string; + type: GuildOnboardingPromptType; } export interface GuildOnboardingPromptOptions { - id: snowflake; channel_ids: snowflake[]; - role_ids: snowflake[]; + description: null | string; emoji?: EmojiPayload; + emoji_animated?: boolean; emoji_id?: snowflake; emoji_name?: string; - emoji_animated?: boolean; + id: snowflake; + role_ids: snowflake[]; title: string; - description: string | null; } export enum GuildOnboardingPromptType { @@ -43,8 +43,8 @@ export enum GuildOnboardingPromptType { } export interface EditGuildOnboardingPayload extends Reasonable { - prompts?: GuildOnboardingPromptPayload[]; default_channel_ids?: snowflake[]; enabled?: boolean; mode?: GuildOnboardingMode; + prompts?: GuildOnboardingPromptPayload[]; } diff --git a/types/src/guilds/role.ts b/types/src/guilds/role.ts index 8b1c70a4..0d53e466 100644 --- a/types/src/guilds/role.ts +++ b/types/src/guilds/role.ts @@ -8,39 +8,39 @@ export interface RoleTagsPayload { } export interface RolePayload { - id: snowflake; - name: string; color: number; hoist: boolean; - icon?: string | null; - unicode_emoji?: string | null; - position: number; - permissions: string; + icon?: null | string; + id: snowflake; managed: boolean; + name: string; + permissions: string; + position: number; tags?: RoleTagsPayload; + unicode_emoji?: null | string; } export interface CreateGuildRolePayload extends Reasonable { - name?: string; - permissions?: string; color?: number; hoist?: boolean; - icon?: string | null; - unicode_emoji?: string | null; + icon?: null | string; mentionable?: boolean; + name?: string; + permissions?: string; + unicode_emoji?: null | string; } export interface EditGuildRolePositionPayload extends Reasonable { id: snowflake; - position?: number | null; + position?: null | number; } export interface EditGuildRolePayload extends Reasonable { - name?: string | null; - permissions?: string | null; - color?: number | null; + color?: null | number; hoist?: boolean | null; - icon?: string | null; - unicode_emoji?: string | null; + icon?: null | string; mentionable?: boolean | null; + name?: null | string; + permissions?: null | string; + unicode_emoji?: null | string; } diff --git a/types/src/interactions/command.ts b/types/src/interactions/command.ts index e848148f..8f2b9332 100644 --- a/types/src/interactions/command.ts +++ b/types/src/interactions/command.ts @@ -4,22 +4,22 @@ import { snowflake } from "../common.ts"; import { Locales } from "../etc/locales.ts"; export interface ApplicationCommandPayload { - id: snowflake; - type?: ApplicationCommandType; application_id: snowflake; - guild_id?: snowflake; - name: string; - name_localizations?: Record; + contexts?: ApplicationCommandContextType[] | null; + default_member_permissions: null | string; + default_permission?: boolean | null; description: string; - description_localizations?: Record; - options?: ApplicationCommandOptionPayload[]; - default_member_permissions: string | null; + description_localizations?: Record; dm_permission?: boolean; - default_permission?: boolean | null; + guild_id?: snowflake; + id: snowflake; + integration_types?: ApplicationIntegrationType[]; + name: string; + name_localizations?: Record; nsfw?: boolean; + options?: ApplicationCommandOptionPayload[]; + type?: ApplicationCommandType; version: snowflake; - contexts?: ApplicationCommandContextType[] | null; - integration_types?: ApplicationIntegrationType[]; } export enum ApplicationCommandContextType { @@ -35,20 +35,20 @@ export enum ApplicationCommandType { } export interface ApplicationCommandOptionPayload { - type: ApplicationCommandOptionType; - name: string; - name_localizations?: Record; - description: string; - description_localizations?: Record; - required?: boolean; - choices?: ApplicationCommandOptionChoicePayload[]; - options?: ApplicationCommandOptionPayload[]; + autocomplete?: boolean; channel_types?: ChannelType[]; - min_value?: number; + choices?: ApplicationCommandOptionChoicePayload[]; + description: string; + description_localizations?: Record; + max_length?: number; max_value?: number; min_length?: number; - max_length?: number; - autocomplete?: boolean; + min_value?: number; + name: string; + name_localizations?: Record; + options?: ApplicationCommandOptionPayload[]; + required?: boolean; + type: ApplicationCommandOptionType; } export enum ApplicationCommandOptionType { @@ -67,29 +67,29 @@ export enum ApplicationCommandOptionType { export interface ApplicationCommandOptionChoicePayload { name: string; - name_localizations?: Record; - value: string | number; + name_localizations?: Record; + value: number | string; } export interface ApplicationCommandInteractionDataOptionPayload { + focused?: boolean; name: string; - type: ApplicationCommandOptionType; - value?: string | number; options?: ApplicationCommandInteractionDataOptionPayload[]; - focused?: boolean; + type: ApplicationCommandOptionType; + value?: number | string; } export interface GuildApplicationCommandPermissionPayload { - id: snowflake; application_id: snowflake; guild_id: snowflake; + id: snowflake; permissions: ApplicationCommandPermissions[]; } export interface ApplicationCommandPermissions { id: snowflake; - type: ApplicationCommandPermissionType; permission: boolean; + type: ApplicationCommandPermissionType; } export enum ApplicationCommandPermissionType { @@ -106,74 +106,74 @@ export type GetGuildApplicationCommandsParams = GetGlobalApplicationCommandsParams; export interface CreateGlobalApplicationCommandPayload { - name: string; - name_localizations?: Record; + contexts?: ApplicationCommandContextType[]; + default_member_permissions?: null | string; + default_permission?: boolean; description: string; - description_localizations?: Record; - options?: ApplicationCommandOptionPayload[]; - default_member_permissions?: string | null; + description_localizations?: Record; dm_permission?: boolean | null; - default_permission?: boolean; - type?: ApplicationCommandType; - nsfw?: boolean; - contexts?: ApplicationCommandContextType[]; integration_types?: ApplicationIntegrationType[]; + name: string; + name_localizations?: Record; + nsfw?: boolean; + options?: ApplicationCommandOptionPayload[]; + type?: ApplicationCommandType; } export interface EditGlobalApplicationCommandPayload { - name?: string; - name_localizations?: Record; + contexts?: ApplicationCommandContextType[]; + default_member_permissions?: null | string; + default_permission?: boolean; description?: string; - description_localizations?: Record; - options?: ApplicationCommandOptionPayload[]; - default_member_permissions?: string | null; + description_localizations?: Record; dm_permission?: boolean | null; - default_permission?: boolean; - nsfw?: boolean; - contexts?: ApplicationCommandContextType[]; integration_types?: ApplicationIntegrationType[]; + name?: string; + name_localizations?: Record; + nsfw?: boolean; + options?: ApplicationCommandOptionPayload[]; } export type BulkOverwriteGlobalApplicationCommandsPayload = CreateGlobalApplicationCommandPayload[]; export interface CreateGuildApplicationCommandPayload { - name: string; - name_localizations?: Record; + default_member_permissions?: null | string; + default_permission?: boolean; description: string; - description_localizations?: Record; + description_localizations?: Record; + name: string; + name_localizations?: Record; + nsfw?: boolean; options?: ApplicationCommandOptionPayload[]; - default_member_permissions?: string | null; - default_permission?: boolean; type?: ApplicationCommandType; - nsfw?: boolean; } export interface EditGuildApplicationCommandPayload { - name?: string; - name_localizations?: Record; - description?: string; - description_localizations?: Record; - options?: ApplicationCommandOptionPayload[]; - default_member_permissions?: string | null; + default_member_permissions?: null | string; default_permission?: boolean; + description?: string; + description_localizations?: Record; + name?: string; + name_localizations?: Record; nsfw?: boolean; + options?: ApplicationCommandOptionPayload[]; } export interface BulkOverwriteGuildApplicationCommandsPayload { - id?: snowflake; - name: string; - name_localizations?: Record; + contexts?: ApplicationCommandContextType[]; + default_member_permissions?: null | string; + default_permission?: boolean; description: string; - description_localizations?: Record; - options?: ApplicationCommandOptionPayload[]; - default_member_permissions?: string | null; + description_localizations?: Record; dm_permission?: boolean | null; - default_permission?: boolean; - contexts?: ApplicationCommandContextType[]; + id?: snowflake; integration_types?: ApplicationIntegrationType[]; - type?: ApplicationCommandType; + name: string; + name_localizations?: Record; nsfw?: boolean; + options?: ApplicationCommandOptionPayload[]; + type?: ApplicationCommandType; } export interface EditApplicationCommandPermissionsPayload { diff --git a/types/src/interactions/components.ts b/types/src/interactions/components.ts index 2732557d..30978ca0 100644 --- a/types/src/interactions/components.ts +++ b/types/src/interactions/components.ts @@ -18,47 +18,47 @@ export enum ComponentType { } export interface ButtonComponentPayload extends ComponentPayload { - type: ComponentType.BUTTON; custom_id?: string; disabled?: boolean; - style: ButtonStylesType; - label?: string; emoji?: EmojiPayload; + label?: string; + style: ButtonStylesType; + type: ComponentType.BUTTON; url?: string; } export interface SelectMenusComponentPayload extends ComponentPayload { - type: - | ComponentType.STRING_SELECT - | ComponentType.USER_SELECT - | ComponentType.ROLE_SELECT - | ComponentType.MENTIONABLE_SELECT - | ComponentType.CHANNEL_SELECT; - custom_id: string; - options?: SelectOptionsPayload; channel_types?: ChannelType[]; - placeholder?: string; + custom_id: string; default_values?: SelectDefaultValuePayload[]; - min_values?: number; - max_values?: number; disabled?: boolean; + max_values?: number; + min_values?: number; + options?: SelectOptionsPayload; + placeholder?: string; + type: + | ComponentType.CHANNEL_SELECT + | ComponentType.MENTIONABLE_SELECT + | ComponentType.ROLE_SELECT + | ComponentType.STRING_SELECT + | ComponentType.USER_SELECT; } export interface ActionRowsComponentPayload extends ComponentPayload { - type: ComponentType.ACTION_ROW; components?: ComponentPayload[]; + type: ComponentType.ACTION_ROW; } export interface TextInputComponentPayload extends ComponentPayload { - type: ComponentType.TEXT_INPUT; custom_id: string; - style: TextInputStyles; label: string; - min_length?: number; max_length?: number; + min_length?: number; + placeholder?: string; required?: boolean; + style: TextInputStyles; + type: ComponentType.TEXT_INPUT; value?: string; - placeholder?: string; } export enum TextInputStyles { @@ -75,14 +75,14 @@ export enum ButtonStylesType { } export interface SelectOptionsPayload { - label: string; - value: string; + default?: boolean; descripion?: string; emoji?: EmojiPayload; - default?: boolean; + label: string; + value: string; } export interface SelectDefaultValuePayload { id: snowflake; - type: "user" | "role" | "channel"; + type: "channel" | "role" | "user"; } diff --git a/types/src/interactions/interaction.ts b/types/src/interactions/interaction.ts index 8a3fc813..4fb68800 100644 --- a/types/src/interactions/interaction.ts +++ b/types/src/interactions/interaction.ts @@ -23,28 +23,28 @@ import { } from "./components.ts"; export interface InteractionPayload { - id: snowflake; + app_permissions?: string; application_id: snowflake; - type: InteractionType; + authorizing_integration_owners: Record; + channel?: ChannelPayload; + channel_id?: snowflake; + context: ApplicationCommandContextType; data?: | ApplicationCommandInteractionDataPayload | ComponentInteractionDataPayload | ModalSubmitDataPayload | ResolvedDataPayload; + entitlements: EntitlementPayload[]; guild_id?: snowflake; - channel?: ChannelPayload; - channel_id?: snowflake; + guild_locale?: Locales; + id: snowflake; + locale?: Locales; member?: GuildMemberPayload; - user?: UserPayload; + message?: MessagePayload; token: string; + type: InteractionType; + user?: UserPayload; version: 1; - message?: MessagePayload; - app_permissions?: string; - locale?: Locales; - guild_locale?: Locales; - entitlements: EntitlementPayload[]; - authorizing_integration_owners: Record; - context: ApplicationCommandContextType; } export enum InteractionType { @@ -56,50 +56,50 @@ export enum InteractionType { } export interface ApplicationCommandInteractionDataPayload { + guild_id?: snowflake; id: snowflake; name: string; - type: ApplicationCommandType; - resolved?: ResolvedDataPayload; options?: ApplicationCommandInteractionDataOptionPayload[]; - guild_id?: snowflake; + resolved?: ResolvedDataPayload; target_id?: snowflake; + type: ApplicationCommandType; } export interface ComponentInteractionDataPayload { - custom_id?: string; component_type?: ComponentType; - values?: SelectOptionsPayload[]; + custom_id?: string; resolved?: ResolvedDataPayload; + values?: SelectOptionsPayload[]; } export interface ModalSubmitDataPayload { - custom_id?: string; components?: ComponentPayload[]; + custom_id?: string; } export interface ResolvedDataPayload { - users?: Record; - members?: Record; - roles?: Record; + attachments?: Record; channels?: Record; + members?: Record; messages?: Record; - attachments?: Record; + roles?: Record; + users?: Record; } export interface MessageInteractionPayload { id: snowflake; - type: InteractionType; + member?: GuildMemberPayload; name: string; + type: InteractionType; user: UserPayload; - member?: GuildMemberPayload; } export interface InteractionResponsePayload { - type: InteractionCallbackType; data?: - | MessageInteractionCallbackData | AutocompleteInteractionCallbackData + | MessageInteractionCallbackData | ModalInteractionCallbackPayload; + type: InteractionCallbackType; } export enum InteractionCallbackType { @@ -114,14 +114,14 @@ export enum InteractionCallbackType { } export interface MessageInteractionCallbackData { - tts?: boolean; + allowed_mentions?: AllowedMentionsPayload; + attachments?: AttachmentPayload[]; + components?: ComponentPayload[]; content?: string; embeds?: EmbedPayload[]; - allowed_mentions?: AllowedMentionsPayload; flags?: number; - components?: ComponentPayload[]; - attachments?: AttachmentPayload[]; poll?: PollCreateRequestPayload; + tts?: boolean; } export interface AutocompleteInteractionCallbackData { @@ -129,7 +129,7 @@ export interface AutocompleteInteractionCallbackData { } export interface ModalInteractionCallbackPayload { + components: ComponentPayload[]; custom_id: string; title: string; - components: ComponentPayload[]; } diff --git a/types/src/invites/invite.ts b/types/src/invites/invite.ts index 0e193cb6..0e6ac6da 100644 --- a/types/src/invites/invite.ts +++ b/types/src/invites/invite.ts @@ -7,18 +7,18 @@ import { ScheduledEventPayload } from "../scheduledEvent/scheduledEvent.ts"; import { UserPayload } from "../users/user.ts"; export interface InvitePayload { + approximate_member_count?: number; + approximate_presence_count?: number; + channel: ChannelPayload | null; code: string; + expires_at?: null | string; guild?: GuildPayload; - channel: ChannelPayload | null; + guild_scheduled_event?: ScheduledEventPayload; inviter?: UserPayload; + stage_instance?: InviteStageInstancePayload; + target_application?: ApplicationPayload; target_type?: InviteTargetType; target_user?: UserPayload; - target_application?: ApplicationPayload; - approximate_presence_count?: number; - approximate_member_count?: number; - expires_at?: string | null; - stage_instance?: InviteStageInstancePayload; - guild_scheduled_event?: ScheduledEventPayload; } export enum InviteTargetType { @@ -34,15 +34,15 @@ export interface InviteStageInstancePayload { } export interface InviteMetadataPayload { - uses: number; - max_uses: number; + created_at: string; max_age: number; + max_uses: number; temporary: boolean; - created_at: string; + uses: number; } export interface GetInviteParams { + guild_scheduled_event_id?: snowflake; with_counts?: boolean; with_expiration?: boolean; - guild_scheduled_event_id?: snowflake; } diff --git a/types/src/poll/poll.ts b/types/src/poll/poll.ts index b2dd7b8d..10bf719b 100644 --- a/types/src/poll/poll.ts +++ b/types/src/poll/poll.ts @@ -3,20 +3,20 @@ import { EmojiPayload } from "../emojis/emoij.ts"; import { UserPayload } from "../users/user.ts"; export interface PollPayload { - question: PollMediaPayload; - answers: PollAnswerPayload[]; - expiry: string | null; allow_multiselect: boolean; + answers: PollAnswerPayload[]; + expiry: null | string; layout_type: PollLayoutType; + question: PollMediaPayload; results?: PollResultPayload; } export interface PollCreateRequestPayload { - question: PollMediaPayload; + allow_multiselect: boolean; answers: PollAnswerPayload[]; duration: number; - allow_multiselect: boolean; layout_type?: PollLayoutType; + question: PollMediaPayload; } export enum PollLayoutType { @@ -24,8 +24,8 @@ export enum PollLayoutType { } export interface PollMediaPayload { - text?: string; emoji?: EmojiPayload; + text?: string; } export interface PollAnswerPayload { @@ -34,13 +34,13 @@ export interface PollAnswerPayload { } export interface PollResultPayload { - is_finalized: boolean; answer_counts: PollAnswerCountPayload[]; + is_finalized: boolean; } export interface PollAnswerCountPayload { - id: number; count: number; + id: number; me_voted: boolean; } diff --git a/types/src/scheduledEvent/scheduledEvent.ts b/types/src/scheduledEvent/scheduledEvent.ts index b25d4a13..11b8868b 100644 --- a/types/src/scheduledEvent/scheduledEvent.ts +++ b/types/src/scheduledEvent/scheduledEvent.ts @@ -4,22 +4,22 @@ import { GuildMemberPayload } from "../guilds/member.ts"; import { UserPayload } from "../users/user.ts"; export interface ScheduledEventPayload { - id: snowflake; + channel_id: null | snowflake; + creator?: UserPayload; + creator_id?: null | snowflake; + description?: string; + entity_id: null | snowflake; + entity_metadata: ScheduledEventEntityMetadataPayload; + entity_type: ScheduledEventEntityType; guild_id: snowflake; - channel_id: snowflake | null; - creator_id?: snowflake | null; + id: snowflake; + image?: null | string; name: string; - description?: string; - scheduled_start_time: string; - scheduled_end_time: string | null; privacy_level: ScheduledEventPrivacyLevel; + scheduled_end_time: null | string; + scheduled_start_time: string; status: ScheduledEventStatus; - entity_type: ScheduledEventEntityType; - entity_id: snowflake | null; - entity_metadata: ScheduledEventEntityMetadataPayload; - creator?: UserPayload; user_cound?: number; - image?: string | null; } export enum ScheduledEventPrivacyLevel { @@ -45,8 +45,8 @@ export interface ScheduledEventEntityMetadataPayload { export interface ScheduledEventUserPayload { guild_scheduled_event_id: snowflake; - user: UserPayload; member?: GuildMemberPayload; + user: UserPayload; } export interface GetScheduledEventsPayload { @@ -55,14 +55,14 @@ export interface GetScheduledEventsPayload { export interface CreateScheduledEventPayload extends Reasonable { channel_id?: snowflake; + description?: string; entity_metadata?: ScheduledEventEntityMetadataPayload; + entity_type: ScheduledEventEntityType; + image?: string; name: string; privacy_level: ScheduledEventPrivacyLevel; - scheduled_start_time: string; scheduled_end_time?: string; - description?: string; - entity_type: ScheduledEventEntityType; - image?: string; + scheduled_start_time: string; } export interface GetScheduledEventPayload { @@ -70,21 +70,21 @@ export interface GetScheduledEventPayload { } export interface EditScheduledEventPayload extends Reasonable { - channel_id?: snowflake | null; - entity_metadata?: ScheduledEventEntityMetadataPayload | null; + channel_id?: null | snowflake; + description?: null | string; + entity_metadata?: null | ScheduledEventEntityMetadataPayload; + entity_type: ScheduledEventEntityType; + image?: string; name?: string; privacy_level?: ScheduledEventPrivacyLevel; - scheduled_start_time?: string; scheduled_end_time?: string; - description?: string | null; - entity_type: ScheduledEventEntityType; + scheduled_start_time?: string; status?: ScheduledEventStatus; - image?: string; } export interface GetScheduledEventUsersParams { + after?: snowflake; + before?: snowflake; limit?: number; with_member?: boolean; - before?: snowflake; - after?: snowflake; } diff --git a/types/src/stageInstances/stage.ts b/types/src/stageInstances/stage.ts index 8de1aab0..853e934f 100644 --- a/types/src/stageInstances/stage.ts +++ b/types/src/stageInstances/stage.ts @@ -2,13 +2,13 @@ import { snowflake } from "../common.ts"; import { Reasonable } from "../etc/reasonable.ts"; export interface StageInstancePayload { - id: snowflake; - guild_id: snowflake; channel_id: snowflake; - topic: string; - privacy_level: StagePrivacyLevel; discoverable_disabled: boolean; - guild_scheduled_event_id: snowflake | null; + guild_id: snowflake; + guild_scheduled_event_id: null | snowflake; + id: snowflake; + privacy_level: StagePrivacyLevel; + topic: string; } export enum StagePrivacyLevel { @@ -18,13 +18,13 @@ export enum StagePrivacyLevel { export interface CreateStageInstancePayload extends Reasonable { channel_id: snowflake; - topic: string; + guild_scheduled_event_id?: snowflake; privacy_level?: StagePrivacyLevel; send_start_notification?: boolean; - guild_scheduled_event_id?: snowflake; + topic: string; } export interface EditStageInstancePayload extends Reasonable { - topic?: string; privacy_level?: StagePrivacyLevel; + topic?: string; } diff --git a/types/src/stickers/sticker.ts b/types/src/stickers/sticker.ts index 68072c16..9b374b5d 100644 --- a/types/src/stickers/sticker.ts +++ b/types/src/stickers/sticker.ts @@ -3,17 +3,17 @@ import { Reasonable } from "../etc/reasonable.ts"; import { UserPayload } from "../users/user.ts"; export interface StickerPayload { + available?: boolean; + description: null | string; + format_type: StickerFormatType; + guild_id?: snowflake; id: snowflake; - pack_id?: snowflake; name: string; - description: string | null; + pack_id?: snowflake; + sort_value?: number; tags: string; type: StickerType; - format_type: StickerFormatType; - available?: boolean; - guild_id?: snowflake; user?: UserPayload; - sort_value?: number; } export enum StickerType { @@ -29,19 +29,19 @@ export enum StickerFormatType { } export interface StickerItemPayload { + format_type: StickerFormatType; id: snowflake; name: string; - format_type: StickerFormatType; } export interface StickerPackPayload { + banner_asset_id?: snowflake; + cover_sticker_id?: snowflake; + description: string; id: snowflake; - stickers: StickerPayload[]; name: string; sku_id: snowflake; - cover_sticker_id?: snowflake; - description: string; - banner_asset_id?: snowflake; + stickers: StickerPayload[]; } export interface ListNitroStickerPacksPayload { @@ -49,14 +49,14 @@ export interface ListNitroStickerPacksPayload { } export interface CreateGuildStickerPayload extends Reasonable { - name: string; description: string; - tags: string; file: Blob; + name: string; + tags: string; } export interface EditGuildStickerPayload extends Reasonable { - name?: string; description?: string; + name?: string; tags?: string; } diff --git a/types/src/teams/team.ts b/types/src/teams/team.ts index d18c74b0..87cdcb25 100644 --- a/types/src/teams/team.ts +++ b/types/src/teams/team.ts @@ -2,7 +2,7 @@ import { snowflake } from "../common.ts"; import { UserPayload } from "../users/user.ts"; export interface TeamPayload { - icon: string | null; + icon: null | string; id: snowflake; members: TeamMemberPayload[]; name: string; @@ -11,9 +11,9 @@ export interface TeamPayload { export interface TeamMemberPayload { membership_state: MembershipState; + role: string; team_id: snowflake; user: UserPayload; - role: string; } export enum MembershipState { diff --git a/types/src/users/connection.ts b/types/src/users/connection.ts index a7109133..49086af9 100644 --- a/types/src/users/connection.ts +++ b/types/src/users/connection.ts @@ -15,8 +15,8 @@ export enum Services { PLAYSTATION_NETWORK = "playstation", REDDIT = "reddit", RIOT_GAMES = "riotgames", - SPOTIFY = "spotify", SKYPE = "skype", + SPOTIFY = "spotify", STEAM = "steam", TIKTOK = "tiktok", TWITCH = "twitch", @@ -27,15 +27,15 @@ export enum Services { } export interface ConnectionPayload { + friend_sync: boolean; id: snowflake; + integrations?: IntegrationPayload[]; name: string; - type: Services; revoked?: boolean; - integrations?: IntegrationPayload[]; - verified: boolean; - friend_sync: boolean; show_activity: boolean; two_way_link: boolean; + type: Services; + verified: boolean; visibility: VisibilityType; } @@ -45,13 +45,13 @@ export enum VisibilityType { } export interface ApplicationRoleConnectionPayload { - platform_name: string | null; - platform_username: string | null; metadata: ApplicationRoleConnectionMetadata; + platform_name: null | string; + platform_username: null | string; } export interface EditApplicationRoleConnectionPayload { + metadata?: ApplicationRoleConnectionMetadata; platform_name?: string; platform_username?: string; - metadata?: ApplicationRoleConnectionMetadata; } diff --git a/types/src/users/user.ts b/types/src/users/user.ts index b582a513..a98deb26 100644 --- a/types/src/users/user.ts +++ b/types/src/users/user.ts @@ -1,27 +1,26 @@ import { snowflake } from "../common.ts"; export interface UserPayload { - id: snowflake; - username: string; - discriminator: string; - global_name: string | null; - avatar: string | null; + accent_color?: null | number; + avatar: null | string; + avatar_decoration?: null | string; + banner?: null | string; bot?: boolean; - system?: boolean; - mfa_enabled?: boolean; - banner?: string | null; - accent_color?: number | null; - locale?: string; - verified?: boolean; - email?: string | null; + discriminator: string; + email?: null | string; flags?: number; + global_name: null | string; + id: snowflake; + locale?: string; + mfa_enabled?: boolean; premium_type?: PremiumType; public_flags?: number; - avatar_decoration?: string | null; + system?: boolean; + username: string; + verified?: boolean; } export enum UserFlags { - None = 0, STAFF = 1 << 0, PARTNER = 1 << 1, HYPESQUAD = 1 << 2, @@ -37,6 +36,7 @@ export enum UserFlags { CERTIFIED_MODERATOR = 1 << 18, BOT_HTTP_INTERACTIONS = 1 << 19, ACTIVE_DEVELOPER = 1 << 22, + None = 0, } export enum PremiumType { @@ -47,13 +47,13 @@ export enum PremiumType { } export interface EditCurrentUserPayload { + avatar?: null | string; username?: string; - avatar?: string | null; } export interface GetCurrentUserGuildsParams { - before?: snowflake; after?: snowflake; + before?: snowflake; limit?: number; with_counts?: boolean; } diff --git a/types/src/voices/voice.ts b/types/src/voices/voice.ts index 724627f6..114aca86 100644 --- a/types/src/voices/voice.ts +++ b/types/src/voices/voice.ts @@ -2,25 +2,25 @@ import { snowflake } from "../common.ts"; import { GuildMemberPayload } from "../guilds/member.ts"; export interface VoiceStatePayload { - guild_id?: snowflake; channel_id: snowflake; - user_id: snowflake; - member?: GuildMemberPayload; - session_id: string; deaf: boolean; + guild_id?: snowflake; + member?: GuildMemberPayload; mute: boolean; + request_to_speak_timestamp: null | string; self_deaf: boolean; self_mute: boolean; self_stream?: boolean; self_video: boolean; + session_id: string; suppress: boolean; - request_to_speak_timestamp: string | null; + user_id: snowflake; } export interface VoiceRegionPayload { + custom: boolean; + deprecated: boolean; id: string; name: string; optimal: boolean; - deprecated: boolean; - custom: boolean; } diff --git a/types/src/webhooks/webhook.ts b/types/src/webhooks/webhook.ts index 225a3e5e..376141fb 100644 --- a/types/src/webhooks/webhook.ts +++ b/types/src/webhooks/webhook.ts @@ -9,18 +9,18 @@ import { PollPayload } from "../poll/poll.ts"; import { UserPayload } from "../users/user.ts"; export interface WebhookPayload { + application_id: null | snowflake; + avatar: null | string; + channel_id: null | snowflake; + guild_id?: null | snowflake; id: snowflake; - type: WebhookType; - guild_id?: snowflake | null; - channel_id: snowflake | null; - user?: UserPayload; - name: string | null; - avatar: string | null; - token?: string; - application_id: snowflake | null; - source_guild?: GuildPayload; + name: null | string; source_channel?: ChannelPayload; + source_guild?: GuildPayload; + token?: string; + type: WebhookType; url?: string; + user?: UserPayload; } export enum WebhookType { @@ -30,35 +30,35 @@ export enum WebhookType { } export interface CreateWebhookPayload { + avatar?: null | string; // Fun fact: name cannot include 'clyde' or 'discord' in it name: string; - avatar?: string | null; } export interface EditWebhookPayload { - name: string; - avatar: string | null; + avatar: null | string; channel_id: snowflake; + name: string; } export interface ExecuteWebhookParams { - wait?: boolean; thread_id?: snowflake; + wait?: boolean; } export interface ExecuteWebhookPayload { - content?: string; - username?: string; - avatar_url?: string; - tts?: boolean; - embeds?: EmbedPayload[]; allowed_mentions?: AllowedMentionsPayload[]; - components?: ComponentPayload[]; + applied_tags?: snowflake[]; attachments?: AttachmentPayload[]; + avatar_url?: string; + components?: ComponentPayload[]; + content?: string; + embeds?: EmbedPayload[]; flags?: number; - thread_name?: string; - applied_tags?: snowflake[]; poll?: PollPayload; + thread_name?: string; + tts?: boolean; + username?: string; } export type ExecuteSlackCompatibleWebhookParams = ExecuteWebhookParams; @@ -70,11 +70,11 @@ export interface GetWebhookMessageParams { export type EditWebhookMessageParams = GetWebhookMessageParams; export interface EditWebhookMessagePayload { - content?: string | null; - embeds?: EmbedPayload[] | null; allowed_mentions?: AllowedMentionsPayload[] | null; - components?: ComponentPayload[] | null; attachments?: AttachmentPayload[] | null; + components?: ComponentPayload[] | null; + content?: null | string; + embeds?: EmbedPayload[] | null; } export type DeleteWebhookMessageParams = GetWebhookMessageParams;