feat: add Snowflake and Permissions types (#69)

Nice.
This commit is contained in:
Advaith
2021-01-04 16:54:11 -08:00
committed by GitHub
parent 35bd1f7dcd
commit 549a6f0236
24 changed files with 276 additions and 238 deletions

3
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,3 @@
{
"files.eol": "\n"
}

View File

@@ -147,3 +147,14 @@ export interface GatewayConnectQuery {
encoding: 'json' | 'etf';
compress?: 'zlib-stream';
}
/**
* https://discord.com/developers/docs/reference#snowflakes
*/
export type Snowflake = `${bigint}`;
/**
* https://discord.com/developers/docs/topics/permissions
* @internal
*/
export type Permissions = `${bigint}`;

View File

@@ -2,6 +2,7 @@
* Types extracted from https://discord.com/developers/docs/topics/gateway
*/
import type { Snowflake } from '../../common/index';
import type {
APIChannel,
APIEmoji,
@@ -550,11 +551,11 @@ export interface GatewayChannelPinsUpdateDispatchData {
/**
* The id of the guild
*/
guild_id?: string;
guild_id?: Snowflake;
/**
* The id of the channel
*/
channel_id: string;
channel_id: Snowflake;
/**
* The time at which the most recent pinned message was pinned
*/
@@ -623,7 +624,7 @@ export interface GatewayGuildBanModifyDispatchData {
/**
* ID of the guild
*/
guild_id: string;
guild_id: Snowflake;
/**
* The banned user
*
@@ -667,7 +668,7 @@ export interface GatewayGuildEmojisUpdateDispatchData {
/**
* ID of the guild
*/
guild_id: string;
guild_id: Snowflake;
/**
* Array of emojis
*
@@ -691,7 +692,7 @@ export interface GatewayGuildIntegrationsUpdateDispatchData {
/**
* ID of the guild whose integrations were updated
*/
guild_id: string;
guild_id: Snowflake;
}
/**
@@ -709,7 +710,7 @@ export interface GatewayGuildMemberAddDispatchData extends APIGuildMember {
/**
* The id of the guild
*/
guild_id: string;
guild_id: Snowflake;
}
/**
@@ -727,7 +728,7 @@ export interface GatewayGuildMemberRemoveDispatchData {
/**
* The id of the guild
*/
guild_id: string;
guild_id: Snowflake;
/**
* The user who was removed
*
@@ -751,7 +752,7 @@ export type GatewayGuildMemberUpdateDispatchData = Omit<APIGuildMember, 'deaf' |
/**
* The id of the guild
*/
guild_id: string;
guild_id: Snowflake;
};
/**
@@ -769,7 +770,7 @@ export interface GatewayGuildMembersChunkDispatchData {
/**
* The id of the guild
*/
guild_id: string;
guild_id: Snowflake;
/**
* Set of guild members
*
@@ -819,7 +820,7 @@ export interface GatewayGuildRoleModifyDispatchData {
/**
* The id of the guild
*/
guild_id: string;
guild_id: Snowflake;
/**
* The role created or updated
*
@@ -863,11 +864,11 @@ export interface GatewayGuildRoleDeleteDispatchData {
/**
* The id of the guild
*/
guild_id: string;
guild_id: Snowflake;
/**
* The id of the role
*/
role_id: string;
role_id: Snowflake;
}
/**
@@ -898,7 +899,7 @@ export interface GatewayInviteCreateDispatchData {
/**
* The channel the invite is for
*/
channel_id: string;
channel_id: Snowflake;
/**
* The unique invite code
*
@@ -912,7 +913,7 @@ export interface GatewayInviteCreateDispatchData {
/**
* The guild of the invite
*/
guild_id?: string;
guild_id?: Snowflake;
/**
* The user that created the invite
*
@@ -964,11 +965,11 @@ export interface GatewayInviteDeleteDispatchData {
/**
* The channel of the invite
*/
channel_id: string;
channel_id: Snowflake;
/**
* The guild of the invite
*/
guild_id?: string;
guild_id?: Snowflake;
/**
* The unique invite code
*
@@ -1002,8 +1003,8 @@ export type GatewayMessageUpdateDispatch = DataPayload<
* https://discord.com/developers/docs/topics/gateway#message-update
*/
export type GatewayMessageUpdateDispatchData = {
id: string;
channel_id: string;
id: Snowflake;
channel_id: Snowflake;
} & Partial<APIMessage>;
/**
@@ -1021,15 +1022,15 @@ export interface GatewayMessageDeleteDispatchData {
/**
* The id of the message
*/
id: string;
id: Snowflake;
/**
* The id of the channel
*/
channel_id: string;
channel_id: Snowflake;
/**
* The id of the guild
*/
guild_id?: string;
guild_id?: Snowflake;
}
/**
@@ -1047,15 +1048,15 @@ export interface GatewayMessageDeleteBulkDispatchData {
/**
* The ids of the messages
*/
ids: string[];
ids: Snowflake[];
/**
* The id of the channel
*/
channel_id: string;
channel_id: Snowflake;
/**
* The id of the guild
*/
guild_id?: string;
guild_id?: Snowflake;
}
/**
@@ -1134,15 +1135,15 @@ export interface GatewayTypingStartDispatchData {
/**
* The id of the channel
*/
channel_id: string;
channel_id: Snowflake;
/**
* The id of the guild
*/
guild_id?: string;
guild_id?: Snowflake;
/**
* The id of the user
*/
user_id: string;
user_id: Snowflake;
/**
* Unix time (in seconds) of when the user started typing
*/
@@ -1197,7 +1198,7 @@ export interface GatewayVoiceServerUpdateDispatchData {
/**
* The guild this voice server update is for
*/
guild_id: string;
guild_id: Snowflake;
/**
* The voice server host
*/
@@ -1219,11 +1220,11 @@ export interface GatewayWebhooksUpdateDispatchData {
/**
* The id of the guild
*/
guild_id: string;
guild_id: Snowflake;
/**
* The id of the channel
*/
channel_id: string;
channel_id: Snowflake;
}
// #endregion Dispatch Payloads
@@ -1364,7 +1365,7 @@ export interface GatewayRequestGuildMembersData {
/**
* ID of the guild to get members for
*/
guild_id: string | string[];
guild_id: Snowflake;
/**
* String that username starts with, or an empty string to return all members
*/
@@ -1381,7 +1382,7 @@ export interface GatewayRequestGuildMembersData {
/**
* Used to specify which users you wish to fetch
*/
user_ids?: string | string[];
user_ids?: Snowflake | Snowflake[];
/**
* Nonce to identify the Guild Members Chunk response
*
@@ -1405,11 +1406,11 @@ export interface GatewayVoiceStateUpdateData {
/**
* ID of the guild
*/
guild_id: string;
guild_id: Snowflake;
/**
* ID of the voice channel client wants to join (`null` if disconnecting)
*/
channel_id: string | null;
channel_id: Snowflake | null;
/**
* Is the client muted
*/
@@ -1496,19 +1497,19 @@ type ReactionData<E extends GatewayDispatchEvents, O extends string = never> = D
/**
* The id of the user
*/
user_id: string;
user_id: Snowflake;
/**
* The id of the channel
*/
channel_id: string;
channel_id: Snowflake;
/**
* The id of the message
*/
message_id: string;
message_id: Snowflake;
/**
* The id of the guild
*/
guild_id?: string;
guild_id?: Snowflake;
/**
* The member who reacted if this happened in a guild
*
@@ -1530,14 +1531,14 @@ interface MessageReactionRemoveData {
/**
* The id of the channel
*/
channel_id: string;
channel_id: Snowflake;
/**
* The id of the message
*/
message_id: string;
message_id: Snowflake;
/**
* The id of the guild
*/
guild_id?: string;
guild_id?: Snowflake;
}
// #endregion Shared

View File

@@ -2,6 +2,7 @@
* Types extracted from https://discord.com/developers/docs/resources/audit-log
*/
import type { Snowflake } from '../../common/index';
import type { APIOverwrite, ChannelType } from './channel';
import type {
APIGuildIntegration,
@@ -65,11 +66,11 @@ export interface APIAuditLogEntry {
* *Against all odds, this can be `null` in some cases (webhooks deleting themselves
* by using their own token, for example)*
*/
user_id: string | null;
user_id: Snowflake | null;
/**
* ID of the entry
*/
id: string;
id: Snowflake;
/**
* Type of action that occurred
*
@@ -165,7 +166,7 @@ export interface APIAuditLogOptions {
* - MESSAGE_UNPIN
* - MESSAGE_DELETE
*/
channel_id?: string;
channel_id?: Snowflake;
/**
* ID of the message that was targeted
@@ -174,7 +175,7 @@ export interface APIAuditLogOptions {
* - MESSAGE_PIN
* - MESSAGE_UNPIN
*/
message_id?: string;
message_id?: Snowflake;
/**
* Number of entities that were targeted
@@ -195,7 +196,7 @@ export interface APIAuditLogOptions {
* - CHANNEL_OVERWRITE_UPDATE
* - CHANNEL_OVERWRITE_DELETE
*/
id?: string;
id?: Snowflake;
/**
* Type of overwritten entity - "0" for "role" or "1" for "member"
@@ -297,7 +298,7 @@ export type APIAuditLogChangeKeySplashHash = AuditLogChangeData<'splash_hash', s
/**
* Returned when a guild's owner ID is changed
*/
export type APIAuditLogChangeKeyOwnerID = AuditLogChangeData<'owner_id', string>;
export type APIAuditLogChangeKeyOwnerID = AuditLogChangeData<'owner_id', Snowflake>;
/**
* Returned when a guild's region is changed
@@ -307,7 +308,7 @@ export type APIAuditLogChangeKeyRegion = AuditLogChangeData<'region', string>;
/**
* Returned when a guild's afk_channel_id is changed
*/
export type APIAuditLogChangeKeyAFKChannelID = AuditLogChangeData<'afk_channel_id', string>;
export type APIAuditLogChangeKeyAFKChannelID = AuditLogChangeData<'afk_channel_id', Snowflake>;
/**
* Returned when a guild's afk_timeout is changed
@@ -368,12 +369,12 @@ export type APIAuditLogChangeKeyWidgetEnabled = AuditLogChangeData<'widget_enabl
/**
* Returned when a guild's widget_channel_id is changed
*/
export type APIAuditLogChangeKeyWidgetChannelID = AuditLogChangeData<'widget_channel_id', string>;
export type APIAuditLogChangeKeyWidgetChannelID = AuditLogChangeData<'widget_channel_id', Snowflake>;
/**
* Returned when a guild's system_channel_id is changed
*/
export type APIAuditLogChangeKeySystemChannelID = AuditLogChangeData<'system_channel_id', string>;
export type APIAuditLogChangeKeySystemChannelID = AuditLogChangeData<'system_channel_id', Snowflake>;
/**
* Returned when a channel's position is changed
@@ -403,7 +404,7 @@ export type APIAuditLogChangeKeyNSFW = AuditLogChangeData<'nsfw', boolean>;
/**
* The application ID of the added or removed Webhook or Bot
*/
export type APIAuditLogChangeKeyApplicationID = AuditLogChangeData<'application_id', string>;
export type APIAuditLogChangeKeyApplicationID = AuditLogChangeData<'application_id', Snowflake>;
/**
* Returned when a channel's amount of seconds a user has to wait before sending another message
@@ -449,12 +450,12 @@ export type APIAuditLogChangeKeyCode = AuditLogChangeData<'code', string>;
/**
* Returned when an invite's channel_id is changed
*/
export type APIAuditLogChangeKeyChannelID = AuditLogChangeData<'channel_id', string>;
export type APIAuditLogChangeKeyChannelID = AuditLogChangeData<'channel_id', Snowflake>;
/**
* Returned when an invite's inviter_id is changed
*/
export type APIAuditLogChangeKeyInviterID = AuditLogChangeData<'inviter_id', string>;
export type APIAuditLogChangeKeyInviterID = AuditLogChangeData<'inviter_id', Snowflake>;
/**
* Returned when an invite's max_uses is changed
@@ -499,7 +500,7 @@ export type APIAuditLogChangeKeyAvatarHash = AuditLogChangeData<'avatar_hash', s
/**
* The ID of the changed entity - sometimes used in conjunction with other keys
*/
export type APIAuditLogChangeKeyID = AuditLogChangeData<'id', string>;
export type APIAuditLogChangeKeyID = AuditLogChangeData<'id', Snowflake>;
/**
* The type of entity created

View File

@@ -2,8 +2,10 @@
* Types extracted from https://discord.com/developers/docs/resources/channel
*/
import type { Permissions, Snowflake } from '../../common/index';
import type { APIPartialEmoji } from './emoji';
import type { APIGuildMember } from './guild';
import type { APIRole } from './permissions';
import type { APIUser } from './user';
/**
@@ -13,7 +15,7 @@ export interface APIPartialChannel {
/**
* The id of the channel
*/
id: string;
id: Snowflake;
/**
* The type of the channel
*
@@ -33,7 +35,7 @@ export interface APIChannel extends APIPartialChannel {
/**
* The id of the guild
*/
guild_id?: string;
guild_id?: Snowflake;
/**
* Sorting position of the channel
*/
@@ -55,7 +57,7 @@ export interface APIChannel extends APIPartialChannel {
/**
* The id of the last message sent in this channel (may not point to an existing or valid message)
*/
last_message_id?: string | null;
last_message_id?: Snowflake | null;
/**
* The bitrate (in bits) of the voice channel
*/
@@ -82,15 +84,15 @@ export interface APIChannel extends APIPartialChannel {
/**
* ID of the DM creator
*/
owner_id?: string;
owner_id?: Snowflake;
/**
* Application id of the group DM creator if it is bot-created
*/
application_id?: string;
application_id?: Snowflake;
/**
* ID of the parent category for a channel (each parent category can contain up to 50 channels)
*/
parent_id?: string | null;
parent_id?: Snowflake | null;
/**
* When the last pinned message was pinned.
* This may be `null` in events such as `GUILD_CREATE` when a message is not pinned
@@ -145,15 +147,15 @@ export interface APIMessage {
/**
* ID of the message
*/
id: string;
id: Snowflake;
/**
* ID of the channel the message was sent in
*/
channel_id: string;
channel_id: Snowflake;
/**
* ID of the guild the message was sent in
*/
guild_id?: string;
guild_id?: Snowflake;
/**
* The author of this message (only a valid user in the case where the message is generated by a user or bot user)
*
@@ -207,7 +209,7 @@ export interface APIMessage {
*
* See https://discord.com/developers/docs/topics/permissions#role-object
*/
mention_roles: string[];
mention_roles: APIRole['id'][];
/**
* Channels specifically mentioned in this message
*
@@ -252,7 +254,7 @@ export interface APIMessage {
/**
* If the message is generated by a webhook, this is the webhook's id
*/
webhook_id?: string;
webhook_id?: Snowflake;
/**
* Type of message
*
@@ -357,7 +359,7 @@ export interface APIMessageApplication {
/**
* ID of the application
*/
id: string;
id: Snowflake;
/**
* ID of the embed's image asset
*/
@@ -383,15 +385,15 @@ export interface APIMessageReference {
/**
* ID of the originating message
*/
message_id?: string;
message_id?: Snowflake;
/**
* ID of the originating message's channel
*/
channel_id: string;
channel_id: Snowflake;
/**
* ID of the originating message's guild
*/
guild_id?: string;
guild_id?: Snowflake;
}
/**
@@ -438,11 +440,11 @@ export interface APISticker {
/**
* ID of the sticker
*/
id: string;
id: Snowflake;
/**
* ID of the pack the sticker is from
*/
pack_id: string;
pack_id: Snowflake;
/**
* Name of the sticker
*/
@@ -487,11 +489,11 @@ export interface APIFollowedChannel {
/**
* Source channel id
*/
channel_id: string;
channel_id: Snowflake;
/**
* Created target webhook id
*/
webhook_id: string;
webhook_id: Snowflake;
}
/**
@@ -521,7 +523,7 @@ export interface APIOverwrite {
/**
* Role or user id
*/
id: string;
id: Snowflake;
/**
* Either 0 (role) or 1 (member)
*
@@ -535,7 +537,7 @@ export interface APIOverwrite {
*
* See https://en.wikipedia.org/wiki/Bit_field
*/
allow: string;
allow: Permissions;
/**
* Permission bit set
*
@@ -543,7 +545,7 @@ export interface APIOverwrite {
*
* See https://en.wikipedia.org/wiki/Bit_field
*/
deny: string;
deny: Permissions;
}
export const enum OverwriteType {
@@ -815,7 +817,7 @@ export interface APIAttachment {
/**
* Attachment id
*/
id: string;
id: Snowflake;
/**
* Name of file attached
*/
@@ -849,11 +851,11 @@ export interface APIChannelMention {
/**
* ID of the channel
*/
id: string;
id: Snowflake;
/**
* ID of the guild containing the channel
*/
guild_id: string;
guild_id: Snowflake;
/**
* The type of channel
*
@@ -897,11 +899,11 @@ export interface APIAllowedMentions {
/**
* Array of role_ids to mention (Max size of 100)
*/
roles?: string[];
roles?: Snowflake[];
/**
* Array of user_ids to mention (Max size of 100)
*/
users?: string[];
users?: Snowflake[];
/**
* For replies, whether to mention the author of the message being replied to (default false)
*

View File

@@ -2,6 +2,8 @@
* Types extracted from https://discord.com/developers/docs/resources/emoji
*/
import type { Snowflake } from '../../common/index';
import type { APIRole } from './permissions';
import type { APIUser } from './user';
/**
@@ -11,7 +13,7 @@ export interface APIPartialEmoji {
/**
* Emoji id
*/
id: string | null;
id: Snowflake | null;
/**
* Emoji name (can be null only in reaction emoji objects)
*/
@@ -29,7 +31,7 @@ export interface APIEmoji extends APIPartialEmoji {
/**
* Roles this emoji is whitelisted to
*/
roles?: string[];
roles?: APIRole['id'][];
/**
* User that created this emoji
*/

View File

@@ -2,6 +2,7 @@
* Types extracted from https://discord.com/developers/docs/topics/gateway
*/
import type { Snowflake } from '../../common/index';
import type { APIEmoji } from './emoji';
import type { APIUser } from './user';
@@ -67,13 +68,11 @@ export interface GatewayPresenceUpdate {
*
* See https://discord.com/developers/docs/resources/user#user-object
*/
user: Partial<APIUser> & {
id: string;
};
user: Partial<APIUser> & Pick<APIUser, 'id'>;
/**
* ID of the guild
*/
guild_id: string;
guild_id: Snowflake;
/**
* Either "idle", "dnd", "online", or "offline"
*/
@@ -156,7 +155,7 @@ export interface GatewayActivity {
/**
* Application id for the game
*/
application_id?: string;
application_id?: Snowflake;
/**
* What the player is currently doing
*/

View File

@@ -2,6 +2,7 @@
* Types extracted from https://discord.com/developers/docs/resources/guild
*/
import type { Permissions, Snowflake } from '../../common/index';
import type { APIChannel } from './channel';
import type { APIEmoji } from './emoji';
import type { GatewayPresenceUpdate, PresenceUpdateStatus } from './gateway';
@@ -16,7 +17,7 @@ export interface APIUnavailableGuild {
/**
* Guild id
*/
id: string;
id: Snowflake;
/**
* `true` if this guild is unavailable due to an outage
*/
@@ -100,7 +101,7 @@ export interface APIGuild extends APIPartialGuild {
/**
* ID of owner
*/
owner_id: string;
owner_id: Snowflake;
/**
* Total permissions for the user in the guild (excludes overrides)
*
@@ -108,7 +109,7 @@ export interface APIGuild extends APIPartialGuild {
*
* See https://en.wikipedia.org/wiki/Bit_field
*/
permissions?: string;
permissions?: Permissions;
/**
* Voice region id for the guild
*
@@ -118,7 +119,7 @@ export interface APIGuild extends APIPartialGuild {
/**
* ID of afk channel
*/
afk_channel_id: string | null;
afk_channel_id: Snowflake | null;
/**
* afk timeout in seconds
*/
@@ -130,7 +131,7 @@ export interface APIGuild extends APIPartialGuild {
/**
* The channel id that the widget will generate an invite to, or `null` if set to no invite
*/
widget_channel_id?: string | null;
widget_channel_id?: Snowflake | null;
/**
* Verification level required for the guild
*
@@ -176,11 +177,11 @@ export interface APIGuild extends APIPartialGuild {
/**
* Application id of the guild creator if it is bot-created
*/
application_id: string | null;
application_id: Snowflake | null;
/**
* The id of the channel where guild notices such as welcome messages and boost events are posted
*/
system_channel_id: string | null;
system_channel_id: Snowflake | null;
/**
* System channel flags
*
@@ -190,7 +191,7 @@ export interface APIGuild extends APIPartialGuild {
/**
* The id of the channel where Community guilds can display rules and/or guidelines
*/
rules_channel_id: string | null;
rules_channel_id: Snowflake | null;
/**
* When this guild was joined at
*
@@ -282,7 +283,7 @@ export interface APIGuild extends APIPartialGuild {
/**
* The id of the channel where admins and moderators of Community guilds receive notices from Discord
*/
public_updates_channel_id: string | null;
public_updates_channel_id: Snowflake | null;
/**
* The maximum amount of users in a video channel
*/
@@ -447,7 +448,7 @@ export interface APIGuildPreview {
/**
* Guild id
*/
id: string;
id: Snowflake;
/**
* Guild name (2-100 characters)
*/
@@ -507,7 +508,7 @@ export interface APIGuildWidgetSettings {
/**
* The widget channel id
*/
channel_id: string | null;
channel_id: Snowflake | null;
}
/**
@@ -531,7 +532,7 @@ export interface APIGuildMember {
*
* See https://discord.com/developers/docs/topics/permissions#role-object
*/
roles: string[];
roles: Snowflake[];
/**
* When the user joined the guild
*/
@@ -565,7 +566,7 @@ export interface APIGuildIntegration {
/**
* Integration id
*/
id: string;
id: Snowflake;
/**
* Integration name
*/
@@ -589,7 +590,7 @@ export interface APIGuildIntegration {
*
* **This field is not provided for `discord` bot integrations.**
*/
role_id?: string;
role_id?: Snowflake;
/**
* Whether emoticons should be synced for this integration (`twitch` only currently)
*
@@ -683,7 +684,7 @@ export interface APIGuildIntegrationApplication {
/**
* The id of the app
*/
id: string;
id: Snowflake;
/**
* The name of the app
*/
@@ -728,7 +729,7 @@ export interface APIBan {
* https://discord.com/developers/docs/resources/guild#get-guild-widget-example-get-guild-widget
*/
export interface APIGuildWidget {
id: string;
id: Snowflake;
name: string;
instant_invite: string | null;
channels: APIGuildWidgetChannel[];
@@ -740,7 +741,7 @@ export interface APIGuildWidget {
* https://discord.com/developers/docs/resources/guild#get-guild-widget-example-get-guild-widget
*/
export interface APIGuildWidgetChannel {
id: string;
id: Snowflake;
name: string;
position: number;
}
@@ -800,11 +801,11 @@ export interface APIGuildWelcomeScreenChannel {
/**
* The channel id that is suggested
*/
channel_id: string;
channel_id: Snowflake;
/**
* The emoji id of the emoji that is shown on the left of the channel
*/
emoji_id: string | null;
emoji_id: Snowflake | null;
/**
* The emoji name of the emoji that is shown on the left of the channel
*/

View File

@@ -1,3 +1,4 @@
import type { Permissions, Snowflake } from '../../common/index';
import type { APIGuildMember, APIUser, MessageFlags } from './index';
import type { RESTPostAPIWebhookWithTokenJSONBody } from '../rest/index';
@@ -5,8 +6,8 @@ import type { RESTPostAPIWebhookWithTokenJSONBody } from '../rest/index';
* https://discord.com/developers/docs/interactions/slash-commands#applicationcommand
*/
export interface APIApplicationCommand {
id: string;
application_id: string;
id: Snowflake;
application_id: Snowflake;
name: string;
description: string;
options?: APIApplicationCommandOption[];
@@ -79,12 +80,12 @@ export interface APIApplicationCommandOptionChoice {
* https://discord.com/developers/docs/interactions/slash-commands#interaction
*/
export interface APIInteraction {
id: string;
id: Snowflake;
type: InteractionType;
data?: APIApplicationCommandInteractionData;
guild_id: string;
channel_id: string;
member: APIGuildMember & { permissions: string; user: APIUser };
guild_id: Snowflake;
channel_id: Snowflake;
member: APIGuildMember & { permissions: Permissions; user: APIUser };
token: string;
version: 1;
}
@@ -106,7 +107,7 @@ export const enum InteractionType {
* https://discord.com/developers/docs/interactions/slash-commands#interaction-applicationcommandinteractiondata
*/
export interface APIApplicationCommandInteractionData {
id: string;
id: Snowflake;
name: string;
options?: APIApplicationCommandInteractionDataOption[];
}

View File

@@ -2,6 +2,7 @@
* Types extracted from https://discord.com/developers/docs/topics/oauth2
*/
import type { Snowflake } from '../../common/index';
import type { APITeam } from './teams';
import type { APIUser } from './user';
@@ -12,7 +13,7 @@ export interface APIApplication {
/**
* The id of the app
*/
id: string;
id: Snowflake;
/**
* The name of the app
*/
@@ -63,11 +64,11 @@ export interface APIApplication {
/**
* If this application is a game sold on Discord, this field will be the guild to which it has been linked
*/
guild_id?: string;
guild_id?: Snowflake;
/**
* If this application is a game sold on Discord, this field will be the id of the "Game SKU" that is created, if exists
*/
primary_sku_id?: string;
primary_sku_id?: Snowflake;
/**
* If this application is a game sold on Discord, this field will be the URL slug that links to the store page
*/

View File

@@ -2,6 +2,8 @@
* Types extracted from https://discord.com/developers/docs/topics/permissions
*/
import type { Permissions, Snowflake } from '../../common/index';
/**
* https://discord.com/developers/docs/topics/permissions#permissions-bitwise-permission-flags
*
@@ -57,7 +59,7 @@ export interface APIRole {
/**
* Role id
*/
id: string;
id: Snowflake;
/**
* Role name
*/
@@ -79,7 +81,7 @@ export interface APIRole {
*
* See https://en.wikipedia.org/wiki/Bit_field
*/
permissions: string;
permissions: Permissions;
/**
* Whether this role is managed by an integration
*/
@@ -101,7 +103,7 @@ export interface APIRoleTags {
/**
* The id of the bot this role belongs to
*/
bot_id?: string;
bot_id?: Snowflake;
/**
* Whether this is the guild's premium subscriber role
*/
@@ -109,5 +111,5 @@ export interface APIRoleTags {
/**
* The id of the integration this role belongs to
*/
integration_id?: string;
integration_id?: Snowflake;
}

View File

@@ -2,6 +2,7 @@
* Types extracted from https://discord.com/developers/docs/topics/teams
*/
import type { Snowflake } from '../../common/index';
import type { APIUser } from './user';
/**
@@ -15,7 +16,7 @@ export interface APITeam {
/**
* The unique id of the team
*/
id: string;
id: Snowflake;
/**
* The members of the team
*/
@@ -23,7 +24,7 @@ export interface APITeam {
/**
* The user id of the current team owner
*/
owner_user_id: string;
owner_user_id: Snowflake;
}
/**
@@ -43,7 +44,7 @@ export interface APITeamMember {
/**
* The id of the parent team of which they are a member
*/
team_id: string;
team_id: Snowflake;
/**
* The avatar, discriminator, id, and username of the user
*

View File

@@ -2,6 +2,7 @@
* Types extracted from https://discord.com/developers/docs/resources/template
*/
import type { Snowflake } from '../../common/index';
import type { APIUser } from './user';
import type { RESTPostAPIGuildsJSONBody } from '../rest/index';
@@ -28,7 +29,7 @@ export interface APITemplate {
/**
* The ID of the user who created the template
*/
creator_id: string;
creator_id: Snowflake;
/**
* The user who created the template
*
@@ -46,7 +47,7 @@ export interface APITemplate {
/**
* The ID of the guild this template is based on
*/
source_guild_id: string;
source_guild_id: Snowflake;
/**
* The guild snapshot this template contains
*/

View File

@@ -2,6 +2,7 @@
* Types extracted from https://discord.com/developers/docs/resources/user
*/
import type { Snowflake } from '../../common/index';
import type { APIGuildIntegration } from './guild';
/**
@@ -11,7 +12,7 @@ export interface APIUser {
/**
* The user's id
*/
id: string;
id: Snowflake;
/**
* The user's username, not unique across the platform
*/

View File

@@ -2,6 +2,7 @@
* Types extracted from https://discord.com/developers/docs/resources/voice
*/
import type { Snowflake } from '../../common/index';
import type { APIGuildMember } from './guild';
/**
@@ -11,15 +12,15 @@ export interface GatewayVoiceState {
/**
* The guild id this voice state is for
*/
guild_id?: string;
guild_id?: Snowflake;
/**
* The channel id this user is connected to
*/
channel_id: string | null;
channel_id: Snowflake | null;
/**
* The user id this voice state is for
*/
user_id: string;
user_id: Snowflake;
/**
* The guild member this voice state is for
*

View File

@@ -2,6 +2,7 @@
* Types extracted from https://discord.com/developers/docs/resources/webhook
*/
import type { Snowflake } from '../../common/index';
import type { APIPartialChannel, APIPartialGuild, APIUser } from './index';
/**
@@ -11,7 +12,7 @@ export interface APIWebhook {
/**
* The id of the webhook
*/
id: string;
id: Snowflake;
/**
* The type of the webhook
*
@@ -21,11 +22,11 @@ export interface APIWebhook {
/**
* The guild id this webhook is for
*/
guild_id?: string;
guild_id?: Snowflake;
/**
* The channel id this webhook is for
*/
channel_id: string;
channel_id: Snowflake;
/**
* The user this webhook was created by (not returned when getting a webhook with its token)
*
@@ -47,7 +48,7 @@ export interface APIWebhook {
/**
* The bot/OAuth2 application that created this webhook
*/
application_id: string | null;
application_id: Snowflake | null;
source_guild?: APIPartialGuild;
source_channel?: APIPartialChannel;
}

View File

@@ -1,3 +1,4 @@
import type { Snowflake } from '../../common/index';
import type { APIAuditLog, AuditLogEvent } from '../payloads/auditLog';
/**
@@ -7,7 +8,7 @@ export interface RESTGetAPIAuditLogQuery {
/**
* Filter the log for actions made by a user
*/
user_id?: string;
user_id?: Snowflake;
/**
* The type of audit log events
*/
@@ -15,7 +16,7 @@ export interface RESTGetAPIAuditLogQuery {
/**
* Filter the log before a certain entry ID
*/
before?: string;
before?: Snowflake;
/**
* How many entries are returned (default 50, minimum 1, maximum 100)
*

View File

@@ -1,3 +1,4 @@
import type { Permissions, Snowflake } from '../../common/index';
import type {
APIAllowedMentions,
APIChannel,
@@ -86,7 +87,7 @@ export interface RESTPatchAPIChannelJSONBody {
*
* Channel types: text, news, store, voice
*/
parent_id?: string | null;
parent_id?: Snowflake | null;
}
/**
@@ -106,15 +107,15 @@ export interface RESTGetAPIChannelMessagesQuery {
/**
* Get messages around this message ID
*/
around?: string;
around?: Snowflake;
/**
* Get messages before this message ID
*/
before?: string;
before?: Snowflake;
/**
* Get messages after this message ID
*/
after?: string;
after?: Snowflake;
/**
* Max number of messages to return (1-100)
*
@@ -224,11 +225,11 @@ export interface RESTGetAPIChannelMessageReactionUsersQuery {
/**
* Get users before this user ID
*/
before?: string;
before?: Snowflake;
/**
* Get users after this user ID
*/
after?: string;
after?: Snowflake;
/**
* Max number of users to return (1-100)
*
@@ -294,7 +295,7 @@ export interface RESTPostAPIChannelMessagesBulkDeleteJSONBody {
/**
* An array of message ids to delete (2-100)
*/
messages: string[];
messages: Snowflake[];
}
/**
@@ -311,13 +312,13 @@ export interface RESTPutAPIChannelPermissionJSONBody {
*
* See https://en.wikipedia.org/wiki/Bit_field
*/
allow: string;
allow: Permissions;
/**
* The bitwise value of all disallowed permissions
*
* See https://en.wikipedia.org/wiki/Bit_field
*/
deny: string;
deny: Permissions;
/**
* `0` for a role or `1` for a member
*/
@@ -390,7 +391,7 @@ export interface RESTPostAPIChannelFollowersJSONBody {
/**
* ID of target channel
*/
webhook_channel_id: string;
webhook_channel_id: Snowflake;
}
/**

View File

@@ -1,3 +1,4 @@
import type { Snowflake } from '../../common/index';
import type { APIEmoji } from '../payloads/index';
/**
@@ -27,7 +28,7 @@ export interface RESTPostAPIGuildEmojiJSONBody {
/**
* Roles for which this emoji will be whitelisted
*/
roles?: string[];
roles?: Snowflake[];
}
/**
@@ -46,7 +47,7 @@ export interface RESTPatchAPIGuildEmojiJSONBody {
/**
* Roles for which this emoji will be whitelisted
*/
roles?: string[] | null;
roles?: Snowflake[] | null;
}
/**

View File

@@ -1,3 +1,4 @@
import type { Permissions, Snowflake } from '../../common/index';
import type {
APIBan,
APIChannel,
@@ -105,7 +106,7 @@ export interface RESTPostAPIGuildsJSONBody {
/**
* ID for afk channel
*/
afk_channel_id?: number | string;
afk_channel_id?: number | Snowflake;
/**
* AFK timeout in seconds
*/
@@ -113,7 +114,7 @@ export interface RESTPostAPIGuildsJSONBody {
/**
* The id of the channel where guild notices such as welcome messages and boost events are posted
*/
system_channel_id?: number | string;
system_channel_id?: number | Snowflake;
/**
* System channel flags
*
@@ -184,7 +185,7 @@ export interface RESTPatchAPIGuildJSONBody {
/**
* ID for afk channel
*/
afk_channel_id?: string | null;
afk_channel_id?: Snowflake | null;
/**
* AFK timeout in seconds
*/
@@ -198,7 +199,7 @@ export interface RESTPatchAPIGuildJSONBody {
/**
* User id to transfer guild ownership to (must be owner)
*/
owner_id?: string;
owner_id?: Snowflake;
/**
* base64 16:9 png/jpeg image for the guild splash (when the guild has `INVITE_SPLASH` feature)
*
@@ -216,7 +217,7 @@ export interface RESTPatchAPIGuildJSONBody {
/**
* The id of the channel where guild notices such as welcome messages and boost events are posted
*/
system_channel_id?: string | null;
system_channel_id?: Snowflake | null;
/**
* System channel flags
*
@@ -226,11 +227,11 @@ export interface RESTPatchAPIGuildJSONBody {
/**
* The id of the channel where Community guilds display rules and/or guidelines
*/
rules_channel_id?: string | null;
rules_channel_id?: Snowflake | null;
/**
* The id of the channel where admins and moderators of Community guilds receive notices from Discord
*/
public_updates_channel_id?: string | null;
public_updates_channel_id?: Snowflake | null;
/**
* The preferred locale of a Community guild used in server discovery and notices from Discord; defaults to "en-US"
*
@@ -281,7 +282,7 @@ export type RESTPatchAPIGuildChannelPositionsJSONBody = Array<{
/**
* Channel id
*/
id: string;
id: Snowflake;
/**
* Sorting position of the channel
*/
@@ -293,7 +294,7 @@ export type RESTPatchAPIGuildChannelPositionsJSONBody = Array<{
/**
* The new parent id of this channel
*/
parent_id?: string | null;
parent_id?: Snowflake | null;
}>;
/**
@@ -321,7 +322,7 @@ export interface RESTGetAPIGuildMembersQuery {
*
* @default 0
*/
after?: string;
after?: Snowflake;
}
/**
@@ -363,7 +364,7 @@ export interface RESTPutAPIGuildMemberJSONBody {
*
* Requires `MANAGE_ROLES` permission
*/
roles?: string[];
roles?: Snowflake[];
/**
* Whether the user is muted in voice channels
*
@@ -395,7 +396,7 @@ export interface RESTPatchAPIGuildMemberJSONBody {
*
* Requires `MANAGE_ROLES` permission
*/
roles?: string[] | null;
roles?: Snowflake[] | null;
/**
* Whether the user is muted in voice channels. Will throw a 400 if the user is not in a voice channel
*
@@ -413,7 +414,7 @@ export interface RESTPatchAPIGuildMemberJSONBody {
*
* Requires `MOVE_MEMBERS` permission
*/
channel_id?: string | null;
channel_id?: Snowflake | null;
}
/**
@@ -507,7 +508,7 @@ export interface RESTPostAPIGuildRoleJSONBody {
*
* @default "default role permissions in guild"
*/
permissions?: string | null;
permissions?: Permissions | null;
/**
* RGB color value
*
@@ -540,7 +541,7 @@ export type RESTPatchAPIGuildRolePositionsJSONBody = Array<{
/**
* Role id
*/
id: string;
id: Snowflake;
/**
* Sorting position of the role
*/
@@ -563,7 +564,7 @@ export interface RESTPatchAPIGuildRoleJSONBody {
/**
* Bitwise value of the enabled/disabled permissions
*/
permissions?: string | null;
permissions?: Permissions | null;
/**
* RGB color value
*/
@@ -635,7 +636,7 @@ export interface RESTPostAPIGuildPruneJSONBody {
/**
* Role(s) to include
*/
include_roles?: string[];
include_roles?: Snowflake[];
}
/**
@@ -665,7 +666,7 @@ export type RESTGetAPIGuildIntegrationsResult = APIGuildIntegration[];
*/
export interface RESTPostAPIGuildIntegrationJSONBody {
type: string;
id: string;
id: Snowflake;
}
export type RESTPostAPIGuildIntegrationResult = never;

View File

@@ -1,3 +1,5 @@
import type { Snowflake } from '../../common/index';
export * from './auditLog';
export * from './channel';
export * from './emoji';
@@ -17,7 +19,7 @@ export const Routes = {
* Route for:
* - GET `/guilds/{guild.id}/audit-logs`
*/
guildAuditLog(guildID: string) {
guildAuditLog(guildID: Snowflake) {
return `/guilds/${guildID}/audit-logs`;
},
@@ -27,7 +29,7 @@ export const Routes = {
* - PATCH `/channels/{channel.id}`
* - DELETE `/channels/{channel.id}`
*/
channel(channelID: string) {
channel(channelID: Snowflake) {
return `/channels/${channelID}`;
},
@@ -36,7 +38,7 @@ export const Routes = {
* - GET `/channels/{channel.id}/messages`
* - POST `/channels/{channel.id}/messages`
*/
channelMessages(channelID: string) {
channelMessages(channelID: Snowflake) {
return `/channels/${channelID}/messages`;
},
@@ -46,7 +48,7 @@ export const Routes = {
* - PATCH `/channels/{channel.id}/messages/{message.id}`
* - DELETE `/channels/{channel.id}/messages/{message.id}`
*/
channelMessage(channelID: string, messageID: string) {
channelMessage(channelID: Snowflake, messageID: Snowflake) {
return `/channels/${channelID}/messages/${messageID}`;
},
@@ -54,7 +56,7 @@ export const Routes = {
* Route for:
* - POST `/channels/{channel.id}/messages/{message.id}/crosspost`
*/
channelMessageCrosspost(channelID: string, messageID: string) {
channelMessageCrosspost(channelID: Snowflake, messageID: Snowflake) {
return `/channels/${channelID}/messages/${messageID}/crosspost`;
},
@@ -65,7 +67,7 @@ export const Routes = {
*
* **Note**: You need to URL encode the emoji yourself
*/
channelMessageOwnReaction(channelID: string, messageID: string, emoji: string) {
channelMessageOwnReaction(channelID: Snowflake, messageID: Snowflake, emoji: string) {
return `/channels/${channelID}/messages/${messageID}/reactions/${emoji}/@me`;
},
@@ -75,7 +77,7 @@ export const Routes = {
*
* **Note**: You need to URL encode the emoji yourself
*/
channelMessageUserReaction(channelID: string, messageID: string, emoji: string, userID: string) {
channelMessageUserReaction(channelID: Snowflake, messageID: Snowflake, emoji: string, userID: Snowflake) {
return `/channels/${channelID}/messages/${messageID}/reactions/${emoji}/${userID}`;
},
@@ -86,7 +88,7 @@ export const Routes = {
*
* **Note**: You need to URL encode the emoji yourself
*/
channelMessageReaction(channelID: string, messageID: string, emoji: string) {
channelMessageReaction(channelID: Snowflake, messageID: Snowflake, emoji: string) {
return `/channels/${channelID}/messages/${messageID}/reactions/${emoji}`;
},
@@ -94,7 +96,7 @@ export const Routes = {
* Route for:
* - DELETE `/channels/{channel.id}/messages/{message.id}/reactions`
*/
channelMessageAllReactions(channelID: string, messageID: string) {
channelMessageAllReactions(channelID: Snowflake, messageID: Snowflake) {
return `/channels/${channelID}/messages/${messageID}/reactions`;
},
@@ -102,7 +104,7 @@ export const Routes = {
* Route for:
* - POST `/channels/{channel.id}/messages/bulk-delete`
*/
channelBulkDelete(channelID: string) {
channelBulkDelete(channelID: Snowflake) {
return `/channels/${channelID}/messages/bulk-delete`;
},
@@ -111,7 +113,7 @@ export const Routes = {
* - PUT `/channels/{channel.id}/permissions/{overwrite.id}`
* - DELETE `/channels/{channel.id}/permissions/{overwrite.id}`
*/
channelPermission(channelID: string, overwriteID: string) {
channelPermission(channelID: Snowflake, overwriteID: Snowflake) {
return `/channels/${channelID}/permissions/${overwriteID}`;
},
@@ -120,7 +122,7 @@ export const Routes = {
* - GET `/channels/{channel.id}/invites`
* - POST `/channels/{channel.id}/invites`
*/
channelInvites(channelID: string) {
channelInvites(channelID: Snowflake) {
return `/channels/${channelID}/invites`;
},
@@ -128,7 +130,7 @@ export const Routes = {
* Route for:
* - POST `/channels/{channel.id}/followers`
*/
channelFollowers(channelID: string) {
channelFollowers(channelID: Snowflake) {
return `/channels/${channelID}/followers`;
},
@@ -136,7 +138,7 @@ export const Routes = {
* Route for:
* - POST `/channels/{channel.id}/typing`
*/
channelTyping(channelID: string) {
channelTyping(channelID: Snowflake) {
return `/channels/${channelID}/typing`;
},
@@ -144,7 +146,7 @@ export const Routes = {
* Route for:
* - GET `/channels/{channel.id}/pins`
*/
channelPins(channelID: string) {
channelPins(channelID: Snowflake) {
return `/channels/${channelID}/pins`;
},
@@ -153,7 +155,7 @@ export const Routes = {
* - PUT `/channels/{channel.id}/pins/{message.id}`
* - DELETE `/channels/{channel.id}/pins/{message.id}`
*/
channelPin(channelID: string, messageID: string) {
channelPin(channelID: Snowflake, messageID: Snowflake) {
return `/channels/${channelID}/pins/${messageID}`;
},
@@ -162,7 +164,7 @@ export const Routes = {
* - PUT `/channels/{channel.id}/recipients/{user.id}`
* - DELETE `/channels/{channel.id}/recipients/{user.id}`
*/
channelRecipient(channelID: string, userID: string) {
channelRecipient(channelID: Snowflake, userID: Snowflake) {
return `/channels/${channelID}/recipients/${userID}`;
},
@@ -171,7 +173,7 @@ export const Routes = {
* - GET `/guilds/{guild.id}/emojis`
* - POST `/guilds/{guild.id}/emojis`
*/
guildEmojis(guildID: string) {
guildEmojis(guildID: Snowflake) {
return `/guilds/${guildID}/emojis`;
},
@@ -181,7 +183,7 @@ export const Routes = {
* - PATCH `/guilds/{guild.id}/emojis/{emoji.id}`
* - DELETE `/guilds/{guild.id}/emojis/{emoji.id}`
*/
guildEmoji(guildID: string, emojiID: string) {
guildEmoji(guildID: Snowflake, emojiID: Snowflake) {
return `/guilds/${guildID}/emojis/${emojiID}`;
},
@@ -199,7 +201,7 @@ export const Routes = {
* - PATCH `/guilds/{guild.id}`
* - DELETE `/guilds/{guild.id}`
*/
guild(guildID: string) {
guild(guildID: Snowflake) {
return `/guilds/${guildID}`;
},
@@ -207,7 +209,7 @@ export const Routes = {
* Route for:
* - GET `/guilds/{guild.id}/preview`
*/
guildPreview(guildID: string) {
guildPreview(guildID: Snowflake) {
return `/guilds/${guildID}/preview`;
},
@@ -217,7 +219,7 @@ export const Routes = {
* - POST `/guilds/{guild.id}/channels`
* - PATCH `/guilds/{guild.id}/channels`
*/
guildChannels(guildID: string) {
guildChannels(guildID: Snowflake) {
return `/guilds/${guildID}/channels`;
},
@@ -228,7 +230,7 @@ export const Routes = {
* - PATCH `/guilds/{guild.id}/members/{user.id}`
* - DELETE `/guilds/{guild.id}/members/{user.id}`
*/
guildMember(guildID: string, userID: string) {
guildMember(guildID: Snowflake, userID: Snowflake) {
return `/guilds/${guildID}/members/${userID}`;
},
@@ -236,7 +238,7 @@ export const Routes = {
* Route for:
* - GET `/guilds/{guild.id}/members`
*/
guildMembers(guildID: string) {
guildMembers(guildID: Snowflake) {
return `/guilds/${guildID}/members`;
},
@@ -244,7 +246,7 @@ export const Routes = {
* Route for:
* - GET `/guilds/{guild.id}/members/search`
*/
guildMembersSearch(guildID: string) {
guildMembersSearch(guildID: Snowflake) {
return `/guilds/${guildID}/members/search`;
},
@@ -252,7 +254,7 @@ export const Routes = {
* Route for:
* - PATCH `/guilds/{guild.id}/members/@me/nick`
*/
guildCurrentMemberNickname(guildID: string) {
guildCurrentMemberNickname(guildID: Snowflake) {
return `/guilds/${guildID}/members/@me/nick`;
},
@@ -261,7 +263,7 @@ export const Routes = {
* - PUT `/guilds/{guild.id}/members/{user.id}/roles/{role.id}`
* - DELETE `/guilds/{guild.id}/members/{user.id}/roles/{role.id}`
*/
guildMemberRole(guildID: string, memberID: string, roleID: string) {
guildMemberRole(guildID: Snowflake, memberID: Snowflake, roleID: Snowflake) {
return `/guilds/${guildID}/members/${memberID}/roles/${roleID}`;
},
@@ -269,7 +271,7 @@ export const Routes = {
* Route for:
* - GET `/guilds/{guild.id}/bans`
*/
guildBans(guildID: string) {
guildBans(guildID: Snowflake) {
return `/guilds/${guildID}/bans`;
},
@@ -279,7 +281,7 @@ export const Routes = {
* - PUT `/guilds/{guild.id}/bans/{user.id}`
* - DELETE `/guilds/{guild.id}/bans/{user.id}`
*/
guildBan(guildID: string, userID: string) {
guildBan(guildID: Snowflake, userID: Snowflake) {
return `/guilds/${guildID}/bans/${userID}`;
},
@@ -289,7 +291,7 @@ export const Routes = {
* - POST `/guilds/{guild.id}/roles`
* - PATCH `/guilds/{guild.id}/roles`
*/
guildRoles(guildID: string) {
guildRoles(guildID: Snowflake) {
return `/guilds/${guildID}/roles`;
},
@@ -298,7 +300,7 @@ export const Routes = {
* - PATCH `/guilds/{guild.id}/roles/{role.id}`
* - DELETE `/guilds/{guild.id}/roles/{role.id}`
*/
guildRole(guildID: string, roleID: string) {
guildRole(guildID: Snowflake, roleID: Snowflake) {
return `/guilds/${guildID}/roles/${roleID}`;
},
@@ -307,7 +309,7 @@ export const Routes = {
* - GET `/guilds/{guild.id}/prune`
* - POST `/guilds/{guild.id}/prune`
*/
guildPrune(guildID: string) {
guildPrune(guildID: Snowflake) {
return `/guilds/${guildID}/prune`;
},
@@ -315,7 +317,7 @@ export const Routes = {
* Route for:
* - GET `/guilds/{guild.id}/regions`
*/
guildVoiceRegions(guildID: string) {
guildVoiceRegions(guildID: Snowflake) {
return `/guilds/${guildID}/regions`;
},
@@ -323,7 +325,7 @@ export const Routes = {
* Route for:
* - GET `/guilds/{guild.id}/invites`
*/
guildInvites(guildID: string) {
guildInvites(guildID: Snowflake) {
return `/guilds/${guildID}/invites`;
},
@@ -332,7 +334,7 @@ export const Routes = {
* - GET `/guilds/{guild.id}/integrations`
* - POST `/guilds/{guild.id}/integrations`
*/
guildIntegrations(guildID: string) {
guildIntegrations(guildID: Snowflake) {
return `/guilds/${guildID}/integrations`;
},
@@ -341,7 +343,7 @@ export const Routes = {
* - PATCH `/guilds/{guild.id}/integrations/{integration.id}`
* - DELETE `/guilds/{guild.id}/integrations/{integration.id}`
*/
guildIntegration(guildID: string, integrationID: string) {
guildIntegration(guildID: Snowflake, integrationID: Snowflake) {
return `/guilds/${guildID}/integrations/${integrationID}`;
},
@@ -349,7 +351,7 @@ export const Routes = {
* Route for:
* - POST `/guilds/{guild.id}/integrations/{integration.id}/sync`
*/
guildIntegrationSync(guildID: string, integrationID: string) {
guildIntegrationSync(guildID: Snowflake, integrationID: Snowflake) {
return `/guilds/${guildID}/integrations/${integrationID}/sync`;
},
@@ -358,7 +360,7 @@ export const Routes = {
* - GET `/guilds/{guild.id}/widget`
* - PATCH `/guilds/{guild.id}/widget`
*/
guildWidgetSettings(guildID: string) {
guildWidgetSettings(guildID: Snowflake) {
return `/guilds/${guildID}/widget`;
},
@@ -366,7 +368,7 @@ export const Routes = {
* Route for:
* - GET `/guilds/{guild.id}/widget.json`
*/
guildWidgetJSON(guildID: string) {
guildWidgetJSON(guildID: Snowflake) {
return `/guilds/${guildID}/widget.json`;
},
@@ -374,7 +376,7 @@ export const Routes = {
* Route for:
* - GET `/guilds/{guild.id}/vanity-url`
*/
guildVanityUrl(guildID: string) {
guildVanityUrl(guildID: Snowflake) {
return `/guilds/${guildID}/vanity-url`;
},
@@ -382,7 +384,7 @@ export const Routes = {
* Route for:
* - GET `/guilds/{guild.id}/widget.png`
*/
guildWidgetImage(guildID: string) {
guildWidgetImage(guildID: Snowflake) {
return `/guilds/${guildID}/widget.png`;
},
@@ -409,7 +411,7 @@ export const Routes = {
* - GET `/guilds/{guild.id}/templates`
* - POST `/guilds/{guild.id}/templates`
*/
guildTemplates(guildID: string) {
guildTemplates(guildID: Snowflake) {
return `/guilds/${guildID}/templates`;
},
@@ -419,7 +421,7 @@ export const Routes = {
* - PATCH `/guilds/{guild.id}/templates/{template.code}`
* - DELETE `/guilds/{guild.id}/templates/{template.code}`
*/
guildTemplate(guildID: string, code: string) {
guildTemplate(guildID: Snowflake, code: string) {
return `/guilds/${guildID}/templates/${code}`;
},
@@ -447,7 +449,7 @@ export const Routes = {
* Route for:
* - DELETE `/users/@me/guilds/{guild.id}`
*/
userGuild(guildID: string) {
userGuild(guildID: Snowflake) {
return `/users/@me/guilds/${guildID}`;
},
@@ -480,7 +482,7 @@ export const Routes = {
* - GET `/channels/{channel.id}/webhooks`
* - POST `/channels/{channel.id}/webhooks`
*/
channelWebhooks(channelID: string) {
channelWebhooks(channelID: Snowflake) {
return `/channels/${channelID}/webhooks`;
},
@@ -488,7 +490,7 @@ export const Routes = {
* Route for:
* - GET `/guilds/{guild.id}/webhooks`
*/
guildWebhooks(guildID: string) {
guildWebhooks(guildID: Snowflake) {
return `/guilds/${guildID}/webhooks`;
},
@@ -504,7 +506,7 @@ export const Routes = {
*
* - POST `/webhooks/{application.id}/{interaction.token}`
*/
webhook(webhookID: string, webhookToken?: string) {
webhook(webhookID: Snowflake, webhookToken?: string) {
const parts = ['', 'webhooks', webhookID];
if (webhookToken) parts.push(webhookToken);
@@ -525,7 +527,7 @@ export const Routes = {
*
* @param [messageID='@original'] The message ID to change, defaulted to `@original`
*/
webhookMessage(webhookID: string, webhookToken: string, messageID = '@original') {
webhookMessage(webhookID: Snowflake, webhookToken: string, messageID = '@original') {
return `/webhooks/${webhookID}/${webhookToken}/messages/${messageID}`;
},
@@ -534,7 +536,7 @@ export const Routes = {
* - POST `/webhooks/{webhook.id}/{webhook.token}/github`
* - POST `/webhooks/{webhook.id}/{webhook.token}/slack`
*/
webhookPlatform(webhookID: string, webhookToken: string, platform: 'github' | 'slack') {
webhookPlatform(webhookID: Snowflake, webhookToken: string, platform: 'github' | 'slack') {
return `/webhooks/${webhookID}/${webhookToken}/${platform}`;
},
@@ -567,7 +569,7 @@ export const Routes = {
* - GET `/applications/{application.id}/commands`
* - POST `/applications/{application.id}/commands`
*/
applicationCommands(applicationID: string) {
applicationCommands(applicationID: Snowflake) {
return `/applications/${applicationID}/commands`;
},
@@ -576,7 +578,7 @@ export const Routes = {
* - PATCH `/applications/{application.id}/commands/{command.id}`
* - DELETE `/applications/{application.id}/commands/{command.id}`
*/
applicationCommand(applicationID: string, commandID: string) {
applicationCommand(applicationID: Snowflake, commandID: Snowflake) {
return `/applications/${applicationID}/commands/${commandID}`;
},
@@ -585,7 +587,7 @@ export const Routes = {
* - GET `/applications/{application.id}/guilds/{guild.id}/commands`
* - POST `/applications/{application.id}/guilds/{guild.id}/commands`
*/
applicationGuildCommands(applicationID: string, guildID: string) {
applicationGuildCommands(applicationID: Snowflake, guildID: Snowflake) {
return `/applications/${applicationID}/guilds/${guildID}/commands`;
},
@@ -594,7 +596,7 @@ export const Routes = {
* - PATCH `/applications/{application.id}/guilds/{guild.id}/commands/{command.id}`
* - DELETE `/applications/{application.id}/guilds/{guild.id}/commands/{command.id}`
*/
applicationGuildCommand(applicationID: string, guildID: string, commandID: string) {
applicationGuildCommand(applicationID: Snowflake, guildID: Snowflake, commandID: Snowflake) {
return `/applications/${applicationID}/guilds/${guildID}/commands/${commandID}`;
},
@@ -602,7 +604,7 @@ export const Routes = {
* Route for:
* - POST `/interactions/{interaction.id}/{interaction.token}/callback`
*/
interactionCallback(interactionID: string, interactionToken: string) {
interactionCallback(interactionID: Snowflake, interactionToken: string) {
return `/interactions/${interactionID}/${interactionToken}/callback`;
},
@@ -611,7 +613,7 @@ export const Routes = {
* - GET `/guilds/{guild.id}/member-verification`
* - PATCH `/guilds/{guild.id}/member-verification`
*/
guildMemberVerification(guildID: string) {
guildMemberVerification(guildID: Snowflake) {
return `/guilds/${guildID}/member-verification`;
},
};

View File

@@ -1,3 +1,4 @@
import type { Permissions, Snowflake } from '../../common/index';
import type { APIApplication, APIGuild, APIWebhook, OAuth2Scopes } from '../payloads/index';
/**
@@ -10,7 +11,7 @@ export type RESTGetAPIOauth2CurrentApplicationResult = Omit<APIApplication, 'fla
*/
export interface RESTOAuth2AuthorizationQuery {
response_type: 'code';
client_id: string;
client_id: Snowflake;
scope: string;
redirect_uri?: string;
state?: string;
@@ -29,7 +30,7 @@ export interface RESTOAuth2AuthorizationQueryResult {
* https://discord.com/developers/docs/topics/oauth2#authorization-code-grant-redirect-url-example
*/
export interface RESTPostOAuth2AccessTokenURLEncodedData {
client_id: string;
client_id: Snowflake;
client_secret: string;
grant_type: 'authorization_code';
code: string;
@@ -52,7 +53,7 @@ export interface RESTPostOAuth2AccessTokenResult {
* https://discord.com/developers/docs/topics/oauth2#authorization-code-grant-refresh-token-exchange-example
*/
export interface RESTPostOAuth2RefreshTokenURLEncodedData {
client_id: string;
client_id: Snowflake;
client_secret: string;
grant_type: 'refresh_token';
refresh_token: string;
@@ -67,7 +68,7 @@ export type RESTPostOAuth2RefreshTokenResult = RESTPostOAuth2AccessTokenResult;
*/
export interface RESTOAuth2ImplicitAuthorizationQuery {
response_type: 'token';
client_id: string;
client_id: Snowflake;
scope: string;
redirect_uri?: string;
state?: string;
@@ -96,7 +97,7 @@ export interface RESTOAuth2BotAuthorizationQuery {
/**
* Your app's client id
*/
client_id: string;
client_id: Snowflake;
/**
* Needs to include bot for the bot flow
*/
@@ -110,11 +111,11 @@ export interface RESTOAuth2BotAuthorizationQuery {
*
* See https://discord.com/developers/docs/topics/permissions
*/
permissions?: string;
permissions?: Permissions;
/**
* Pre-fills the dropdown picker with a guild for the user
*/
guild_id?: string;
guild_id?: Snowflake;
/**
* `true` or `false`—disallows the user from changing the guild dropdown
*/
@@ -125,7 +126,7 @@ export interface RESTOAuth2BotAuthorizationQuery {
* https://discord.com/developers/docs/topics/oauth2#advanced-bot-authorization
*/
export interface RESTOAuth2AdvancedBotAuthorizationQuery {
client_id: string;
client_id: Snowflake;
/**
* This assumes you include the `bot` scope alongside others (like `identify` for example)
*/
@@ -137,8 +138,8 @@ export interface RESTOAuth2AdvancedBotAuthorizationQuery {
/**
* The required permissions bitfield, stringified
*/
permissions?: string;
guild_id?: string;
permissions?: Permissions;
guild_id?: Snowflake;
disable_guild_select?: boolean;
response_type: string;
redirect_uri?: string;
@@ -147,8 +148,8 @@ export interface RESTOAuth2AdvancedBotAuthorizationQuery {
export interface RESTOAuth2AdvancedBotAuthorizationQueryResult {
code: string;
state?: string;
guild_id: string;
permissions: string;
guild_id: Snowflake;
permissions: Permissions;
}
/**

View File

@@ -1,3 +1,4 @@
import type { Permissions, Snowflake } from '../../common/index';
import type { APIChannel, APIConnection, APIUser, GuildFeature } from '../payloads/index';
/**
@@ -36,11 +37,11 @@ export interface RESTGetAPICurrentUserGuildsQuery {
/**
* Get guilds before this guild ID
*/
before?: string;
before?: Snowflake;
/**
* Get guilds after this guild ID
*/
after?: string;
after?: Snowflake;
/**
* Max number of guilds to return (1-100)
*
@@ -50,12 +51,12 @@ export interface RESTGetAPICurrentUserGuildsQuery {
}
export interface RESTAPIPartialCurrentUserGuild {
id: string;
id: Snowflake;
name: string;
icon: string | null;
owner: boolean;
features: GuildFeature[];
permissions: string;
permissions: Permissions;
}
/**

View File

@@ -1,3 +1,4 @@
import type { Snowflake } from '../../common/index';
import type { APIAllowedMentions, APIEmbed, APIMessage, APIWebhook } from '../payloads/index';
/**
@@ -58,7 +59,7 @@ export interface RESTPatchAPIWebhookJSONBody {
/**
* The new channel id this webhook should be moved to
*/
channel_id?: string;
channel_id?: Snowflake;
}
/**