Skip to content

Commit

Permalink
feat: v8 support (#14)
Browse files Browse the repository at this point in the history
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
Co-authored-by: Advaith <advaithj1@gmail.com>
  • Loading branch information
3 people authored Oct 4, 2020
1 parent dcf8ddf commit 11b95c8
Show file tree
Hide file tree
Showing 53 changed files with 4,359 additions and 15 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ out/
coverage/
.nyc_output/

debug.log

# Don't commit build outputs

v*/**/*.js
Expand Down
2 changes: 2 additions & 0 deletions common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export enum RESTJSONErrorCodes {
BotsCannotUseThisEndpoint = 20001,
OnlyBotsCanUseThisEndpoint,

AnnouncementEditLimitExceeded = 20022,

ChannelSendRateLimit = 20028,

MaximumNumberOfGuildsReached = 30001,
Expand Down
2 changes: 1 addition & 1 deletion default/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file exports all the types available in the default API version
// Thereby, things MAY break in the future

export * from '../v6';
export * from '../v8';
77 changes: 77 additions & 0 deletions v6/gateway/index.ts

Large diffs are not rendered by default.

59 changes: 59 additions & 0 deletions v6/payloads/auditLog.ts

Large diffs are not rendered by default.

32 changes: 31 additions & 1 deletion v6/payloads/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import type { APIUser } from './user';

/**
* Not documented, but partial only includes id, name, and type
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIPartialChannel {
id: string;
Expand All @@ -17,6 +18,7 @@ export interface APIPartialChannel {

/**
* https://discord.com/developers/docs/resources/channel#channel-object-channel-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIChannel extends APIPartialChannel {
guild_id?: string;
Expand All @@ -39,6 +41,7 @@ export interface APIChannel extends APIPartialChannel {

/**
* https://discord.com/developers/docs/resources/channel#channel-object-channel-types
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export enum ChannelType {
GUILD_TEXT = 0,
Expand All @@ -52,6 +55,7 @@ export enum ChannelType {

/**
* https://discord.com/developers/docs/resources/channel#message-object-message-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIMessage {
id: string;
Expand All @@ -78,13 +82,15 @@ export interface APIMessage {
application?: APIMessageApplication;
message_reference?: APIMessageReference;
flags?: MessageFlags;
referenced_message?: APIMessage | null;
}

/**
* https://discord.com/developers/docs/resources/channel#message-object-message-types
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export enum MessageType {
DEFAULT = 0,
DEFAULT,
RECIPIENT_ADD,
RECIPIENT_REMOVE,
CALL,
Expand All @@ -105,6 +111,7 @@ export enum MessageType {

/**
* https://discord.com/developers/docs/resources/channel#message-object-message-activity-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIMessageActivity {
type: MessageActivityType;
Expand All @@ -113,6 +120,7 @@ export interface APIMessageActivity {

/**
* https://discord.com/developers/docs/resources/channel#message-object-message-application-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIMessageApplication {
id: string;
Expand All @@ -124,6 +132,7 @@ export interface APIMessageApplication {

/**
* https://discord.com/developers/docs/resources/channel#message-object-message-reference-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIMessageReference {
message_id?: string;
Expand All @@ -133,6 +142,7 @@ export interface APIMessageReference {

/**
* https://discord.com/developers/docs/resources/channel#message-object-message-activity-types
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export enum MessageActivityType {
JOIN = 1,
Expand All @@ -143,6 +153,7 @@ export enum MessageActivityType {

/**
* https://discord.com/developers/docs/resources/channel#message-object-message-flags
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export enum MessageFlags {
CROSSPOSTED = 1 << 0,
Expand All @@ -154,6 +165,7 @@ export enum MessageFlags {

/**
* https://discord.com/developers/docs/resources/channel#reaction-object-reaction-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIReaction {
count: number;
Expand All @@ -163,6 +175,7 @@ export interface APIReaction {

/**
* https://discord.com/developers/docs/resources/channel#overwrite-object-overwrite-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIOverwrite {
id: string;
Expand All @@ -179,13 +192,17 @@ export interface APIOverwrite {
deny_new: string;
}

/**
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export enum OverwriteType {
Member = 'member',
Role = 'role',
}

/**
* https://discord.com/developers/docs/resources/channel#embed-object-embed-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIEmbed {
title?: string;
Expand All @@ -209,6 +226,7 @@ export interface APIEmbed {
/**
* https://discord.com/developers/docs/resources/channel#embed-object-embed-types
* @deprecated *Embed types should be considered deprecated and might be removed in a future API version*
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export enum EmbedType {
Rich = 'rich',
Expand All @@ -221,6 +239,7 @@ export enum EmbedType {

/**
* https://discord.com/developers/docs/resources/channel#embed-object-embed-thumbnail-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIEmbedThumbnail {
url?: string;
Expand All @@ -231,6 +250,7 @@ export interface APIEmbedThumbnail {

/**
* https://discord.com/developers/docs/resources/channel#embed-object-embed-video-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIEmbedVideo {
url?: string;
Expand All @@ -240,6 +260,7 @@ export interface APIEmbedVideo {

/**
* https://discord.com/developers/docs/resources/channel#embed-object-embed-image-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIEmbedImage {
url?: string;
Expand All @@ -250,6 +271,7 @@ export interface APIEmbedImage {

/**
* https://discord.com/developers/docs/resources/channel#embed-object-embed-provider-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIEmbedProvider {
name?: string;
Expand All @@ -258,6 +280,7 @@ export interface APIEmbedProvider {

/**
* https://discord.com/developers/docs/resources/channel#embed-object-embed-author-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIEmbedAuthor {
name?: string;
Expand All @@ -268,6 +291,7 @@ export interface APIEmbedAuthor {

/**
* https://discord.com/developers/docs/resources/channel#embed-object-embed-footer-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIEmbedFooter {
text: string;
Expand All @@ -277,6 +301,7 @@ export interface APIEmbedFooter {

/**
* https://discord.com/developers/docs/resources/channel#embed-object-embed-field-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIEmbedField {
name: string;
Expand All @@ -286,6 +311,7 @@ export interface APIEmbedField {

/**
* https://discord.com/developers/docs/resources/channel#attachment-object-attachment-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIAttachment {
id: string;
Expand All @@ -299,6 +325,7 @@ export interface APIAttachment {

/**
* https://discord.com/developers/docs/resources/channel#channel-mention-object-channel-mention-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIChannelMention {
id: string;
Expand All @@ -307,6 +334,9 @@ export interface APIChannelMention {
name: string;
}

/**
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIFollowedChannel {
channel_id: string;
webhook_id: string;
Expand Down
2 changes: 2 additions & 0 deletions v6/payloads/emoji.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type { APIUser } from './user';

/**
* Not documented but mentioned
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIPartialEmoji {
id: string | null;
Expand All @@ -15,6 +16,7 @@ export interface APIPartialEmoji {

/**
* https://discord.com/developers/docs/resources/emoji#emoji-object-emoji-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIEmoji extends APIPartialEmoji {
roles?: string[];
Expand Down
16 changes: 16 additions & 0 deletions v6/payloads/gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ import type { APIUser } from './user';

/**
* https://discord.com/developers/docs/topics/gateway#get-gateway
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIGatewayInfo {
url: string;
}

/**
* https://discord.com/developers/docs/topics/gateway#get-gateway-bot
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIGatewayBotInfo extends APIGatewayInfo {
shards: number;
Expand All @@ -22,6 +24,7 @@ export interface APIGatewayBotInfo extends APIGatewayInfo {

/**
* https://discord.com/developers/docs/topics/gateway#session-start-limit-object
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIGatewaySessionStartLimit {
total: number;
Expand All @@ -31,6 +34,7 @@ export interface APIGatewaySessionStartLimit {

/**
* https://discord.com/developers/docs/topics/gateway#presence-update-presence-update-event-fields
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface GatewayPresenceUpdate {
user: Partial<APIUser> & {
Expand All @@ -46,6 +50,9 @@ export interface GatewayPresenceUpdate {
nick?: string | null;
}

/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export enum PresenceUpdateStatus {
DoNotDisturb = 'dnd',
Idle = 'idle',
Expand All @@ -56,11 +63,13 @@ export enum PresenceUpdateStatus {

/**
* https://discord.com/developers/docs/topics/gateway#client-status-object
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayPresenceClientStatus = Partial<Record<'desktop' | 'mobile' | 'web', PresenceUpdateStatus>>;

/**
* https://discord.com/developers/docs/topics/gateway#activity-object
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface GatewayActivity {
name: string;
Expand All @@ -81,6 +90,7 @@ export interface GatewayActivity {

/**
* https://discord.com/developers/docs/topics/gateway#activity-object-activity-types
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export enum ActivityType {
Game,
Expand All @@ -93,6 +103,7 @@ export enum ActivityType {

/**
* https://discord.com/developers/docs/topics/gateway#activity-object-activity-timestamps
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface GatewayActivityTimestamps {
start?: number;
Expand All @@ -101,11 +112,13 @@ export interface GatewayActivityTimestamps {

/**
* https://discord.com/developers/docs/topics/gateway#activity-object-activity-emoji
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayActivityEmoji = Partial<Pick<APIEmoji, 'name' | 'animated'>> & Pick<APIEmoji, 'id'>;

/**
* https://discord.com/developers/docs/topics/gateway#activity-object-activity-party
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface GatewayActivityParty {
id?: string;
Expand All @@ -115,18 +128,21 @@ export interface GatewayActivityParty {

/**
* https://discord.com/developers/docs/topics/gateway#activity-object-activity-assets
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayActivityAssets = Partial<
Record<'large_image' | 'large_text' | 'small_image' | 'small_text', string>
>;

/**
* https://discord.com/developers/docs/topics/gateway#activity-object-activity-secrets
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayActivitySecrets = Partial<Record<'join' | 'spectate' | 'match', string>>;

/**
* https://discord.com/developers/docs/topics/gateway#activity-object-activity-flags
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export enum ActivityFlags {
INSTANCE = 1 << 0,
Expand Down
Loading

0 comments on commit 11b95c8

Please sign in to comment.