Skip to content

Commit

Permalink
chore: Add more missing stuff (#160)
Browse files Browse the repository at this point in the history
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

BREAKING CHANGE: `GatewayGuildMemberUpdateDispatchData#joined_at` is properly marked as nullable now

BREAKING CHANGE: In v9, `thread_id` was incorrectly placed in `RESTPostAPIWebhookWithTokenJSONBody` and has been moved to `RESTPostAPIWebhookWithTokenQuery`
  • Loading branch information
advaith1 committed Jul 20, 2021
1 parent 8dbeca0 commit d009554
Show file tree
Hide file tree
Showing 73 changed files with 1,005 additions and 593 deletions.
16 changes: 9 additions & 7 deletions deno/gateway/v8.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import type {
InviteTargetType,
PresenceUpdateStatus,
} from '../payloads/v8/mod.ts';
import type { Nullable } from '../utils/internals.ts';

export * from './common.ts';

Expand Down Expand Up @@ -441,7 +442,7 @@ export interface GatewayReadyDispatchData {
/**
* Contains `id` and `flags`
*
* See https://discord.com/developers/docs/topics/oauth2#application-object
* See https://discord.com/developers/docs/resources/application#application-object
*/
application: Pick<APIApplication, 'id' | 'flags'>;
}
Expand Down Expand Up @@ -734,9 +735,10 @@ export type GatewayGuildMemberUpdateDispatch = DataPayload<
/**
* https://discord.com/developers/docs/topics/gateway#guild-member-update
*/
export type GatewayGuildMemberUpdateDispatchData = Omit<APIGuildMember, 'deaf' | 'mute' | 'user'> &
export type GatewayGuildMemberUpdateDispatchData = Omit<APIGuildMember, 'deaf' | 'mute' | 'user' | 'joined_at'> &
Partial<Pick<APIGuildMember, 'deaf' | 'mute'>> &
Required<Pick<APIGuildMember, 'user'>> & {
Required<Pick<APIGuildMember, 'user'>> &
Nullable<Pick<APIGuildMember, 'joined_at'>> & {
/**
* The id of the guild
*/
Expand Down Expand Up @@ -1375,7 +1377,7 @@ export interface GatewayIdentifyData {
/**
* Presence structure for initial presence information
*
* See https://discord.com/developers/docs/topics/gateway#update-status
* See https://discord.com/developers/docs/topics/gateway#update-presence
*/
presence?: GatewayPresenceUpdateData;
/**
Expand Down Expand Up @@ -1504,15 +1506,15 @@ export interface GatewayVoiceStateUpdateData {
}

/**
* https://discord.com/developers/docs/topics/gateway#update-status
* https://discord.com/developers/docs/topics/gateway#update-presence
*/
export interface GatewayUpdatePresence {
op: GatewayOpcodes.PresenceUpdate;
d: GatewayPresenceUpdateData;
}

/**
* https://discord.com/developers/docs/topics/gateway#update-status-gateway-status-update-structure
* https://discord.com/developers/docs/topics/gateway#update-presence-gateway-presence-update-structure
*/
export interface GatewayPresenceUpdateData {
/**
Expand All @@ -1528,7 +1530,7 @@ export interface GatewayPresenceUpdateData {
/**
* The user's new status
*
* See https://discord.com/developers/docs/topics/gateway#update-status-status-types
* See https://discord.com/developers/docs/topics/gateway#update-presence-status-types
*/
status: PresenceUpdateStatus;
/**
Expand Down
14 changes: 8 additions & 6 deletions deno/gateway/v9.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import type {
InviteTargetType,
PresenceUpdateStatus,
} from '../payloads/v9/mod.ts';
import type { Nullable } from '../utils/internals.ts';

export * from './common.ts';

Expand Down Expand Up @@ -451,7 +452,7 @@ export interface GatewayReadyDispatchData {
/**
* Contains `id` and `flags`
*
* See https://discord.com/developers/docs/topics/oauth2#application-object
* See https://discord.com/developers/docs/resources/application#application-object
*/
application: Pick<APIApplication, 'id' | 'flags'>;
}
Expand Down Expand Up @@ -744,9 +745,10 @@ export type GatewayGuildMemberUpdateDispatch = DataPayload<
/**
* https://discord.com/developers/docs/topics/gateway#guild-member-update
*/
export type GatewayGuildMemberUpdateDispatchData = Omit<APIGuildMember, 'deaf' | 'mute' | 'user'> &
export type GatewayGuildMemberUpdateDispatchData = Omit<APIGuildMember, 'deaf' | 'mute' | 'user' | 'joined_at'> &
Partial<Pick<APIGuildMember, 'deaf' | 'mute'>> &
Required<Pick<APIGuildMember, 'user'>> & {
Required<Pick<APIGuildMember, 'user'>> &
Nullable<Pick<APIGuildMember, 'joined_at'>> & {
/**
* The id of the guild
*/
Expand Down Expand Up @@ -1464,7 +1466,7 @@ export interface GatewayIdentifyData {
/**
* Presence structure for initial presence information
*
* See https://discord.com/developers/docs/topics/gateway#update-status
* See https://discord.com/developers/docs/topics/gateway#update-presence
*/
presence?: GatewayPresenceUpdateData;
/**
Expand Down Expand Up @@ -1601,7 +1603,7 @@ export interface GatewayUpdatePresence {
}

/**
* https://discord.com/developers/docs/topics/gateway#update-status-gateway-status-update-structure
* https://discord.com/developers/docs/topics/gateway#update-presence-gateway-presence-update-structure
*/
export interface GatewayPresenceUpdateData {
/**
Expand All @@ -1617,7 +1619,7 @@ export interface GatewayPresenceUpdateData {
/**
* The user's new status
*
* See https://discord.com/developers/docs/topics/gateway#update-status-status-types
* See https://discord.com/developers/docs/topics/gateway#update-presence-status-types
*/
status: PresenceUpdateStatus;
/**
Expand Down
10 changes: 5 additions & 5 deletions deno/payloads/v8/_interactions/base.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Permissions, Snowflake } from '../../../globals.ts';
import { InteractionType } from '../../v8.ts';
import { APIMessage } from '../channel.ts';
import { APIGuildMember } from '../guild.ts';
import { APIUser } from '../user.ts';
import type { Permissions, Snowflake } from '../../../globals.ts';
import type { InteractionType } from '../../v8.ts';
import type { APIMessage } from '../channel.ts';
import type { APIGuildMember } from '../guild.ts';
import type { APIUser } from '../user.ts';

/**
* https://discord.com/developers/docs/interactions/slash-commands#message-interaction-object-message-interaction-structure
Expand Down
6 changes: 3 additions & 3 deletions deno/payloads/v8/_interactions/messageComponents.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ComponentType } from '../channel.ts';
import { APIBaseInteraction, InteractionType } from '../interactions.ts';
import { APIDMInteractionWrapper, APIGuildInteractionWrapper } from './base.ts';
import type { ComponentType } from '../channel.ts';
import type { APIBaseInteraction, InteractionType } from '../interactions.ts';
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from './base.ts';

export type APIMessageComponentInteraction = APIBaseInteraction<
InteractionType.MessageComponent,
Expand Down
4 changes: 2 additions & 2 deletions deno/payloads/v8/_interactions/responses.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { MessageFlags } from '../mod.ts';
import { RESTPostAPIWebhookWithTokenJSONBody } from '../../../v8.ts';
import type { MessageFlags } from '../mod.ts';
import type { RESTPostAPIWebhookWithTokenJSONBody } from '../../../v8.ts';

/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-object-interaction-request-type
Expand Down
12 changes: 6 additions & 6 deletions deno/payloads/v8/_interactions/slashCommands.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { APIRole, APIUser } from '../mod.ts';
import { Permissions, Snowflake } from '../../../globals.ts';
import { APIPartialChannel } from '../channel.ts';
import { APIGuildMember } from '../guild.ts';
import { APIBaseInteraction, APIDMInteractionWrapper, APIGuildInteractionWrapper } from './base.ts';
import { InteractionType } from './responses.ts';
import type { APIRole, APIUser } from '../mod.ts';
import type { Permissions, Snowflake } from '../../../globals.ts';
import type { APIPartialChannel } from '../channel.ts';
import type { APIGuildMember } from '../guild.ts';
import type { APIBaseInteraction, APIDMInteractionWrapper, APIGuildInteractionWrapper } from './base.ts';
import type { InteractionType } from './responses.ts';

/**
* https://discord.com/developers/docs/interactions/slash-commands#application-command-object
Expand Down
109 changes: 109 additions & 0 deletions deno/payloads/v8/application.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
/**
* Types extracted from https://discord.com/developers/docs/resources/application
*/

import type { Snowflake } from '../../globals.ts';
import type { APITeam } from './teams.ts';
import type { APIUser } from './user.ts';

/**
* https://discord.com/developers/docs/resources/application#application-object
*/
export interface APIApplication {
/**
* The id of the app
*/
id: Snowflake;
/**
* The name of the app
*/
name: string;
/**
* The icon hash of the app
*/
icon: string | null;
/**
* The description of the app
*/
description: string;
/**
* An array of rpc origin urls, if rpc is enabled
*/
rpc_origins?: string[];
/**
* When `false` only app owner can join the app's bot to guilds
*/
bot_public: boolean;
/**
* When `true` the app's bot will only join upon completion of the full oauth2 code grant flow
*/
bot_require_code_grant: boolean;
/**
* The url of the application's terms of service
*/
terms_of_service_url?: string;
/**
* The url of the application's privacy policy
*/
privacy_policy_url?: string;
/**
* Partial user object containing info on the owner of the application
*
* See https://discord.com/developers/docs/resources/user#user-object
*/
owner?: APIUser;
/**
* If this application is a game sold on Discord, this field will be the summary field for the store page
* of its primary sku
*/
summary: string;
/**
* The hexadecimal encoded key for verification in interactions and the GameSDK's GetTicket function
*
* See https://discord.com/developers/docs/game-sdk/applications#get-ticket
*/
verify_key: string;
/**
* The team this application belongs to
*
* See https://discord.com/developers/docs/topics/teams#data-models-team-object
*/
team: APITeam | null;
/**
* If this application is a game sold on Discord, this field will be the guild to which it has been linked
*/
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?: Snowflake;
/**
* If this application is a game sold on Discord, this field will be the URL slug that links to the store page
*/
slug?: string;
/**
* If this application is a game sold on Discord, this field will be the hash of the image on store embeds
*/
cover_image?: string;
/**
* The application's public flags
*
* See https://discord.com/developers/docs/resources/application#application-object-application-flags
*/
flags: ApplicationFlags;
}

/**
* https://discord.com/developers/docs/resources/application#application-object-application-flags
*/
export enum ApplicationFlags {
ManagedEmoji = 1 << 2,
GroupDMCreate = 1 << 4,
RPCHasConnected = 1 << 11,
GatewayPresence = 1 << 12,
GatewayPresenceLimited = 1 << 13,
GatewayGuildMembers = 1 << 14,
GatewayGuildMembersLimited = 1 << 15,
VerificationPendingGuildLimit = 1 << 16,
Embedded = 1 << 17,
}
4 changes: 2 additions & 2 deletions deno/payloads/v8/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type { Permissions, Snowflake } from '../../globals.ts';
import type { APIPartialEmoji } from './emoji.ts';
import type { APIGuildMember } from './guild.ts';
import type { APIMessageInteraction } from './interactions.ts';
import type { APIApplication } from './oauth2.ts';
import type { APIApplication } from './application.ts';
import type { APIRole } from './permissions.ts';
import type { APISticker, APIStickerItem } from './sticker.ts';
import type { APIUser } from './user.ts';
Expand Down Expand Up @@ -560,7 +560,7 @@ export interface APIEmbed {
/**
* Description of embed
*
* Length limit: 2048 characters
* Length limit: 4096 characters
*/
description?: string;
/**
Expand Down
2 changes: 1 addition & 1 deletion deno/payloads/v8/guild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ export interface APIGuild extends APIPartialGuild {
*/
presences?: GatewayPresenceUpdate[];
/**
* The maximum number of presences for the guild (the default value, currently 25000, is in effect when `null` is returned)
* The maximum number of presences for the guild (`null` is always returned, apart from the largest of guilds)
*/
max_presences?: number | null;
/**
Expand Down
4 changes: 2 additions & 2 deletions deno/payloads/v8/interactions.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {
import type {
APIMessageComponentDMInteraction,
APIMessageComponentGuildInteraction,
APIMessageComponentInteraction,
} from './_interactions/messageComponents.ts';
import {
import type {
APIApplicationCommandDMInteraction,
APIApplicationCommandGuildInteraction,
APIApplicationCommandInteraction,
Expand Down
2 changes: 1 addition & 1 deletion deno/payloads/v8/invite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import type { APIPartialChannel } from './channel.ts';
import type { APIPartialGuild } from './guild.ts';
import type { APIApplication } from './oauth2.ts';
import type { APIApplication } from './application.ts';
import type { APIInviteStageInstance } from './stageInstance.ts';
import type { APIUser } from './user.ts';

Expand Down
1 change: 1 addition & 0 deletions deno/payloads/v8/mod.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './application.ts';
export * from './auditLog.ts';
export * from './channel.ts';
export * from './emoji.ts';
Expand Down
Loading

0 comments on commit d009554

Please sign in to comment.