Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Add more missing stuff #160

Merged
merged 5 commits into from
Jul 20, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions deno/gateway/v8.ts
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,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 +734,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 +1376,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 +1505,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 +1529,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 Expand Up @@ -1624,3 +1625,7 @@ interface MessageReactionRemoveData {
guild_id?: Snowflake;
}
// #endregion Shared

type Nullable<T> = {
[P in keyof T]: T[P] | null;
};
17 changes: 11 additions & 6 deletions deno/gateway/v9.ts
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,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 +744,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 +1465,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 +1602,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 +1618,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 Expand Up @@ -1713,3 +1714,7 @@ interface MessageReactionRemoveData {
guild_id?: Snowflake;
}
// #endregion Shared

type Nullable<T> = {
[P in keyof T]: T[P] | null;
};
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
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
101 changes: 0 additions & 101 deletions deno/payloads/v8/oauth2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,107 +2,6 @@
* Types extracted from https://discord.com/developers/docs/topics/oauth2
*/

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

/**
* https://discord.com/developers/docs/topics/oauth2#get-current-application-information-response-structure
*/
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
*/
flags: ApplicationFlags;
}

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,
}

export enum OAuth2Scopes {
/**
* For oauth2 bots, this puts the bot in the user's selected guild by default
Expand Down
4 changes: 4 additions & 0 deletions deno/payloads/v8/teams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ export interface APITeam {
* The members of the team
*/
members: APITeamMember[];
/**
* The name of the team
*/
name: string;
/**
* The user id of the current team owner
*/
Expand Down
Loading