Compare commits

...

39 Commits

Author SHA1 Message Date
didinele
c28ef6c3d9 chore: RESTPatchAPIGuildJSONBody system_channel_flags is optional; release 0.11.2 (#55) 2020-12-20 18:48:52 +02:00
Vlad Frangu
8c43eae001 chore: release 0.11.1 (#54) 2020-12-19 17:51:44 +02:00
didinele
ba4c0d78f4 fix(RESTPostAPIGuildsJSONBody): system_channel_flags is optional (#53) 2020-12-19 16:29:52 +02:00
didinele
2b89beb52b fix(APIAuditLogEntry): user_id is not nullable (#52) 2020-12-19 16:00:08 +02:00
Vlad Frangu
ec9002fc56 chore: release 0.11.0 (#51) 2020-12-19 15:25:29 +02:00
Vlad Frangu
5d0f885d25 chore: separate gateway payload data into separate exported types (#50) 2020-12-19 14:52:50 +02:00
Vlad Frangu
91cf0d31d7 chore: Slash Commands typings (#44)
Co-authored-by: Sugden <28943913+NotSugden@users.noreply.github.com>
2020-12-19 01:03:22 +02:00
Vlad Frangu
c2f0deeebd fix(APIGuildMember): drop nullability of pending prop (#49) 2020-12-18 21:51:04 +02:00
didinele
018fc4f8ea fix(RESTPatchAPIGuildJSONBody): multiple properties are actually nullable (#48) 2020-12-18 15:37:27 +02:00
Vlad Frangu
b832b24603 chore: add pending property to GuildMember (#47)
ref: https://github.com/discord/discord-api-docs/pull/2345
2020-12-17 10:17:31 +02:00
TTtie
8d77142ca5 types(GatewayChannelPinsUpdateDispatch): make last_pin_timestamp nullable (#46)
Ref: 14460930d8

Ref: discord/ discord-api-docs #2215
2020-12-13 13:00:51 +02:00
Vlad Frangu
6296ac9e4f chore: fix routes which were wrong; release 0.10.0 (#43) 2020-12-09 13:11:56 +02:00
Advaith
7d873f73c7 feat: server templates (#25)
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
2020-11-23 13:39:55 +02:00
Vlad Frangu
60c38fd32c chore: add missing voice op code; release 0.9.1 (#42) 2020-11-22 21:18:12 +02:00
Vlad Frangu
e196e65254 chore: release 0.9.0 (#41) 2020-11-22 20:42:55 +02:00
Advaith
21b9ae4aaf feat(Message): reply updates (#34)
* feat(allowedmentions): replied_user

* feat(message): message_reference channel_id is now optional

* fix: make message_id required when sending

* chore: export APIMessageReferenceSend
2020-11-21 16:22:32 +02:00
Advaith
39ea1f4429 feat(Message): Stickers (#32)
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
2020-11-21 16:19:13 +02:00
Vlad Frangu
fde45f9235 chore: rename INLINE_REPLY to REPLY (#40) 2020-11-17 13:37:25 +02:00
Vlad Frangu
2ee557a598 chore: remove RESTGetAPIGuildIntegrationQuery (per Discord) (#38) 2020-11-04 11:38:45 +02:00
Vlad Frangu
fed4749dd4 chore: release 0.8.0 (#37) 2020-11-03 18:55:27 +02:00
Souji
666a0c7152 fix: webhookPlatform route (#36) 2020-11-03 18:29:18 +02:00
Souji
e40530599e chore: update API import to use v8 in readme (#35) 2020-11-03 16:48:42 +02:00
Vlad Frangu
7992fab135 chore: fix mistypes (literally) for inline replies (#33) 2020-10-19 11:08:43 +03:00
Jan
61db1eee25 fix(GatewayPresence): correct type for sent activity objects (#30) 2020-10-18 23:46:29 +03:00
Vlad Frangu
363d914934 chore: release 0.7.0 (#29) 2020-10-18 14:43:42 +03:00
Jan
91c63f05ca fix(GatewayIdentify): use correct presence interface (#28) 2020-10-18 14:31:20 +03:00
Advaith
f058ed6aa1 feat(APIGuildWidgetMember): add activity and use proper status type (#24) 2020-10-18 14:20:58 +03:00
didinele
0982610731 fix(GatewayHeartbeat): d is nullable (#26) 2020-10-18 14:14:08 +03:00
Vlad Frangu
e2015c63e1 chore: release 0.6.0 (#23) 2020-10-04 22:35:00 +03:00
Zaid - Nico
11b95c8609 feat: v8 support (#14)
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
Co-authored-by: Advaith <advaithj1@gmail.com>
2020-10-04 21:23:29 +03:00
Sugden
dcf8ddf25b fix(RESTPostAPIGuildsJSONBody): use correct types (#22)
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
2020-10-02 13:00:18 +03:00
Sugden
061a147fbb fix(APIChannel): position is optional (#21) 2020-09-20 22:43:14 +03:00
Vlad Frangu
f375cbe3e3 chore: release 0.5.0 (#20) 2020-09-19 15:51:34 +03:00
Advaith
97c7b4ea24 fix(*): correct typos (#18)
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
2020-09-19 14:59:11 +03:00
Sugden
9e5c5b5aac fix(GatewayIdentifyProperties): rename device to $device (#17)
ref: https://discord.com/developers/docs/topics/gateway#identify-identify-connection-properties
2020-09-19 14:50:13 +03:00
Sugden
8cf1ba3f4f fix(APIUser): premium_type is optional (#19) 2020-09-19 14:49:39 +03:00
Vlad Frangu
10fdeba128 feat: add oauth2 types (#16) 2020-09-18 15:41:47 +03:00
Vlad Frangu
dd862193de chore: fix audit log types and release 0.4.0 (#15) 2020-09-16 20:24:56 +03:00
TTtie
94d0a16805 feat(ActivityType): add Competing activity type (#11)
Ref: cd6c72a9a2
2020-09-15 22:58:52 +03:00
63 changed files with 6140 additions and 694 deletions

2
.github/FUNDING.yml vendored
View File

@@ -1,6 +1,6 @@
# These are supported funding model platforms
github: []
github: [vladfrangu]
patreon: vladfrangu
open_collective: # Replace with a single Open Collective username
ko_fi: wolfgalvlad

2
.gitignore vendored
View File

@@ -4,6 +4,8 @@ out/
coverage/
.nyc_output/
debug.log
# Don't commit build outputs
v*/**/*.js

View File

@@ -1,7 +0,0 @@
# Changelog
This will be a list of changes that happen between versions
## 0.1.0
Initial release

View File

@@ -31,6 +31,8 @@ The exports of each API version is split into three main parts:
- For example, `RESTPostAPIChannelMessageJSONBody` or `RESTGetAPIGatewayBotInfoResult`.
- Some exported types (specifically OAuth2 related ones) may not respect this entire structure due to the nature of the fields. They will start with either `RESTOAuth2` or with something similar to `REST<HTTP Method>OAuth2`
- If a type ends with `Result`, then it represents the expected result by calling its accompanying route.
- Types that are exported as `never` usually mean the result will be a `204 No Content`, so you can safely ignore it. This does **not** account for errors.
@@ -48,21 +50,21 @@ You can `require` / `import` the module directly, which will give you the latest
> We **strongly recommend** you use a version when importing this module! This will prevent breaking changes when updating the module.
```js
const { APIUserData } = require('discord-api-types');
const { APIUser } = require('discord-api-types');
```
```ts
// TypeScript/ES Module support
import { APIUserData } from 'discord-api-types';
import { APIUser } from 'discord-api-types';
```
You should instead consider adding the API version you want to target by appending `/v*`, where the `*` represents the API version.
```js
const { APIUserData } = require('discord-api-types/v6');
const { APIUser } = require('discord-api-types/v8');
```
```ts
// TypeScript/ES Module support
import { APIUserData } from 'discord-api-types/v6';
import { APIUser } from 'discord-api-types/v8';
```

View File

@@ -1,7 +1,7 @@
/**
* https://discord.com/developers/docs/topics/opcodes-and-status-codes#json-json-error-codes
*/
export enum RESTJSONErrorCodes {
export const enum RESTJSONErrorCodes {
GeneralError,
UnknownAccount = 10001,
@@ -18,7 +18,7 @@ export enum RESTJSONErrorCodes {
UnknownToken,
UnknownUser,
UnknownEmoji,
UnknownWebook,
UnknownWebhook,
UnknownBan = 10026,
UnknownSKU,
@@ -33,6 +33,8 @@ export enum RESTJSONErrorCodes {
BotsCannotUseThisEndpoint = 20001,
OnlyBotsCanUseThisEndpoint,
AnnouncementEditLimitExceeded = 20022,
ChannelSendRateLimit = 20028,
MaximumNumberOfGuildsReached = 30001,
@@ -50,6 +52,8 @@ export enum RESTJSONErrorCodes {
MaximumNumberOfAttachmentsInAMessageReached = 30015,
MaximumNumberOfInvitesReached,
GuildAlreadyHasTemplate = 30031,
Unauthorized = 40001,
VerifyYourAccount,
@@ -57,6 +61,8 @@ export enum RESTJSONErrorCodes {
FeatureTemporarilyDisabledServerSide,
UserBannedFromThisGuild,
ThisMessageWasAlreadyCrossposted = 40033,
MissingAccess = 50001,
InvalidAccountType,
CannotExecuteActionOnDMChannel,
@@ -90,6 +96,8 @@ export enum RESTJSONErrorCodes {
CannotDeleteChannelRequiredForCommunityGuilds = 50074,
InvalidStickerSent = 50081,
TwoFactorAuthenticationIsRequired = 60003,
ReactionWasBlocked = 90001,
@@ -100,7 +108,7 @@ export enum RESTJSONErrorCodes {
/**
* https://discord.com/developers/docs/topics/opcodes-and-status-codes#rpc-rpc-error-codes
*/
export enum RPCErrorCodes {
export const enum RPCErrorCodes {
UnknownError = 1000,
InvalidPayload = 4000,
@@ -125,7 +133,7 @@ export enum RPCErrorCodes {
/**
* https://discord.com/developers/docs/topics/opcodes-and-status-codes#rpc-rpc-close-event-codes
*/
export enum RPCCloseEventCodes {
export const enum RPCCloseEventCodes {
InvalidClientID = 4000,
InvalidOrigin,
RateLimited,

View File

@@ -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';

915
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"name": "discord-api-types",
"version": "0.3.0",
"version": "0.11.2",
"description": "Discord API typings that are kept up to date for use in bot library creation.",
"main": "default/index.js",
"scripts": {
@@ -29,18 +29,18 @@
"node": ">=12"
},
"devDependencies": {
"@commitlint/cli": "^9.1.2",
"@commitlint/config-angular": "^9.1.2",
"@typescript-eslint/eslint-plugin": "^4.1.0",
"@typescript-eslint/parser": "^4.1.0",
"eslint": "^7.8.1",
"@commitlint/cli": "^11.0.0",
"@commitlint/config-angular": "^11.0.0",
"@typescript-eslint/eslint-plugin": "^4.10.0",
"@typescript-eslint/parser": "^4.10.0",
"eslint": "^7.15.0",
"eslint-config-marine": "^7.2.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-prettier": "^3.1.4",
"husky": "^4.3.0",
"lint-staged": "^10.3.0",
"prettier": "^2.1.1",
"typescript": "^4.0.2"
"eslint-config-prettier": "^7.0.0",
"eslint-plugin-prettier": "^3.3.0",
"husky": "^4.3.6",
"lint-staged": "^10.5.3",
"prettier": "^2.2.1",
"typescript": "^4.1.3"
},
"repository": {
"type": "git",

View File

@@ -12,7 +12,8 @@
"removeComments": false,
"target": "ES2020",
"importsNotUsedAsValues": "error",
"strictNullChecks": true
"strictNullChecks": true,
"preserveConstEnums": true
},
"exclude": [
"node_modules",

View File

@@ -18,10 +18,14 @@ import type {
PresenceUpdateStatus,
} from '../payloads';
/**
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export const GatewayVersion = '6';
/**
* https://discord.com/developers/docs/topics/opcodes-and-status-codes#gateway-gateway-opcodes
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export enum GatewayOPCodes {
Dispatch,
@@ -40,6 +44,7 @@ export enum GatewayOPCodes {
/**
* https://discord.com/developers/docs/topics/opcodes-and-status-codes#gateway-gateway-close-event-codes
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export enum GatewayCloseCodes {
UnknownError = 4000,
@@ -61,6 +66,7 @@ export enum GatewayCloseCodes {
/**
* https://discord.com/developers/docs/topics/opcodes-and-status-codes#voice-voice-opcodes
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export enum VoiceOPCodes {
Identify,
@@ -79,6 +85,7 @@ export enum VoiceOPCodes {
/**
* https://discord.com/developers/docs/topics/opcodes-and-status-codes#voice-voice-close-event-codes
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export enum VoiceCloseCodes {
UnknownOpCode = 4001,
@@ -100,6 +107,7 @@ export enum VoiceCloseCodes {
/**
* https://discord.com/developers/docs/topics/gateway#list-of-intents
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export enum GatewayIntentBits {
GUILDS = 1 << 0,
@@ -121,6 +129,7 @@ export enum GatewayIntentBits {
/**
* https://discord.com/developers/docs/topics/gateway#commands-and-events-gateway-events
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export enum GatewayDispatchEvents {
Ready = 'READY',
@@ -161,6 +170,9 @@ export enum GatewayDispatchEvents {
WebhooksUpdate = 'WEBHOOKS_UPDATE',
}
/**
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewaySendPayload =
| GatewayHeartbeat
| GatewayIdentify
@@ -169,6 +181,9 @@ export type GatewaySendPayload =
| GatewayResume
| GatewayRequestGuildMembers;
/**
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayReceivePayload =
| GatewayHello
| GatewayHeartbeatRequest
@@ -177,6 +192,9 @@ export type GatewayReceivePayload =
| GatewayReconnect
| GatewayDispatchPayload;
/**
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayDispatchPayload =
| GatewayReadyDispatch
| GatewayResumedDispatch
@@ -213,6 +231,7 @@ export type GatewayDispatchPayload =
// #region Dispatch Payloads
/**
* https://discord.com/developers/docs/topics/gateway#hello
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface GatewayHello extends NonDispatchPayload {
op: GatewayOPCodes.Hello;
@@ -223,6 +242,7 @@ export interface GatewayHello extends NonDispatchPayload {
/**
* https://discord.com/developers/docs/topics/gateway#heartbeating
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface GatewayHeartbeatRequest extends NonDispatchPayload {
op: GatewayOPCodes.Heartbeat;
@@ -231,6 +251,7 @@ export interface GatewayHeartbeatRequest extends NonDispatchPayload {
/**
* https://discord.com/developers/docs/topics/gateway#heartbeating-example-gateway-heartbeat-ack
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface GatewayHeartbeatAck extends NonDispatchPayload {
op: GatewayOPCodes.HeartbeatAck;
@@ -239,6 +260,7 @@ export interface GatewayHeartbeatAck extends NonDispatchPayload {
/**
* https://discord.com/developers/docs/topics/gateway#invalid-session
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface GatewayInvalidSession extends NonDispatchPayload {
op: GatewayOPCodes.InvalidSession;
@@ -247,6 +269,7 @@ export interface GatewayInvalidSession extends NonDispatchPayload {
/**
* https://discord.com/developers/docs/topics/gateway#reconnect
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface GatewayReconnect extends NonDispatchPayload {
op: GatewayOPCodes.Reconnect;
@@ -255,6 +278,7 @@ export interface GatewayReconnect extends NonDispatchPayload {
/**
* https://discord.com/developers/docs/topics/gateway#ready
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayReadyDispatch = DataPayload<
GatewayDispatchEvents.Ready,
@@ -270,6 +294,7 @@ export type GatewayReadyDispatch = DataPayload<
/**
* https://discord.com/developers/docs/topics/gateway#resumed
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayResumedDispatch = DataPayload<GatewayDispatchEvents.Resumed, never>;
@@ -278,6 +303,7 @@ export type GatewayResumedDispatch = DataPayload<GatewayDispatchEvents.Resumed,
* https://discord.com/developers/docs/topics/gateway#channel-create
* https://discord.com/developers/docs/topics/gateway#channel-update
* https://discord.com/developers/docs/topics/gateway#channel-delete
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayChannelModifyDispatch = DataPayload<
GatewayDispatchEvents.ChannelCreate | GatewayDispatchEvents.ChannelDelete | GatewayDispatchEvents.ChannelUpdate,
@@ -285,12 +311,24 @@ export type GatewayChannelModifyDispatch = DataPayload<
>;
/* eslint-enable @typescript-eslint/indent */
/**
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayChannelCreateDispatch = GatewayChannelModifyDispatch;
/**
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayChannelUpdateDispatch = GatewayChannelModifyDispatch;
/**
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayChannelDeleteDispatch = GatewayChannelModifyDispatch;
/**
* https://discord.com/developers/docs/topics/gateway#channel-pins-update
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayChannelPinsUpdateDispatch = DataPayload<
GatewayDispatchEvents.ChannelPinsUpdate,
@@ -304,23 +342,33 @@ export type GatewayChannelPinsUpdateDispatch = DataPayload<
/**
* https://discord.com/developers/docs/topics/gateway#guild-create
* https://discord.com/developers/docs/topics/gateway#guild-update
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayGuildModifyDispatch = DataPayload<
GatewayDispatchEvents.GuildCreate | GatewayDispatchEvents.GuildUpdate,
APIGuild
>;
/**
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayGuildCreateDispatch = GatewayGuildModifyDispatch;
/**
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayGuildUpdateDispatch = GatewayGuildModifyDispatch;
/**
* https://discord.com/developers/docs/topics/gateway#guild-delete
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayGuildDeleteDispatch = DataPayload<GatewayDispatchEvents.GuildDelete, APIUnavailableGuild>;
/**
* https://discord.com/developers/docs/topics/gateway#guild-ban-add
* https://discord.com/developers/docs/topics/gateway#guild-ban-remove
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayGuildBanModifyDispatch = DataPayload<
GatewayDispatchEvents.GuildBanAdd | GatewayDispatchEvents.GuildBanRemove,
@@ -330,11 +378,19 @@ export type GatewayGuildBanModifyDispatch = DataPayload<
}
>;
/**
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayGuildBanAddDispatch = GatewayGuildBanModifyDispatch;
/**
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayGuildBanRemoveDispatch = GatewayGuildBanModifyDispatch;
/**
* https://discord.com/developers/docs/topics/gateway#guild-emojis-update
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayGuildEmojisUpdateDispatch = DataPayload<
GatewayDispatchEvents.GuildEmojisUpdate,
@@ -346,6 +402,7 @@ export type GatewayGuildEmojisUpdateDispatch = DataPayload<
/**
* https://discord.com/developers/docs/topics/gateway#guild-integrations-update
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayGuildIntegrationsUpdateDispatch = DataPayload<
GatewayDispatchEvents.GuildIntegrationsUpdate,
@@ -354,6 +411,7 @@ export type GatewayGuildIntegrationsUpdateDispatch = DataPayload<
/**
* https://discord.com/developers/docs/topics/gateway#guild-member-add
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayGuildMemberAddDispatch = DataPayload<
GatewayDispatchEvents.GuildMemberAdd,
@@ -362,6 +420,7 @@ export type GatewayGuildMemberAddDispatch = DataPayload<
/**
* https://discord.com/developers/docs/topics/gateway#guild-member-remove
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayGuildMemberRemoveDispatch = DataPayload<
GatewayDispatchEvents.GuildMemberRemove,
@@ -373,6 +432,7 @@ export type GatewayGuildMemberRemoveDispatch = DataPayload<
/**
* https://discord.com/developers/docs/topics/gateway#guild-member-update
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayGuildMemberUpdateDispatch = DataPayload<
GatewayDispatchEvents.GuildMemberUpdate,
@@ -383,6 +443,7 @@ export type GatewayGuildMemberUpdateDispatch = DataPayload<
/**
* https://discord.com/developers/docs/topics/gateway#guild-members-chunk
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayGuildMembersChunkDispatch = DataPayload<
GatewayDispatchEvents.GuildMembersChunk,
@@ -400,6 +461,7 @@ export type GatewayGuildMembersChunkDispatch = DataPayload<
/**
* https://discord.com/developers/docs/topics/gateway#guild-role-create
* https://discord.com/developers/docs/topics/gateway#guild-role-update
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayGuildRoleModifyDispatch = DataPayload<
GatewayDispatchEvents.GuildRoleCreate | GatewayDispatchEvents.GuildRoleUpdate,
@@ -409,11 +471,19 @@ export type GatewayGuildRoleModifyDispatch = DataPayload<
}
>;
/**
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayGuildRoleCreateDispatch = GatewayGuildRoleModifyDispatch;
/**
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayGuildRoleUpdateDispatch = GatewayGuildRoleModifyDispatch;
/**
* https://discord.com/developers/docs/topics/gateway#guild-role-delete
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayGuildRoleDeleteDispatch = DataPayload<
GatewayDispatchEvents.GuildRoleDelete,
@@ -425,6 +495,7 @@ export type GatewayGuildRoleDeleteDispatch = DataPayload<
/**
* https://discord.com/developers/docs/topics/gateway#invite-create
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayInviteCreateDispatch = DataPayload<
GatewayDispatchEvents.InviteCreate,
@@ -445,6 +516,7 @@ export type GatewayInviteCreateDispatch = DataPayload<
/**
* https://discord.com/developers/docs/topics/gateway#invite-delete
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayInviteDeleteDispatch = DataPayload<
GatewayDispatchEvents.InviteDelete,
@@ -457,11 +529,13 @@ export type GatewayInviteDeleteDispatch = DataPayload<
/**
* https://discord.com/developers/docs/topics/gateway#message-create
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayMessageCreateDispatch = DataPayload<GatewayDispatchEvents.MessageCreate, APIMessage>;
/**
* https://discord.com/developers/docs/topics/gateway#message-update
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayMessageUpdateDispatch = DataPayload<
GatewayDispatchEvents.MessageUpdate,
@@ -470,6 +544,7 @@ export type GatewayMessageUpdateDispatch = DataPayload<
/**
* https://discord.com/developers/docs/topics/gateway#message-delete
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayMessageDeleteDispatch = DataPayload<
GatewayDispatchEvents.MessageDelete,
@@ -482,6 +557,7 @@ export type GatewayMessageDeleteDispatch = DataPayload<
/**
* https://discord.com/developers/docs/topics/gateway#message-delete-bulk
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayMessageDeleteBulkDispatch = DataPayload<
GatewayDispatchEvents.MessageDeleteBulk,
@@ -494,16 +570,19 @@ export type GatewayMessageDeleteBulkDispatch = DataPayload<
/**
* https://discord.com/developers/docs/topics/gateway#message-reaction-add
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayMessageReactionAddDispatch = ReactionData<GatewayDispatchEvents.MessageReactionAdd>;
/**
* https://discord.com/developers/docs/topics/gateway#message-reaction-remove
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayMessageReactionRemoveDispatch = ReactionData<GatewayDispatchEvents.MessageReactionRemove, 'member'>;
/**
* https://discord.com/developers/docs/topics/gateway#message-reaction-remove-all
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayMessageReactionRemoveAllDispatch = DataPayload<
GatewayDispatchEvents.MessageReactionRemoveAll,
@@ -512,6 +591,7 @@ export type GatewayMessageReactionRemoveAllDispatch = DataPayload<
/**
* https://discord.com/developers/docs/topics/gateway#message-reaction-remove-emoji
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayMessageReactionRemoveEmojiDispatch = DataPayload<
GatewayDispatchEvents.MessageReactionRemoveEmoji,
@@ -522,11 +602,13 @@ export type GatewayMessageReactionRemoveEmojiDispatch = DataPayload<
/**
* https://discord.com/developers/docs/topics/gateway#presence-update
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayPresenceUpdateDispatch = DataPayload<GatewayDispatchEvents.PresenceUpdate, RawGatewayPresenceUpdate>;
/**
* https://discord.com/developers/docs/topics/gateway#typing-start
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayTypingStartDispatch = DataPayload<
GatewayDispatchEvents.TypingStart,
@@ -541,16 +623,19 @@ export type GatewayTypingStartDispatch = DataPayload<
/**
* https://discord.com/developers/docs/topics/gateway#user-update
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayUserUpdateDispatch = DataPayload<GatewayDispatchEvents.UserUpdate, APIUser>;
/**
* https://discord.com/developers/docs/topics/gateway#voice-state-update
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayVoiceStateUpdateDispatch = DataPayload<GatewayDispatchEvents.VoiceStateUpdate, GatewayVoiceState>;
/**
* https://discord.com/developers/docs/topics/gateway#voice-server-update
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayVoiceServerUpdateDispatch = DataPayload<
GatewayDispatchEvents.VoiceServerUpdate,
@@ -563,6 +648,7 @@ export type GatewayVoiceServerUpdateDispatch = DataPayload<
/**
* https://discord.com/developers/docs/topics/gateway#webhooks-update
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayWebhooksUpdateDispatch = DataPayload<
GatewayDispatchEvents.WebhooksUpdate,
@@ -578,6 +664,7 @@ export type GatewayWebhooksUpdateDispatch = DataPayload<
/**
* https://discord.com/developers/docs/topics/gateway#heartbeating
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface GatewayHeartbeat {
op: GatewayOPCodes.Heartbeat;
@@ -586,15 +673,17 @@ export interface GatewayHeartbeat {
/**
* https://discord.com/developers/docs/topics/gateway#identify-identify-connection-properties
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface GatewayIdentifyProperties {
$os: string;
$browser: string;
device: string;
$device: string;
}
/**
* https://discord.com/developers/docs/topics/gateway#identify
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface GatewayIdentify {
op: GatewayOPCodes.Identify;
@@ -613,6 +702,7 @@ export interface GatewayIdentify {
/**
* https://discord.com/developers/docs/topics/gateway#resume
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface GatewayResume {
op: GatewayOPCodes.Resume;
@@ -625,6 +715,7 @@ export interface GatewayResume {
/**
* https://discord.com/developers/docs/topics/gateway#request-guild-members
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface GatewayRequestGuildMembers {
op: GatewayOPCodes.RequestGuildMembers;
@@ -640,6 +731,7 @@ export interface GatewayRequestGuildMembers {
/**
* https://discord.com/developers/docs/topics/gateway#update-voice-state
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface GatewayVoiceStateUpdate {
op: GatewayOPCodes.VoiceStateUpdate;
@@ -653,6 +745,7 @@ export interface GatewayVoiceStateUpdate {
/**
* https://discord.com/developers/docs/topics/gateway#update-status
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface GatewayUpdatePresence {
op: GatewayOPCodes.PresenceUpdate;
@@ -661,6 +754,7 @@ export interface GatewayUpdatePresence {
/**
* https://discord.com/developers/docs/topics/gateway#update-status-gateway-status-update-structure
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface GatewayPresenceUpdateData {
since: number | null;
@@ -672,6 +766,9 @@ export interface GatewayPresenceUpdateData {
// #endregion Sendable Payloads
// #region Shared
/**
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
interface BasePayload {
op: GatewayOPCodes;
s: number;
@@ -679,14 +776,23 @@ interface BasePayload {
t?: string;
}
/**
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
type NonDispatchPayload = Omit<BasePayload, 't'>;
/**
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
interface DataPayload<Event extends GatewayDispatchEvents, D = unknown> extends BasePayload {
op: GatewayOPCodes.Dispatch;
t: Event;
d: D;
}
/**
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
type ReactionData<E extends GatewayDispatchEvents, O extends string = never> = DataPayload<
E,
Omit<
@@ -702,6 +808,9 @@ type ReactionData<E extends GatewayDispatchEvents, O extends string = never> = D
>
>;
/**
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
*/
interface MessageReactionRemoveData {
channel_id: string;
message_id: string;

View File

@@ -17,6 +17,7 @@ import type { APIWebhook } from './webhook';
/**
* https://discord.com/developers/docs/resources/audit-log#audit-log-object-audit-log-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIAuditLog {
webhooks: APIWebhook[];
@@ -27,6 +28,7 @@ export interface APIAuditLog {
/**
* https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-entry-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIAuditLogEntry {
target_id: string | null;
@@ -40,6 +42,7 @@ export interface APIAuditLogEntry {
/**
* https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-events
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export enum AuditLogEvent {
GUILD_UPDATE = 1,
@@ -89,6 +92,7 @@ export enum AuditLogEvent {
/**
* https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-optional-audit-entry-info
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIAuditLogOptions {
/**
@@ -154,6 +158,9 @@ export interface APIAuditLogOptions {
role_name?: string;
}
/**
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export enum AuditLogOptionsType {
Member = 'member',
Role = 'role',
@@ -161,223 +168,380 @@ export enum AuditLogOptionsType {
/**
* https://discord.com/developers/docs/resources/audit-log#audit-log-change-object-audit-log-change-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIAuditLogChange {
new_value?: APIAuditLogChangeKey;
old_value?: APIAuditLogChangeKey;
key: string;
export type APIAuditLogChange =
| APIAuditLogChangeKeyName
| APIAuditLogChangeKeyIconHash
| APIAuditLogChangeKeySplashHash
| APIAuditLogChangeKeyOwnerID
| APIAuditLogChangeKeyRegion
| APIAuditLogChangeKeyAFKChannelID
| APIAuditLogChangeKeyAFKTimeout
| APIAuditLogChangeKeyMFALevel
| APIAuditLogChangeKeyVerificationLevel
| APIAuditLogChangeKeyExplicitContentFilter
| APIAuditLogChangeKeyDefaultMessageNotifications
| APIAuditLogChangeKeyVanityURLCode
| APIAuditLogChangeKey$Add
| APIAuditLogChangeKey$Remove
| APIAuditLogChangeKeyPruneDeleteDays
| APIAuditLogChangeKeyWidgetEnabled
| APIAuditLogChangeKeyWidgetChannelID
| APIAuditLogChangeKeySystemChannelID
| APIAuditLogChangeKeyPosition
| APIAuditLogChangeKeyTopic
| APIAuditLogChangeKeyBitrate
| APIAuditLogChangeKeyPermissionOverwrites
| APIAuditLogChangeKeyNSFW
| APIAuditLogChangeKeyApplicationID
| APIAuditLogChangeKeyRateLimitPerUser
| APIAuditLogChangeKeyPermissions
| APIAuditLogChangeKeyPermissionsNew
| APIAuditLogChangeKeyColor
| APIAuditLogChangeKeyHoist
| APIAuditLogChangeKeyMentionable
| APIAuditLogChangeKeyAllow
| APIAuditLogChangeKeyAllowNew
| APIAuditLogChangeKeyDeny
| APIAuditLogChangeKeyDenyNew
| APIAuditLogChangeKeyCode
| APIAuditLogChangeKeyChannelID
| APIAuditLogChangeKeyInviterID
| APIAuditLogChangeKeyMaxUses
| APIAuditLogChangeKeyUses
| APIAuditLogChangeKeyMaxAge
| APIAuditLogChangeKeyTemporary
| APIAuditLogChangeKeyDeaf
| APIAuditLogChangeKeyMute
| APIAuditLogChangeKeyNick
| APIAuditLogChangeKeyAvatarHash
| APIAuditLogChangeKeyID
| APIAuditLogChangeKeyType
| APIAuditLogChangeKeyEnableEmoticons
| APIAuditLogChangeKeyExpireBehavior
| APIAuditLogChangeKeyExpireGracePeriod;
/**
* Returned when a guild's name is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyName = AuditLogChangeData<'name', string>;
/**
* Returned when a guild's icon is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyIconHash = AuditLogChangeData<'icon_hash', string>;
/**
* Returned when a guild's splash is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeySplashHash = AuditLogChangeData<'splash_hash', string>;
/**
* Returned when a guild's owner ID is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyOwnerID = AuditLogChangeData<'owner_id', string>;
/**
* Returned when a guild's region is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyRegion = AuditLogChangeData<'region', string>;
/**
* Returned when a guild's afk_channel_id is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyAFKChannelID = AuditLogChangeData<'afk_channel_id', string>;
/**
* Returned when a guild's afk_timeout is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyAFKTimeout = AuditLogChangeData<'afk_timeout', number>;
/**
* Returned when a guild's mfa_level is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyMFALevel = AuditLogChangeData<'mfa_level', GuildMFALevel>;
/**
* Returned when a guild's verification_level is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyVerificationLevel = AuditLogChangeData<'verification_level', GuildVerificationLevel>;
/**
* Returned when a guild's explicit_content_filter is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyExplicitContentFilter = AuditLogChangeData<
'explicit_content_filter',
GuildExplicitContentFilter
>;
/**
* Returned when a guild's default_message_notifications is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyDefaultMessageNotifications = AuditLogChangeData<
'default_message_notifications',
GuildDefaultMessageNotifications
>;
/**
* Returned when a guild's vanity_url_code is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyVanityURLCode = AuditLogChangeData<'vanity_url_code', string>;
/**
* Returned when new role(s) are added
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKey$Add = AuditLogChangeData<'$add', APIRole[]>;
/**
* Returned when role(s) are removed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKey$Remove = AuditLogChangeData<'$remove', APIRole[]>;
/**
* Returned when there is a change in number of days after which inactive and role-unassigned members are kicked
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyPruneDeleteDays = AuditLogChangeData<'prune_delete_days', number>;
/**
* Returned when a guild's widget is enabled
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyWidgetEnabled = AuditLogChangeData<'widget_enabled', boolean>;
/**
* Returned when a guild's widget_channel_id is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyWidgetChannelID = AuditLogChangeData<'widget_channel_id', string>;
/**
* Returned when a guild's system_channel_id is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeySystemChannelID = AuditLogChangeData<'system_channel_id', string>;
/**
* Returned when a channel's position is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyPosition = AuditLogChangeData<'position', number>;
/**
* Returned when a channel's topic is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyTopic = AuditLogChangeData<'topic', string>;
/**
* Returned when a voice channel's bitrate is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyBitrate = AuditLogChangeData<'bitrate', number>;
/**
* Returned when a channel's permission overwrites is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyPermissionOverwrites = AuditLogChangeData<'permission_overwrites', APIOverwrite[]>;
/**
* Returned when a channel's NSFW restriction is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyNSFW = AuditLogChangeData<'nsfw', boolean>;
/**
* The application ID of the added or removed Webhook or Bot
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyApplicationID = AuditLogChangeData<'application_id', string>;
/**
* Returned when a channel's amount of seconds a user has to wait before sending another message
* is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyRateLimitPerUser = AuditLogChangeData<'rate_limit_per_user', number>;
/**
* Returned when a permission bitfield is changed
* @deprecated Use `permissions_new` instead
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyPermissions = AuditLogChangeData<'permissions', number>;
/**
* Returned when a permission bitfield is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyPermissionsNew = AuditLogChangeData<'permissions_new', string>;
/**
* Returned when a role's color is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyColor = AuditLogChangeData<'color', number>;
/**
* Returned when a role's hoist status is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyHoist = AuditLogChangeData<'hoist', boolean>;
/**
* Returned when a role's mentionable status is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyMentionable = AuditLogChangeData<'mentionable', boolean>;
/**
* Returned when an overwrite's allowed permissions bitfield is changed
* @deprecated Use `allow_new` instead
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyAllow = AuditLogChangeData<'allow', number>;
/**
* Returned when an overwrite's allowed permissions bitfield is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyAllowNew = AuditLogChangeData<'allow_new', string>;
/**
* Returned when an overwrite's denied permissions bitfield is changed
* @deprecated Use `deny_new` instead
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyDeny = AuditLogChangeData<'deny', number>;
/**
* Returned when an overwrite's denied permissions bitfield is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyDenyNew = AuditLogChangeData<'deny_new', string>;
/**
* Returned when an invite's code is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyCode = AuditLogChangeData<'code', string>;
/**
* Returned when an invite's channel_id is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyChannelID = AuditLogChangeData<'channel_id', string>;
/**
* Returned when an invite's inviter_id is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyInviterID = AuditLogChangeData<'inviter_id', string>;
/**
* Returned when an invite's max_uses is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyMaxUses = AuditLogChangeData<'max_uses', number>;
/**
* Returned when an invite's uses is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyUses = AuditLogChangeData<'uses', number>;
/**
* Returned when an invite's max_age is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyMaxAge = AuditLogChangeData<'max_age', number>;
/**
* Returned when an invite's temporary status is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyTemporary = AuditLogChangeData<'temporary', boolean>;
/**
* Returned when a user's deaf status is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyDeaf = AuditLogChangeData<'deaf', boolean>;
/**
* Returned when a user's mute status is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyMute = AuditLogChangeData<'mute', boolean>;
/**
* Returned when a user's nick is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyNick = AuditLogChangeData<'mute', boolean>;
/**
* Returned when a user's avatar_hash is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyAvatarHash = AuditLogChangeData<'avatar_hash', string>;
/**
* The ID of the changed entity - sometimes used in conjunction with other keys
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIAuditLogChangeKeyID {
key: 'id';
new_value: string;
old_value?: string;
}
/**
* https://discord.com/developers/docs/resources/audit-log#audit-log-change-object-audit-log-change-key
* The type of entity created
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIAuditLogChangeKey {
/**
* Returned when a guild is updated
*/
name?: string;
/**
* Returned when a guild is updated
*/
icon_hash?: string;
/**
* Returned when a guild is updated
*/
splash_hash?: string;
/**
* Returned when a guild is updated
*/
owner_id?: string;
/**
* Returned when a guild is updated
*/
region?: string;
/**
* Returned when a guild is updated
*/
afk_channel_id?: string;
/**
* Returned when a guild is updated
*/
afk_timeout?: number;
/**
* Returned when a guild is updated
*/
mfa_level?: GuildMFALevel;
/**
* Returned when a guild is updated
*/
verification_level?: GuildVerificationLevel;
/**
* Returned when a guild is updated
*/
explicit_content_filter?: GuildExplicitContentFilter;
/**
* Returned when a guild is updated
*/
default_message_notifications?: GuildDefaultMessageNotifications;
/**
* Returned when a guild is updated
*/
vanity_url_code?: string;
/**
* Returned when a guild is updated
*/
$add?: APIRole[];
/**
* Returned when a guild is updated
*/
$remove?: APIRole[];
/**
* Returned when a guild is updated
*/
prune_delete_days?: number;
/**
* Returned when a guild is updated
*/
widget_enabled?: boolean;
/**
* Returned when a guild is updated
*/
widget_channel_id?: string;
/**
* Returned when a guild is updated
*/
system_channel_id?: string;
export type APIAuditLogChangeKeyType = AuditLogChangeData<'type', ChannelType | string>;
/**
* Returned when a channel is updated
*/
position?: number;
/**
* Returned when a channel is updated
*/
topic?: string;
/**
* Returned when a channel is updated
*/
bitrate?: number;
/**
* Returned when a channel is updated
*/
permission_overwrites?: APIOverwrite[];
/**
* Returned when a channel is updated
*/
nsfw?: boolean;
/**
* Returned when a channel is updated
*/
application_id?: string;
/**
* Returned when a channel is updated
*/
rate_limit_per_user?: number;
/**
* Returned when an integration's enable_emoticons is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyEnableEmoticons = AuditLogChangeData<'enable_emoticons', boolean>;
/**
* Returned when a role is updated
*/
permissions?: number;
/**
* Returned when a role is updated
*/
permissions_new?: string;
/**
* Returned when a role is updated
*/
color?: string;
/**
* Returned when a role is updated
*/
hoist?: boolean;
/**
* Returned when a role is updated
*/
mentionable?: boolean;
/**
* Returned when a role is updated
* @deprecated Use `allow_new` instead
*/
allow?: number;
/**
* Returned when a role is updated
*/
allow_new?: string;
/**
* Returned when a role is updated
* @deprecated Use `deny_new` instead
*/
deny?: number;
/**
* Returned when a role is updated
*/
deny_new?: string;
/**
* Returned when an integration's expire_behavior is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyExpireBehavior = AuditLogChangeData<'expire_behavior', IntegrationExpireBehavior>;
/**
* Returned when an invite is updated
*/
code?: string;
/**
* Returned when an invite is updated
*/
channel_id?: string;
/**
* Returned when an invite is updated
*/
inviter_id?: string;
/**
* Returned when an invite is updated
*/
max_uses?: number;
/**
* Returned when an invite is updated
*/
uses?: number;
/**
* Returned when an invite is updated
*/
max_age?: number;
/**
* Returned when an invite is updated
*/
temporary?: boolean;
/**
* Returned when an integration's expire_grace_period is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyExpireGracePeriod = AuditLogChangeData<'expire_grace_period', number>;
/**
* Returned when a user is updated
*/
deaf?: boolean;
/**
* Returned when a user is updated
*/
mute?: boolean;
/**
* Returned when a user is updated
*/
nick?: string;
/**
* Returned when a user is updated
*/
avatar_hash?: string;
/**
* The ID of the changed entry
*/
id: string;
/**
* The type of the changed entity
*/
type?: ChannelType | string;
/**
* Returned when an integration is updated
*/
enable_emoticons?: boolean;
/**
* Returned when an integration is updated
*/
expire_behavior?: IntegrationExpireBehavior;
/**
* Returned when an integration is updated
*/
expire_grace_period?: number;
/**
* @internal
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
interface AuditLogChangeData<K extends string, D extends unknown> {
key: K;
new_value?: D;
old_value?: D;
}

View File

@@ -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;
@@ -17,10 +18,11 @@ 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;
position: number;
position?: number;
permission_overwrites?: APIOverwrite[];
name?: string;
topic?: string | null;
@@ -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,
@@ -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;
@@ -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,
@@ -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;
@@ -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;
@@ -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;
@@ -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,
@@ -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,
@@ -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;
@@ -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;
@@ -179,6 +192,9 @@ 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',
@@ -186,6 +202,7 @@ export enum OverwriteType {
/**
* 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;
@@ -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',
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;

View File

@@ -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;
@@ -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[];

View File

@@ -7,6 +7,7 @@ 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;
@@ -14,6 +15,7 @@ export interface APIGatewayInfo {
/**
* 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;
@@ -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;
@@ -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> & {
@@ -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',
@@ -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;
@@ -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,
@@ -88,10 +98,12 @@ export enum ActivityType {
Listening,
Custom = 4,
Competing,
}
/**
* 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;
@@ -100,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;
@@ -114,6 +128,7 @@ 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>
@@ -121,11 +136,13 @@ export type GatewayActivityAssets = Partial<
/**
* 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,

View File

@@ -11,12 +11,16 @@ import type { GatewayVoiceState } from './voice';
/**
* https://discord.com/developers/docs/resources/guild#unavailable-guild-object
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIUnavailableGuild {
id: string;
unavailable: boolean;
}
/**
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIPartialGuild extends Omit<APIUnavailableGuild, 'unavailable'>, Pick<APIGuild, 'welcome_screen'> {
name: string;
icon: string | null;
@@ -29,6 +33,9 @@ export interface APIPartialGuild extends Omit<APIUnavailableGuild, 'unavailable'
unavailable?: boolean;
}
/**
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIGuild extends APIPartialGuild {
discovery_splash: string | null;
owner?: boolean;
@@ -80,11 +87,11 @@ export interface APIGuild extends APIPartialGuild {
public_updates_channel_id: string | null;
max_video_channel_users?: number;
/**
* Returned by calling GET `/guilds/{guid.id}` with the query `with_counts` set to `true`
* Returned by calling GET `/guilds/{guild.id}` with the query `with_counts` set to `true`
*/
approximate_member_count?: number;
/**
* Returned by calling GET `/guilds/{guid.id}` with the query `with_counts` set to `true`
* Returned by calling GET `/guilds/{guild.id}` with the query `with_counts` set to `true`
*/
approximate_presence_count?: number;
welcome_screen?: APIGuildWelcomeScreen;
@@ -92,6 +99,7 @@ export interface APIGuild extends APIPartialGuild {
/**
* https://discord.com/developers/docs/resources/guild#guild-object-default-message-notification-level
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export enum GuildDefaultMessageNotifications {
ALL_MESSAGES,
@@ -100,6 +108,7 @@ export enum GuildDefaultMessageNotifications {
/**
* https://discord.com/developers/docs/resources/guild#guild-object-explicit-content-filter-level
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export enum GuildExplicitContentFilter {
DISABLED,
@@ -109,6 +118,7 @@ export enum GuildExplicitContentFilter {
/**
* https://discord.com/developers/docs/resources/guild#guild-object-mfa-level
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export enum GuildMFALevel {
NONE,
@@ -117,6 +127,7 @@ export enum GuildMFALevel {
/**
* https://discord.com/developers/docs/resources/guild#guild-object-verification-level
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export enum GuildVerificationLevel {
NONE,
@@ -128,6 +139,7 @@ export enum GuildVerificationLevel {
/**
* https://discord.com/developers/docs/resources/guild#guild-object-premium-tier
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export enum GuildPremiumTier {
NONE,
@@ -138,6 +150,7 @@ export enum GuildPremiumTier {
/**
* https://discord.com/developers/docs/resources/guild#guild-object-system-channel-flags
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export enum GuildSystemChannelFlags {
SUPPRESS_JOIN_NOTIFICATIONS = 1 << 0,
@@ -146,6 +159,7 @@ export enum GuildSystemChannelFlags {
/**
* https://discord.com/developers/docs/resources/guild#guild-object-guild-features
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export enum GuildFeature {
ANIMATED_ICON = 'ANIMATED_ICON',
@@ -166,6 +180,7 @@ export enum GuildFeature {
/**
* https://discord.com/developers/docs/resources/guild#guild-preview-object
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIGuildPreview {
id: string;
@@ -180,15 +195,23 @@ export interface APIGuildPreview {
}
/**
* https://discord.com/developers/docs/resources/guild#guild-widget-object
* @deprecated Use `APIGuildWidgetSettings` instead
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIGuildWidget {
export type APIGuildWidget = APIGuildWidgetSettings;
/**
* https://discord.com/developers/docs/resources/guild#guild-widget-object
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIGuildWidgetSettings {
enabled: boolean;
channel_id: string | null;
}
/**
* https://discord.com/developers/docs/resources/guild#guild-member-object
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIGuildMember {
user?: APIUser;
@@ -202,6 +225,7 @@ export interface APIGuildMember {
/**
* https://discord.com/developers/docs/resources/guild#integration-object
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIGuildIntegration {
id: string;
@@ -223,6 +247,7 @@ export interface APIGuildIntegration {
/**
* https://discord.com/developers/docs/resources/guild#integration-object-integration-expire-behaviors
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export enum IntegrationExpireBehavior {
RemoveRole,
@@ -231,6 +256,7 @@ export enum IntegrationExpireBehavior {
/**
* https://discord.com/developers/docs/resources/guild#integration-account-object
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIIntegrationAccount {
id: string;
@@ -239,6 +265,7 @@ export interface APIIntegrationAccount {
/**
* https://discord.com/developers/docs/resources/guild#integration-application-object
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIGuildIntegrationApplication {
id: string;
@@ -251,6 +278,7 @@ export interface APIGuildIntegrationApplication {
/**
* https://discord.com/developers/docs/resources/guild#ban-object
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIBan {
reason: string | null;
@@ -259,6 +287,7 @@ export interface APIBan {
/**
* https://discord.com/developers/docs/resources/guild#get-guild-widget-image-widget-style-options
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export enum GuildWidgetStyle {
Banner1 = 'banner1',
@@ -268,11 +297,17 @@ export enum GuildWidgetStyle {
Shield = 'shield',
}
/**
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIGuildWelcomeScreen {
description: string | null;
welcome_channels: APIGuildWelcomeScreenChannel[];
}
/**
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIGuildWelcomeScreenChannel {
channel_id: string;
emoji_id: string | null;

View File

@@ -8,6 +8,7 @@ import type { APIUser } from './user';
/**
* https://discord.com/developers/docs/resources/invite#invite-object
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIInvite {
code: string;
@@ -22,6 +23,7 @@ export interface APIInvite {
/**
* https://discord.com/developers/docs/resources/invite#invite-object-target-user-types
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export enum InviteTargetUserType {
STREAM = 1,
@@ -29,6 +31,7 @@ export enum InviteTargetUserType {
/**
* https://discord.com/developers/docs/resources/invite#invite-metadata-object
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIExtendedInvite extends APIInvite {
uses: number;

View File

@@ -7,6 +7,7 @@ import type { APIUser } from './user';
/**
* https://discord.com/developers/docs/topics/oauth2#get-current-application-information-response-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIApplication {
id: string;

View File

@@ -7,8 +7,9 @@
*
* These flags are exported as `BigInt`s and NOT numbers. For most of them, you can
* convert them in a number by wrapping it in `Number()`, however be careful as any
* futher bits added may cause issues if done so. Try to use BigInts as much as possible
* further bits added may cause issues if done so. Try to use BigInts as much as possible
* or modules that can replicate them in some way.
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export const PermissionFlagsBits = {
CREATE_INSTANT_INVITE: 1n,
@@ -52,6 +53,7 @@ Object.freeze(PermissionFlagsBits);
/**
* https://discord.com/developers/docs/topics/permissions#role-object
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIRole {
id: string;
@@ -69,6 +71,9 @@ export interface APIRole {
tags?: APIRoleTags;
}
/**
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIRoleTags {
bot_id?: string;
premium_subscriber?: null;

View File

@@ -6,6 +6,7 @@ import type { APIUser } from './user';
/**
* https://discord.com/developers/docs/topics/teams#data-models-team-object
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APITeam {
id: string;
@@ -16,6 +17,7 @@ export interface APITeam {
/**
* https://discord.com/developers/docs/topics/teams#data-models-team-members-object
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APITeamMember {
membership_state: TeamMemberMembershipState;
@@ -26,6 +28,7 @@ export interface APITeamMember {
/**
* https://discord.com/developers/docs/topics/teams#data-models-membership-state-enum
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export enum TeamMemberMembershipState {
INVITED = 1,

View File

@@ -6,6 +6,7 @@ import type { APIGuildIntegration } from './guild';
/**
* https://discord.com/developers/docs/resources/user#user-object
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIUser {
id: string;
@@ -19,12 +20,13 @@ export interface APIUser {
verified?: boolean;
email?: string | null;
flags?: UserFlags;
premium_type: UserPremiumType;
premium_type?: UserPremiumType;
public_flags?: UserFlags;
}
/**
* https://discord.com/developers/docs/resources/user#user-object-user-flags
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export enum UserFlags {
None = 0,
@@ -45,6 +47,7 @@ export enum UserFlags {
/**
* https://discord.com/developers/docs/resources/user#user-object-premium-types
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export enum UserPremiumType {
None,
@@ -54,6 +57,7 @@ export enum UserPremiumType {
/**
* https://discord.com/developers/docs/resources/user#connection-object
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIConnection {
id: string;
@@ -67,6 +71,9 @@ export interface APIConnection {
visibility: ConnectionVisibility;
}
/**
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export enum ConnectionVisibility {
None,
Everyone,

View File

@@ -6,6 +6,7 @@ import type { APIGuildMember } from './guild';
/**
* https://discord.com/developers/docs/resources/voice#voice-state-object
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface GatewayVoiceState {
guild_id?: string;
@@ -24,6 +25,7 @@ export interface GatewayVoiceState {
/**
* https://discord.com/developers/docs/resources/voice#voice-region-object
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIVoiceRegion {
id: string;

View File

@@ -8,6 +8,7 @@ import type { APIUser } from './user';
/**
* https://discord.com/developers/docs/resources/webhook#webhook-object
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIWebhook {
id: string;
@@ -23,6 +24,9 @@ export interface APIWebhook {
application_id: string | null;
}
/**
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export enum WebhookType {
Incoming = 1,
ChannelFollower,

View File

@@ -2,6 +2,7 @@ import type { APIAuditLog, AuditLogEvent } from '../payloads/auditLog';
/**
* https://discord.com/developers/docs/resources/audit-log#get-guild-audit-log
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTGetAPIAuditLogQuery {
user_id?: string;
@@ -10,4 +11,7 @@ export interface RESTGetAPIAuditLogQuery {
limit?: number;
}
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTGetAPIAuditLogResult = APIAuditLog;

View File

@@ -4,6 +4,7 @@ import type {
APIFollowedChannel,
APIInvite,
APIMessage,
APIMessageReference,
APIOverwrite,
APIUser,
ChannelType,
@@ -16,6 +17,7 @@ import type {
/**
* https://discord.com/developers/docs/resources/channel#overwrite-object-overwrite-structure
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIOverwriteSend {
id: string;
@@ -26,6 +28,7 @@ export interface APIOverwriteSend {
/**
* https://discord.com/developers/docs/resources/channel#allowed-mentions-object-allowed-mention-types
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export enum AllowedMentionsTypes {
Everyone = 'everyone',
@@ -35,6 +38,7 @@ export enum AllowedMentionsTypes {
/**
* https://discord.com/developers/docs/resources/channel#allowed-mentions-object-allowed-mentions-structure
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIAllowedMentionsSend {
parse?: AllowedMentionsTypes[];
@@ -46,6 +50,7 @@ export interface APIAllowedMentionsSend {
/**
* https://discord.com/developers/docs/resources/channel#modify-channel
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTPatchAPIChannelJSONBody {
name?: string;
@@ -59,12 +64,24 @@ export interface RESTPatchAPIChannelJSONBody {
parent_id?: string | null;
}
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTGetAPIChannelResult = APIChannel;
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPatchAPIChannelResult = APIChannel;
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTDeleteAPIChannelResult = APIChannel;
/**
* https://discord.com/developers/docs/resources/channel#get-channel-messages
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTGetAPIChannelMessagesQuery {
around?: string;
@@ -73,10 +90,14 @@ export interface RESTGetAPIChannelMessagesQuery {
limit?: number;
}
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTGetAPIChannelMessagesResult = APIMessage[];
/**
* https://discord.com/developers/docs/resources/channel#create-message
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTPostAPIChannelMessageJSONBody {
content?: string;
@@ -84,10 +105,12 @@ export interface RESTPostAPIChannelMessageJSONBody {
tts?: boolean;
embed?: APIEmbed;
allowed_mentions?: APIAllowedMentionsSend;
message_reference?: APIMessageReference;
}
/**
* https://discord.com/developers/docs/resources/channel#create-message
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPostAPIChannelMessageFormDataBody =
| {
@@ -106,6 +129,7 @@ export type RESTPostAPIChannelMessageFormDataBody =
tts?: boolean;
embed?: APIEmbed;
allowed_mentions?: APIAllowedMentionsSend;
message_reference?: APIMessageReference;
/**
* The file contents
*/
@@ -114,6 +138,7 @@ export type RESTPostAPIChannelMessageFormDataBody =
/**
* https://discord.com/developers/docs/resources/channel#edit-message
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTPatchAPIChannelMessageJSONBody {
content?: string | null;
@@ -122,13 +147,29 @@ export interface RESTPatchAPIChannelMessageJSONBody {
flags?: MessageFlags | null;
}
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTGetAPIChannelMessageResult = APIMessage;
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPostAPIChannelMessageResult = APIMessage;
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPatchAPIChannelMessageResult = APIMessage;
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTDeleteAPIChannelMessageResult = never;
/**
* https://discord.com/developers/docs/resources/channel#get-reactions
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTGetAPIChannelMessageReactionsQuery {
before?: string;
@@ -136,23 +177,42 @@ export interface RESTGetAPIChannelMessageReactionsQuery {
limit?: number;
}
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTGetAPIChannelMessageReactionsResult = APIUser[];
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPutAPIChannelMessageReactionResult = never;
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTDeleteAPIChannelMessageReactionResult = never;
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTDeleteAPIChannelAllMessageReactionsResult = never;
/**
* https://discord.com/developers/docs/resources/channel#bulk-delete-messages
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTPostAPIChannelMessagesBulkDeleteJSONBody {
messages: string[];
}
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPostAPIChannelMessagesBulkDeleteResult = never;
/**
* https://discord.com/developers/docs/resources/channel#edit-channel-permissions
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTPutAPIChannelPermissionsJSONBody {
allow: number | string;
@@ -160,14 +220,25 @@ export interface RESTPutAPIChannelPermissionsJSONBody {
type: OverwriteType;
}
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPutAPIChannelPermissionsResult = never;
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTDeleteAPIChannelPermissionsResult = never;
/**
* https://discord.com/developers/docs/resources/channel#get-channel-invites
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTGetAPIChannelInvitesResult = APIInvite[];
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTPostAPIChannelInviteJSONBody {
max_age?: number;
max_uses?: number;
@@ -179,37 +250,61 @@ export interface RESTPostAPIChannelInviteJSONBody {
/**
* https://discord.com/developers/docs/resources/channel#trigger-typing-indicator
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPostAPIChannelTypingResult = never;
/**
* https://discord.com/developers/docs/resources/channel#get-pinned-messages
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTGetAPIChannelPinsResult = APIMessage[];
/**
* https://discord.com/developers/docs/resources/channel#add-pinned-channel-message
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPutAPIChannelPinResult = never;
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTDeleteAPIChannelPinResult = never;
/**
* https://discord.com/developers/docs/resources/channel#group-dm-add-recipient
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTPutAPIChannelRecipientJSONBody {
access_token: string;
nick?: string;
}
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPutAPIChannelRecipientResult = unknown;
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTDeleteAPIChannelRecipientResult = unknown;
// TODO: Docs updated once https://github.com/discord/discord-api-docs/pull/1692/files is merged
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPostAPIChannelMessageCrosspostResult = APIMessage;
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTPostAPIChannelFollowersJSONBody {
webhook_channel_id: string;
}
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPostAPIChannelFollowersResult = APIFollowedChannel;

View File

@@ -2,16 +2,19 @@ import type { APIEmoji } from '../payloads';
/**
* https://discord.com/developers/docs/resources/emoji#list-guild-emojis
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTGetAPIGuildEmojisResult = APIEmoji[];
/**
* https://discord.com/developers/docs/resources/emoji#get-guild-emoji
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTGetAPIGuildEmojiResult = APIEmoji;
/**
* https://discord.com/developers/docs/resources/emoji#create-guild-emoji-json-params
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTPostAPIGuildEmojiJSONBody {
name: string;
@@ -22,19 +25,27 @@ export interface RESTPostAPIGuildEmojiJSONBody {
roles?: string[];
}
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPostAPIGuildEmojiResult = APIEmoji;
/**
* https://discord.com/developers/docs/resources/emoji#modify-guild-emoji
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTPatchAPIGuildEmojiJSONBody {
name?: string;
roles?: string[] | null;
}
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPatchAPIGuildEmojiResult = APIEmoji;
/**
* https://discord.com/developers/docs/resources/emoji#delete-guild-emoji
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTDeleteAPIGuildEmojiResult = never;

View File

@@ -2,10 +2,12 @@ import type { APIGatewayBotInfo, APIGatewayInfo } from '../payloads';
/**
* https://discord.com/developers/docs/topics/gateway#get-gateway
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTGetAPIGatewayResult = APIGatewayInfo;
/**
* https://discord.com/developers/docs/topics/gateway#get-gateway-bot
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTGetAPIGatewayBotResult = APIGatewayBotInfo;

View File

@@ -5,7 +5,7 @@ import type {
APIGuildIntegration,
APIGuildMember,
APIGuildPreview,
APIGuildWidget,
APIGuildWidgetSettings,
APIInvite,
APIRole,
APIVoiceRegion,
@@ -16,17 +16,37 @@ import type {
GuildWidgetStyle,
IntegrationExpireBehavior,
} from '../payloads';
import type { RESTPutAPIChannelPermissionsJSONBody } from './channel';
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIGuildCreateOverwrite extends RESTPutAPIChannelPermissionsJSONBody {
id: number | string;
}
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type APIGuildCreatePartialChannel = Partial<
Pick<
APIChannel,
'type' | 'permission_overwrites' | 'topic' | 'nsfw' | 'bitrate' | 'user_limit' | 'rate_limit_per_user' | 'parent_id'
>
> &
Required<Pick<APIChannel, 'name'>>;
Pick<APIChannel, 'type' | 'topic' | 'nsfw' | 'bitrate' | 'user_limit' | 'rate_limit_per_user'>
> & {
name: string;
id?: number | string;
parent_id?: number | string;
permission_overwrites?: APIGuildCreateOverwrite[];
};
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIGuildCreateRole extends RESTPostAPIGuildRoleJSONBody {
id: number | string;
}
/**
* https://discord.com/developers/docs/resources/guild#create-guild
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTPostAPIGuildsJSONBody {
name: string;
@@ -35,31 +55,40 @@ export interface RESTPostAPIGuildsJSONBody {
verification_level?: GuildVerificationLevel;
default_message_notifications?: GuildDefaultMessageNotifications;
explicit_content_filter?: GuildExplicitContentFilter;
roles?: APIRole[];
roles?: APIGuildCreateRole[];
channels?: APIGuildCreatePartialChannel[];
afk_channel_id?: string;
afk_channel_id?: number | string;
afk_timeout?: number;
system_channel_id?: string;
system_channel_id?: number | string;
}
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPostAPIGuildsResult = APIGuild;
/**
* https://discord.com/developers/docs/resources/guild#get-guild
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTGetAPIGuildQuery {
with_counts?: boolean;
}
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTGetAPIGuildResult = APIGuild;
/**
* https://discord.com/developers/docs/resources/guild#get-guild-preview
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTGetAPIGuildPreviewResult = APIGuildPreview;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTPatchAPIGuildJSONBody {
name?: string;
@@ -82,27 +111,43 @@ export interface RESTPatchAPIGuildJSONBody {
description?: string | null;
}
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPatchAPIGuildResult = APIGuild;
/**
* https://discord.com/developers/docs/resources/guild#delete-guild
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTDeleteAPIGuildResult = never;
/**
* https://discord.com/developers/docs/resources/guild#get-guild-channels
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTGetAPIGuildChannelsResult = APIChannel[];
/**
* https://discord.com/developers/docs/resources/guild#create-guild-channel
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPostAPIGuildChannelJSONBody = APIGuildCreatePartialChannel;
export type RESTPostAPIGuildChannelJSONBody = Partial<
Pick<
APIChannel,
'type' | 'permission_overwrites' | 'topic' | 'nsfw' | 'bitrate' | 'user_limit' | 'rate_limit_per_user' | 'parent_id'
>
> &
Required<Pick<APIChannel, 'name'>>;
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPostAPIGuildChannelResult = APIChannel;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-channel-positions
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPatchAPIGuildChannelPositionsJSONBody = Array<{
id: string;
@@ -111,32 +156,47 @@ export type RESTPatchAPIGuildChannelPositionsJSONBody = Array<{
parent_id?: string | null;
}>;
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPatchAPIGuildChannelPositionsResult = never;
/**
* https://discord.com/developers/docs/resources/guild#get-guild-member
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTGetAPIGuildMemberResult = APIGuildMember;
/**
* https://discord.com/developers/docs/resources/guild#list-guild-members
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTGetAPIGuildMembersQuery {
limit?: number;
after?: string;
}
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTGetAPIGuildMembersResult = APIGuildMember[];
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTGetAPIGuildMembersSearchQuery {
query: string;
limit?: number;
}
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTGetAPIGuildMembersSearchResult = APIGuildMember[];
/**
* https://discord.com/developers/docs/resources/guild#add-guild-member
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTPutAPIGuildMemberJSONBody {
access_token: string;
@@ -146,10 +206,14 @@ export interface RESTPutAPIGuildMemberJSONBody {
deaf?: boolean;
}
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPutAPIGuildMemberResult = APIGuildMember | undefined;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-member
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTPatchAPIGuildMemberJSONBody {
nick?: string | null;
@@ -159,64 +223,83 @@ export interface RESTPatchAPIGuildMemberJSONBody {
channel_id?: string | null;
}
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPatchAPIGuildMemberResult = never;
/**
* https://discord.com/developers/docs/resources/guild#modify-current-user-nick
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTPatchAPICurrentGuildMemberNicknameJSONBody {
nick?: string | null;
}
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPatchAPICurrentGuildMemberNicknameResult = Required<RESTPatchAPICurrentGuildMemberNicknameJSONBody>;
/**
* https://discord.com/developers/docs/resources/guild#add-guild-member-role
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPutAPIGuildMemberRoleResult = never;
/**
* https://discord.com/developers/docs/resources/guild#remove-guild-member-role
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTDeleteAPIGuildMemberRoleResult = never;
/**
* https://discord.com/developers/docs/resources/guild#remove-guild-member
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTDeleteAPIGuildMemberResult = never;
/**
* https://discord.com/developers/docs/resources/guild#get-guild-bans
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTGetAPIGuildBansResult = APIBan[];
/**
* https://discord.com/developers/docs/resources/guild#get-guild-ban
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTGetAPIGuildBanResult = APIBan;
/**
* https://discord.com/developers/docs/resources/guild#create-guild-ban
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTPutAPIGuildBanJSONBody {
delete_message_days?: number;
reason?: string;
}
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPutAPIGuildBanResult = never;
/**
* https://discord.com/developers/docs/resources/guild#remove-guild-ban
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTDeleteAPIGuildBanResult = never;
/**
* https://discord.com/developers/docs/resources/guild#get-guild-roles
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTGetAPIGuildRolesResult = APIRole[];
/**
* https://discord.com/developers/docs/resources/guild#create-guild-role
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTPostAPIGuildRoleJSONBody {
name?: string | null;
@@ -226,20 +309,28 @@ export interface RESTPostAPIGuildRoleJSONBody {
mentionable?: boolean | null;
}
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPostAPIGuildRoleResult = APIRole;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-role-positions
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPatchAPIGuildRolePositionsJSONBody = Array<{
id: string;
position?: number;
}>;
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPatchAPIGuildRolePositionsResult = APIRole[];
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-role
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTPatchAPIGuildRoleJSONBody {
name?: string;
@@ -249,15 +340,20 @@ export interface RESTPatchAPIGuildRoleJSONBody {
mentionable?: boolean;
}
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPatchAPIGuildRoleResult = APIRole;
/**
* https://discord.com/developers/docs/resources/guild#delete-guild-role
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTDeleteAPIGuildRoleResult = never;
/**
* https://discord.com/developers/docs/resources/guild#get-guild-prune-count
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTGetAPIGuildPruneCountQuery {
days?: number;
@@ -270,12 +366,16 @@ export interface RESTGetAPIGuildPruneCountQuery {
include_roles?: string;
}
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTGetAPIGuildPruneCountResult {
pruned: number;
}
/**
* https://discord.com/developers/docs/resources/guild#begin-guild-prune
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTPostAPIGuildPruneJSONBody {
days?: number;
@@ -283,41 +383,55 @@ export interface RESTPostAPIGuildPruneJSONBody {
include_roles?: string[];
}
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTPostAPIGuildPruneResult {
pruned: number | null;
}
/**
* https://discord.com/developers/docs/resources/guild#get-guild-voice-regions
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTGetAPIGuildVoiceRegionsResult = APIVoiceRegion[];
/**
* https://discord.com/developers/docs/resources/guild#get-guild-invites
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTGetAPIGuildInvitesResult = APIInvite[];
/**
* https://discord.com/developers/docs/resources/guild#get-guild-integrations
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTGetAPIGuildIntegrationsQuery {
include_applications?: boolean;
}
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTGetAPIGuildIntegrationsResult = APIGuildIntegration[];
/**
* https://discord.com/developers/docs/resources/guild#create-guild-integration
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTPostAPIGuildIntegrationJSONBody {
type: string;
id: string;
}
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPostAPIGuildIntegrationResult = never;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-integration
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTPatchAPIGuildIntegrationJSONBody {
expire_behavior?: IntegrationExpireBehavior | null;
@@ -325,32 +439,61 @@ export interface RESTPatchAPIGuildIntegrationJSONBody {
enable_emoticons?: boolean | null;
}
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPatchAPIGuildIntegrationResult = never;
/**
* https://discord.com/developers/docs/resources/guild#delete-guild-integration
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTDeleteAPIGuildIntegrationResult = never;
/**
* https://discord.com/developers/docs/resources/guild#sync-guild-integration
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPostAPIGuildIntegrationSyncResult = never;
/**
* https://discord.com/developers/docs/resources/guild#get-guild-widget
* @deprecated Renamed to RESTGetAPIGuildWidgetSettingsResult
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTGetAPIGuildWidgetResult = APIGuildWidget;
export type RESTGetAPIGuildWidgetResult = APIGuildWidgetSettings;
/**
* https://discord.com/developers/docs/resources/guild#get-guild-widget-settings
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTGetAPIGuildWidgetSettingsResult = APIGuildWidgetSettings;
/**
* @deprecated Renamed to RESTPatchAPIGuildWidgetSettingsJSONBody
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPatchAPIGuildWidgetJSONBody = Partial<APIGuildWidgetSettings>;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-widget
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPatchAPIGuildWidgetJSONBody = Partial<APIGuildWidget>;
export type RESTPatchAPIGuildWidgetSettingsJSONBody = Partial<APIGuildWidgetSettings>;
export type RESTPatchAPIGuildWidgetResult = APIGuildWidget;
/**
* @deprecated Use `RESTPatchAPIGuildWidgetSettingsResult` instead
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPatchAPIGuildWidgetResult = APIGuildWidgetSettings;
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPatchAPIGuildWidgetSettingsResult = APIGuildWidgetSettings;
/**
* https://discord.com/developers/docs/resources/guild#get-guild-vanity-url
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTGetAPIGuildVanityUrlResult {
code: string | null;
@@ -359,6 +502,7 @@ export interface RESTGetAPIGuildVanityUrlResult {
/**
* https://discord.com/developers/docs/resources/guild#get-guild-widget-image
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTGetAPIGuildWidgetImageQuery {
style?: GuildWidgetStyle;
@@ -367,5 +511,6 @@ export interface RESTGetAPIGuildWidgetImageQuery {
/**
* Note: while the return type is `ArrayBuffer`, the expected result is
* a buffer of sorts (depends if in browser or on node.js/deno).
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTGetAPIGuildWidgetImageResult = ArrayBuffer;

View File

@@ -9,7 +9,14 @@ export * from './user';
export * from './voice';
export * from './webhook';
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export const APIVersion = '6';
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export const Routes = {
/**
* Route for:
@@ -351,12 +358,19 @@ export const Routes = {
return `/guilds/${guildID}/integrations/${integrationID}/sync`;
},
/**
* @deprecated Use `guildWidgetSettings` instead
*/
guildWidget(guildID: string) {
return `/guilds/${guildID}/widget`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/widget`
* - PATCH `/guilds/{guild.id}/widget`
*/
guildWidget(guildID: string) {
guildWidgetSettings(guildID: string) {
return `/guilds/${guildID}/widget`;
},

View File

@@ -2,14 +2,19 @@ import type { APIInvite } from '../payloads';
/**
* https://discord.com/developers/docs/resources/invite#get-invite
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTGetAPIInviteQuery {
with_counts?: boolean;
}
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTGetAPIInviteResult = APIInvite;
/**
* https://discord.com/developers/docs/resources/invite#delete-invite
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTDeleteAPIInviteResult = APIInvite;

View File

@@ -1,6 +1,181 @@
import type { APIApplication } from '../payloads';
import type { APIApplication, APIGuild, APIWebhook } from '../payloads';
/**
* https://discord.com/developers/docs/topics/oauth2#get-current-application-information
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTGetAPIOauth2CurrentApplicationResult = APIApplication;
/**
* https://discord.com/developers/docs/topics/oauth2#authorization-code-grant
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTOAuth2AuthorizationQuery {
response_type: 'code';
client_id: string;
scope: string;
redirect_uri?: string;
state?: string;
prompt?: 'consent' | 'none';
}
/**
* https://discord.com/developers/docs/topics/oauth2#authorization-code-grant-redirect-url-example
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTOAuth2AuthorizationQueryResult {
code: string;
state?: string;
}
/**
* https://discord.com/developers/docs/topics/oauth2#authorization-code-grant-redirect-url-example
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTPostOAuth2AccessTokenURIEncodedData {
client_id: string;
client_secret: string;
grant_type: 'authorization_code';
code: string;
redirect_uri?: string;
scope: string;
}
/**
* https://discord.com/developers/docs/topics/oauth2#authorization-code-grant-access-token-response
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTPostOAuth2AccessTokenResult {
access_token: string;
token_type: string;
expires_in: number;
refresh_token: string;
scope: string;
}
/**
* https://discord.com/developers/docs/topics/oauth2#authorization-code-grant-refresh-token-exchange-example
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTPostOAuth2RefreshTokenURIEncodedData {
client_id: string;
client_secret: string;
grant_type: 'refresh_token';
refresh_token: string;
redirect_uri?: string;
scope: string;
}
export type RESTPostOAuth2RefreshTokenResult = RESTPostOAuth2AccessTokenResult;
/**
* https://discord.com/developers/docs/topics/oauth2#implicit-grant
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTOAuth2ImplicitAuthorizationQuery {
response_type: 'token';
client_id: string;
scope: string;
redirect_uri?: string;
state?: string;
prompt?: 'consent' | 'none';
}
/**
* https://discord.com/developers/docs/topics/oauth2#implicit-grant-redirect-url-example
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTOAuth2ImplicitAuthorizationURIFragmentResult = Omit<RESTPostOAuth2AccessTokenResult, 'refresh_token'>;
/**
* https://discord.com/developers/docs/topics/oauth2#client-credentials-grant
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTPostOAuth2ClientCredentialsURIEncodedData {
client_id: string;
client_secret: string;
grant_type: 'client_credentials';
scope: string;
}
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPostOAuth2ClientCredentialsResult = RESTOAuth2ImplicitAuthorizationURIFragmentResult;
/**
* https://discord.com/developers/docs/topics/oauth2#bot-authorization-flow-bot-auth-parameters
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTOAuth2BotAuthorizationQuery {
client_id: string;
scope: string;
/**
* The required permissions bitfield, stringified
*/
permissions?: string;
guild_id?: string;
disable_guild_select?: boolean;
}
/**
* https://discord.com/developers/docs/topics/oauth2#advanced-bot-authorization
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTOAuth2AdvancedBotAuthorizationQuery {
client_id: string;
/**
* This assumes you include the `bot` scope alongside others (like `identify` for example)
*/
scope: string;
/**
* The required permissions bitfield, stringified
*/
permissions?: string;
guild_id?: string;
disable_guild_select?: boolean;
response_type: string;
redirect_uri?: string;
}
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTOAuth2AdvancedBotAuthorizationQueryResult {
code: string;
state?: string;
guild_id: string;
permissions: string;
}
/**
* https://discord.com/developers/docs/topics/oauth2#advanced-bot-authorization-extended-bot-authorization-access-token-example
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTPostOAuth2AccessTokenWithBotAndGuildsScopeResult {
access_token: string;
token_type: string;
expires_in: number;
refresh_token: string;
scope: string;
guild: APIGuild;
}
/**
* https://discord.com/developers/docs/topics/oauth2#webhooks-webhook-token-response-example
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTPostOAuth2AccessTokenWithBotAndWebhookIncomingScopeResult {
access_token: string;
token_type: string;
expires_in: number;
refresh_token: string;
scope: string;
webhook: APIWebhook;
}
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPostOAuth2AccessTokenWithBotAndGuildsAndWebhookIncomingScopeResult = RESTPostOAuth2AccessTokenWithBotAndGuildsScopeResult &
RESTPostOAuth2AccessTokenWithBotAndWebhookIncomingScopeResult;

View File

@@ -2,26 +2,33 @@ import type { APIChannel, APIConnection, APIUser, GuildFeature } from '../payloa
/**
* https://discord.com/developers/docs/resources/user#get-current-user
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTGetAPICurrentUserResult = APIUser;
/**
* https://discord.com/developers/docs/resources/user#get-user
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTGetAPIUserResult = APIUser;
/**
* https://discord.com/developers/docs/resources/user#modify-current-user
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTPatchAPICurrentUserJSONBody {
username?: string;
avatar?: string | null;
}
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPatchAPICurrentUserResult = APIUser;
/**
* https://discord.com/developers/docs/resources/user#get-current-user-guilds
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTGetAPICurrentUserGuildsQuery {
before?: string;
@@ -29,6 +36,9 @@ export interface RESTGetAPICurrentUserGuildsQuery {
limit?: number;
}
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTAPIPartialCurrentUserGuild {
id: string;
name: string;
@@ -42,23 +52,32 @@ export interface RESTAPIPartialCurrentUserGuild {
permissions_new: string;
}
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTGetAPICurrentUserGuildsResult = RESTAPIPartialCurrentUserGuild[];
/**
* https://discord.com/developers/docs/resources/user#leave-guild
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTDeleteAPICurrentUserGuildResult = never;
/**
* https://discord.com/developers/docs/resources/user#create-dm
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTPostAPICurrentUserCreateDMChannelJSONBody {
recipient_id: string;
}
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPostAPICurrentUserCreateDMChannelResult = APIChannel;
/**
* https://discord.com/developers/docs/resources/user#get-user-connections
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTGetAPICurrentUserConnectionsResult = APIConnection[];

View File

@@ -2,5 +2,6 @@ import type { APIVoiceRegion } from '../payloads';
/**
* https://discord.com/developers/docs/resources/voice#list-voice-regions
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type GetAPIVoiceRegionsResult = APIVoiceRegion[];

View File

@@ -3,36 +3,45 @@ import type { APIEmbed, APIMessage, APIWebhook } from '../payloads';
/**
* https://discord.com/developers/docs/resources/webhook#create-webhook
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTPostAPIChannelWebhookJSONBody {
name: string;
avatar?: string | null;
}
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPostAPIChannelWebhookResult = APIWebhook;
/**
* https://discord.com/developers/docs/resources/webhook#get-channel-webhooks
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTGetAPIChannelWebhooksResult = APIWebhook[];
/**
* https://discord.com/developers/docs/resources/webhook#get-guild-webhooks
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTGetAPIGuildWebhooksResult = APIWebhook[];
/**
* https://discord.com/developers/docs/resources/webhook#get-webhook
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTGetAPIWebhookResult = APIWebhook;
/**
* https://discord.com/developers/docs/resources/webhook#get-webhook-with-token
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTGetAPIWebhookWithTokenResult = Omit<APIWebhook, 'user'>;
/**
* https://discord.com/developers/docs/resources/webhook#modify-webhook
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTPatchAPIWebhookJSONBody {
name?: string;
@@ -40,23 +49,36 @@ export interface RESTPatchAPIWebhookJSONBody {
channel_id?: string;
}
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPatchAPIWebhookResult = APIWebhook;
/**
* https://discord.com/developers/docs/resources/webhook#modify-webhook-with-token
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPatchAPIWebhookWithTokenJSONBody = Omit<RESTPatchAPIWebhookJSONBody, 'channel_id'>;
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPatchAPIWebhookWithTokenResult = Omit<APIWebhook, 'user'>;
/**
* https://discord.com/developers/docs/resources/webhook#delete-webhook
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTDeleteAPIWebhookResult = never;
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTDeleteAPIWebhookWithTokenResult = never;
/**
* https://discord.com/developers/docs/resources/webhook#execute-webhook
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTPostAPIWebhookWithTokenJSONBody {
content?: string;
@@ -69,6 +91,7 @@ export interface RESTPostAPIWebhookWithTokenJSONBody {
/**
* https://discord.com/developers/docs/resources/webhook#execute-webhook
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPostAPIWebhookWithTokenFormDataBody =
| {
@@ -90,11 +113,15 @@ export type RESTPostAPIWebhookWithTokenFormDataBody =
/**
* https://discord.com/developers/docs/resources/webhook#execute-webhook-querystring-params
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTPostAPIWebhookWithTokenQuery {
wait?: boolean;
}
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPostAPIWebhookWithTokenResult = never;
/**
@@ -102,15 +129,18 @@ export type RESTPostAPIWebhookWithTokenResult = never;
* the `wait` query parameter set to `true`
*
* @see https://discord.com/developers/docs/resources/webhook#execute-webhook-querystring-params
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPostAPIWebhookWithTokenWaitResult = APIMessage;
/**
* https://discord.com/developers/docs/resources/webhook#execute-slackcompatible-webhook-querystring-params
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPostAPIWebhookWithTokenSlackQuery = RESTPostAPIWebhookWithTokenQuery;
/**
* https://discord.com/developers/docs/resources/webhook#execute-githubcompatible-webhook-querystring-params
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPostAPIWebhookWithTokenGitHubQuery = RESTPostAPIWebhookWithTokenQuery;

947
v8/gateway/index.ts Normal file
View File

@@ -0,0 +1,947 @@
/**
* Types extracted from https://discord.com/developers/docs/topics/gateway
*/
import type {
APIChannel,
APIEmoji,
APIGuild,
APIGuildMember,
APIMessage,
APIRole,
APIUnavailableGuild,
APIUser,
GatewayActivity,
GatewayPresenceUpdate as RawGatewayPresenceUpdate,
GatewayVoiceState,
InviteTargetUserType,
PresenceUpdateStatus,
APIApplicationCommandInteraction,
APIApplication,
} from '../payloads';
export const GatewayVersion = '8';
/**
* https://discord.com/developers/docs/topics/opcodes-and-status-codes#gateway-gateway-opcodes
*/
export const enum GatewayOPCodes {
Dispatch,
Heartbeat,
Identify,
PresenceUpdate,
VoiceStateUpdate,
Resume = 6,
Reconnect,
RequestGuildMembers,
InvalidSession,
Hello,
HeartbeatAck,
}
/**
* https://discord.com/developers/docs/topics/opcodes-and-status-codes#gateway-gateway-close-event-codes
*/
export const enum GatewayCloseCodes {
UnknownError = 4000,
UnknownOpCode,
DecodeError,
NotAuthenticated,
AuthenticationFailed,
AlreadyAuthenticated,
InvalidSeq = 4007,
RateLimited,
SessionTimedOut,
InvalidShard,
ShardingRequired,
InvalidAPIVersion,
InvalidIntents,
DisallowedIntents,
}
/**
* https://discord.com/developers/docs/topics/opcodes-and-status-codes#voice-voice-opcodes
*/
export const enum VoiceOPCodes {
Identify,
SelectProtocol,
Ready,
Heartbeat,
SessionDescription,
Speaking,
HeartbeatAck,
Resume,
Hello,
Resumed,
ClientConnect = 12,
ClientDisconnect,
}
/**
* https://discord.com/developers/docs/topics/opcodes-and-status-codes#voice-voice-close-event-codes
*/
export const enum VoiceCloseCodes {
UnknownOpCode = 4001,
NotAuthenticated = 4003,
AuthenticationFailed,
AlreadyAuthenticated,
SessionNoLongerValid,
SessionTimeout = 4009,
ServerNotFound = 4011,
UnknownProtocol,
Disconnected = 4014,
VoiceServerCrashed,
UnknownEncryptionMode,
}
/**
* https://discord.com/developers/docs/topics/gateway#list-of-intents
*/
export const enum GatewayIntentBits {
GUILDS = 1 << 0,
GUILD_MEMBERS = 1 << 1,
GUILD_BANS = 1 << 2,
GUILD_EMOJIS = 1 << 3,
GUILD_INTEGRATIONS = 1 << 4,
GUILD_WEBHOOKS = 1 << 5,
GUILD_INVITES = 1 << 6,
GUILD_VOICE_STATES = 1 << 7,
GUILD_PRESENCES = 1 << 8,
GUILD_MESSAGES = 1 << 9,
GUILD_MESSAGE_REACTIONS = 1 << 10,
GUILD_MESSAGE_TYPING = 1 << 11,
DIRECT_MESSAGES = 1 << 12,
DIRECT_MESSAGE_REACTIONS = 1 << 13,
DIRECT_MESSAGE_TYPING = 1 << 14,
}
/**
* https://discord.com/developers/docs/topics/gateway#commands-and-events-gateway-events
*/
export const enum GatewayDispatchEvents {
Ready = 'READY',
Resumed = 'RESUMED',
ChannelCreate = 'CHANNEL_CREATE',
ChannelUpdate = 'CHANNEL_UPDATE',
ChannelDelete = 'CHANNEL_DELETE',
ChannelPinsUpdate = 'CHANNEL_PINS_UPDATE',
GuildCreate = 'GUILD_CREATE',
GuildUpdate = 'GUILD_UPDATE',
GuildDelete = 'GUILD_DELETE',
GuildBanAdd = 'GUILD_BAN_ADD',
GuildBanRemove = 'GUILD_BAN_REMOVE',
GuildEmojisUpdate = 'GUILD_EMOJIS_UPDATE',
GuildIntegrationsUpdate = 'GUILD_INTEGRATIONS_UPDATE',
GuildMemberAdd = 'GUILD_MEMBER_ADD',
GuildMemberRemove = 'GUILD_MEMBER_REMOVE',
GuildMemberUpdate = 'GUILD_MEMBER_UPDATE',
GuildMembersChunk = 'GUILD_MEMBERS_CHUNK',
GuildRoleCreate = 'GUILD_ROLE_CREATE',
GuildRoleUpdate = 'GUILD_ROLE_UPDATE',
GuildRoleDelete = 'GUILD_ROLE_DELETE',
InteractionCreate = 'INTERACTION_CREATE',
InviteCreate = 'INVITE_CREATE',
InviteDelete = 'INVITE_DELETE',
MessageCreate = 'MESSAGE_CREATE',
MessageUpdate = 'MESSAGE_UPDATE',
MessageDelete = 'MESSAGE_DELETE',
MessageDeleteBulk = 'MESSAGE_DELETE_BULK',
MessageReactionAdd = 'MESSAGE_REACTION_ADD',
MessageReactionRemove = 'MESSAGE_REACTION_REMOVE',
MessageReactionRemoveAll = 'MESSAGE_REACTION_REMOVE_ALL',
MessageReactionRemoveEmoji = 'MESSAGE_REACTION_REMOVE_EMOJI',
PresenceUpdate = 'PRESENCE_UPDATE',
TypingStart = 'TYPING_START',
UserUpdate = 'USER_UPDATE',
VoiceStateUpdate = 'VOICE_STATE_UPDATE',
VoiceServerUpdate = 'VOICE_SERVER_UPDATE',
WebhooksUpdate = 'WEBHOOKS_UPDATE',
}
export type GatewaySendPayload =
| GatewayHeartbeat
| GatewayIdentify
| GatewayUpdatePresence
| GatewayVoiceStateUpdate
| GatewayResume
| GatewayRequestGuildMembers;
export type GatewayReceivePayload =
| GatewayHello
| GatewayHeartbeatRequest
| GatewayHeartbeatAck
| GatewayInvalidSession
| GatewayReconnect
| GatewayDispatchPayload;
export type GatewayDispatchPayload =
| GatewayReadyDispatch
| GatewayResumedDispatch
| GatewayChannelModifyDispatch
| GatewayChannelPinsUpdateDispatch
| GatewayGuildModifyDispatch
| GatewayGuildDeleteDispatch
| GatewayGuildBanModifyDispatch
| GatewayGuildEmojisUpdateDispatch
| GatewayGuildIntegrationsUpdateDispatch
| GatewayGuildMemberAddDispatch
| GatewayGuildMemberRemoveDispatch
| GatewayGuildMemberUpdateDispatch
| GatewayGuildMembersChunkDispatch
| GatewayGuildRoleModifyDispatch
| GatewayGuildRoleDeleteDispatch
| GatewayInteractionCreateDispatch
| GatewayInviteCreateDispatch
| GatewayInviteDeleteDispatch
| GatewayMessageCreateDispatch
| GatewayMessageUpdateDispatch
| GatewayMessageDeleteDispatch
| GatewayMessageDeleteBulkDispatch
| GatewayMessageReactionAddDispatch
| GatewayMessageReactionRemoveDispatch
| GatewayMessageReactionRemoveAllDispatch
| GatewayMessageReactionRemoveEmojiDispatch
| GatewayPresenceUpdateDispatch
| GatewayTypingStartDispatch
| GatewayUserUpdateDispatch
| GatewayVoiceStateUpdateDispatch
| GatewayVoiceServerUpdateDispatch
| GatewayWebhooksUpdateDispatch;
// #region Dispatch Payloads
/**
* https://discord.com/developers/docs/topics/gateway#hello
*/
export interface GatewayHello extends NonDispatchPayload {
op: GatewayOPCodes.Hello;
d: GatewayHelloData;
}
/**
* https://discord.com/developers/docs/topics/gateway#hello
*/
export interface GatewayHelloData {
heartbeat_interval: number;
}
/**
* https://discord.com/developers/docs/topics/gateway#heartbeating
*/
export interface GatewayHeartbeatRequest extends NonDispatchPayload {
op: GatewayOPCodes.Heartbeat;
d: never;
}
/**
* https://discord.com/developers/docs/topics/gateway#heartbeating-example-gateway-heartbeat-ack
*/
export interface GatewayHeartbeatAck extends NonDispatchPayload {
op: GatewayOPCodes.HeartbeatAck;
d: never;
}
/**
* https://discord.com/developers/docs/topics/gateway#invalid-session
*/
export interface GatewayInvalidSession extends NonDispatchPayload {
op: GatewayOPCodes.InvalidSession;
d: GatewayInvalidSessionData;
}
/**
* https://discord.com/developers/docs/topics/gateway#invalid-session
*/
export type GatewayInvalidSessionData = boolean;
/**
* https://discord.com/developers/docs/topics/gateway#reconnect
*/
export interface GatewayReconnect extends NonDispatchPayload {
op: GatewayOPCodes.Reconnect;
d: never;
}
/**
* https://discord.com/developers/docs/topics/gateway#ready
*/
export type GatewayReadyDispatch = DataPayload<GatewayDispatchEvents.Ready, GatewayReadyDispatchData>;
/**
* https://discord.com/developers/docs/topics/gateway#ready
*/
export interface GatewayReadyDispatchData {
v: number;
user: APIUser;
session_id: string;
private_channels: [];
guilds: APIUnavailableGuild[];
shard?: [shardID: number, shardCount: number];
application: Pick<APIApplication, 'id' | 'flags'>;
}
/**
* https://discord.com/developers/docs/topics/gateway#resumed
*/
export type GatewayResumedDispatch = DataPayload<GatewayDispatchEvents.Resumed, never>;
/**
* https://discord.com/developers/docs/topics/gateway#channel-create
* https://discord.com/developers/docs/topics/gateway#channel-update
* https://discord.com/developers/docs/topics/gateway#channel-delete
*/
export type GatewayChannelModifyDispatch = DataPayload<
GatewayDispatchEvents.ChannelCreate | GatewayDispatchEvents.ChannelDelete | GatewayDispatchEvents.ChannelUpdate,
GatewayChannelModifyDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#channel-create
* https://discord.com/developers/docs/topics/gateway#channel-update
* https://discord.com/developers/docs/topics/gateway#channel-delete
*/
export type GatewayChannelModifyDispatchData = APIChannel;
export type GatewayChannelCreateDispatch = GatewayChannelModifyDispatch;
export type GatewayChannelCreateDispatchData = GatewayChannelModifyDispatchData;
export type GatewayChannelUpdateDispatch = GatewayChannelModifyDispatch;
export type GatewayChannelUpdateDispatchData = GatewayChannelModifyDispatchData;
export type GatewayChannelDeleteDispatch = GatewayChannelModifyDispatch;
export type GatewayChannelDeleteDispatchData = GatewayChannelModifyDispatchData;
/**
* https://discord.com/developers/docs/topics/gateway#channel-pins-update
*/
export type GatewayChannelPinsUpdateDispatch = DataPayload<
GatewayDispatchEvents.ChannelPinsUpdate,
GatewayChannelPinsUpdateDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#channel-pins-update
*/
export interface GatewayChannelPinsUpdateDispatchData {
guild_id?: string;
channel_id: string;
last_pin_timestamp?: string | null;
}
/**
* https://discord.com/developers/docs/topics/gateway#guild-create
* https://discord.com/developers/docs/topics/gateway#guild-update
*/
export type GatewayGuildModifyDispatch = DataPayload<
GatewayDispatchEvents.GuildCreate | GatewayDispatchEvents.GuildUpdate,
GatewayGuildModifyDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#guild-create
* https://discord.com/developers/docs/topics/gateway#guild-update
*/
export type GatewayGuildModifyDispatchData = APIGuild;
export type GatewayGuildCreateDispatch = GatewayGuildModifyDispatch;
export type GatewayGuildCreateDispatchData = GatewayGuildModifyDispatchData;
export type GatewayGuildUpdateDispatch = GatewayGuildModifyDispatch;
export type GatewayGuildUpdateDispatchData = GatewayGuildModifyDispatchData;
/**
* https://discord.com/developers/docs/topics/gateway#guild-delete
*/
export type GatewayGuildDeleteDispatch = DataPayload<GatewayDispatchEvents.GuildDelete, GatewayGuildDeleteDispatchData>;
/**
* https://discord.com/developers/docs/topics/gateway#guild-delete
*/
export type GatewayGuildDeleteDispatchData = APIUnavailableGuild;
/**
* https://discord.com/developers/docs/topics/gateway#guild-ban-add
* https://discord.com/developers/docs/topics/gateway#guild-ban-remove
*/
export type GatewayGuildBanModifyDispatch = DataPayload<
GatewayDispatchEvents.GuildBanAdd | GatewayDispatchEvents.GuildBanRemove,
GatewayGuildBanModifyDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#guild-ban-add
* https://discord.com/developers/docs/topics/gateway#guild-ban-remove
*/
export interface GatewayGuildBanModifyDispatchData {
guild_id: string;
user: APIUser;
}
export type GatewayGuildBanAddDispatch = GatewayGuildBanModifyDispatch;
export type GatewayGuildBanAddDispatchData = GatewayGuildBanModifyDispatchData;
export type GatewayGuildBanRemoveDispatch = GatewayGuildBanModifyDispatch;
export type GatewayGuildBanRemoveDispatchData = GatewayGuildBanModifyDispatchData;
/**
* https://discord.com/developers/docs/topics/gateway#guild-emojis-update
*/
export type GatewayGuildEmojisUpdateDispatch = DataPayload<
GatewayDispatchEvents.GuildEmojisUpdate,
GatewayGuildEmojisUpdateDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#guild-emojis-update
*/
export interface GatewayGuildEmojisUpdateDispatchData {
guild_id: string;
emojis: APIEmoji[];
}
/**
* https://discord.com/developers/docs/topics/gateway#guild-integrations-update
*/
export type GatewayGuildIntegrationsUpdateDispatch = DataPayload<
GatewayDispatchEvents.GuildIntegrationsUpdate,
GatewayGuildIntegrationsUpdateDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#guild-integrations-update
*/
export interface GatewayGuildIntegrationsUpdateDispatchData {
guild_id: string;
}
/**
* https://discord.com/developers/docs/topics/gateway#guild-member-add
*/
export type GatewayGuildMemberAddDispatch = DataPayload<
GatewayDispatchEvents.GuildMemberAdd,
GatewayGuildMemberAddDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#guild-member-add
*/
export interface GatewayGuildMemberAddDispatchData extends APIGuildMember {
guild_id: string;
}
/**
* https://discord.com/developers/docs/topics/gateway#guild-member-remove
*/
export type GatewayGuildMemberRemoveDispatch = DataPayload<
GatewayDispatchEvents.GuildMemberRemove,
GatewayGuildMemberRemoveDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#guild-member-remove
*/
export interface GatewayGuildMemberRemoveDispatchData {
guild_id: string;
user: APIUser;
}
/**
* https://discord.com/developers/docs/topics/gateway#guild-member-update
*/
export type GatewayGuildMemberUpdateDispatch = DataPayload<
GatewayDispatchEvents.GuildMemberUpdate,
GatewayGuildMemberUpdateDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#guild-member-update
*/
export type GatewayGuildMemberUpdateDispatchData = Omit<APIGuildMember, 'deaf' | 'mute'> & {
guild_id: string;
};
/**
* https://discord.com/developers/docs/topics/gateway#guild-members-chunk
*/
export type GatewayGuildMembersChunkDispatch = DataPayload<
GatewayDispatchEvents.GuildMembersChunk,
GatewayGuildMembersChunkDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#guild-members-chunk
*/
export interface GatewayGuildMembersChunkDispatchData {
guild_id: string;
members: APIGuildMember[];
chunk_index?: number;
chunk_count?: number;
not_found?: unknown[];
presences?: RawGatewayPresenceUpdate[];
nonce?: string;
}
/**
* https://discord.com/developers/docs/topics/gateway#guild-role-create
* https://discord.com/developers/docs/topics/gateway#guild-role-update
*/
export type GatewayGuildRoleModifyDispatch = DataPayload<
GatewayDispatchEvents.GuildRoleCreate | GatewayDispatchEvents.GuildRoleUpdate,
GatewayGuildRoleModifyDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#guild-role-create
* https://discord.com/developers/docs/topics/gateway#guild-role-update
*/
export interface GatewayGuildRoleModifyDispatchData {
guild_id: string;
role: APIRole;
}
export type GatewayGuildRoleCreateDispatch = GatewayGuildRoleModifyDispatch;
export type GatewayGuildRoleCreateDispatchData = GatewayGuildRoleModifyDispatchData;
export type GatewayGuildRoleUpdateDispatch = GatewayGuildRoleModifyDispatch;
export type GatewayGuildRoleUpdateDispatchData = GatewayGuildRoleModifyDispatchData;
/**
* https://discord.com/developers/docs/topics/gateway#guild-role-delete
*/
export type GatewayGuildRoleDeleteDispatch = DataPayload<
GatewayDispatchEvents.GuildRoleDelete,
GatewayGuildRoleDeleteDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#guild-role-delete
*/
export interface GatewayGuildRoleDeleteDispatchData {
guild_id: string;
role_id: string;
}
/**
* https://discord.com/developers/docs/topics/gateway#interaction-create
*/
export type GatewayInteractionCreateDispatch = DataPayload<
GatewayDispatchEvents.InteractionCreate,
GatewayInteractionCreateDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#interaction-create
*/
export type GatewayInteractionCreateDispatchData = APIApplicationCommandInteraction;
/**
* https://discord.com/developers/docs/topics/gateway#invite-create
*/
export type GatewayInviteCreateDispatch = DataPayload<
GatewayDispatchEvents.InviteCreate,
GatewayInviteCreateDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#invite-create
*/
export interface GatewayInviteCreateDispatchData {
channel_id: string;
code: string;
created_at: number;
guild_id?: string;
inviter?: APIUser;
max_age: number;
max_uses: number;
target_user?: APIUser;
target_user_type?: InviteTargetUserType;
temporary: boolean;
uses: 0;
}
/**
* https://discord.com/developers/docs/topics/gateway#invite-delete
*/
export type GatewayInviteDeleteDispatch = DataPayload<
GatewayDispatchEvents.InviteDelete,
GatewayInviteDeleteDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#invite-delete
*/
export interface GatewayInviteDeleteDispatchData {
channel_id: string;
guild_id?: string;
code: string;
}
/**
* https://discord.com/developers/docs/topics/gateway#message-create
*/
export type GatewayMessageCreateDispatch = DataPayload<
GatewayDispatchEvents.MessageCreate,
GatewayMessageCreateDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#message-create
*/
export type GatewayMessageCreateDispatchData = APIMessage;
/**
* https://discord.com/developers/docs/topics/gateway#message-update
*/
export type GatewayMessageUpdateDispatch = DataPayload<
GatewayDispatchEvents.MessageUpdate,
GatewayMessageUpdateDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#message-update
*/
export type GatewayMessageUpdateDispatchData = {
id: string;
channel_id: string;
} & Partial<APIMessage>;
/**
* https://discord.com/developers/docs/topics/gateway#message-delete
*/
export type GatewayMessageDeleteDispatch = DataPayload<
GatewayDispatchEvents.MessageDelete,
GatewayMessageDeleteDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#message-delete
*/
export interface GatewayMessageDeleteDispatchData {
id: string;
channel_id: string;
guild_id?: string;
}
/**
* https://discord.com/developers/docs/topics/gateway#message-delete-bulk
*/
export type GatewayMessageDeleteBulkDispatch = DataPayload<
GatewayDispatchEvents.MessageDeleteBulk,
GatewayMessageDeleteBulkDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#message-delete-bulk
*/
export interface GatewayMessageDeleteBulkDispatchData {
ids: string[];
channel_id: string;
guild_id?: string;
}
/**
* https://discord.com/developers/docs/topics/gateway#message-reaction-add
*/
export type GatewayMessageReactionAddDispatch = ReactionData<GatewayDispatchEvents.MessageReactionAdd>;
/**
* https://discord.com/developers/docs/topics/gateway#message-reaction-add
*/
export type GatewayMessageReactionAddDispatchData = GatewayMessageReactionAddDispatch['d'];
/**
* https://discord.com/developers/docs/topics/gateway#message-reaction-remove
*/
export type GatewayMessageReactionRemoveDispatch = ReactionData<GatewayDispatchEvents.MessageReactionRemove, 'member'>;
/**
* https://discord.com/developers/docs/topics/gateway#message-reaction-remove
*/
export type GatewayMessageReactionRemoveDispatchData = GatewayMessageReactionRemoveDispatch['d'];
/**
* https://discord.com/developers/docs/topics/gateway#message-reaction-remove-all
*/
export type GatewayMessageReactionRemoveAllDispatch = DataPayload<
GatewayDispatchEvents.MessageReactionRemoveAll,
GatewayMessageReactionRemoveAllDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#message-reaction-remove-all
*/
export type GatewayMessageReactionRemoveAllDispatchData = MessageReactionRemoveData;
/**
* https://discord.com/developers/docs/topics/gateway#message-reaction-remove-emoji
*/
export type GatewayMessageReactionRemoveEmojiDispatch = DataPayload<
GatewayDispatchEvents.MessageReactionRemoveEmoji,
GatewayMessageReactionRemoveEmojiDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#message-reaction-remove-emoji
*/
export interface GatewayMessageReactionRemoveEmojiDispatchData extends MessageReactionRemoveData {
emoji: APIEmoji;
}
/**
* https://discord.com/developers/docs/topics/gateway#presence-update
*/
export type GatewayPresenceUpdateDispatch = DataPayload<
GatewayDispatchEvents.PresenceUpdate,
GatewayPresenceUpdateDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#presence-update
*/
export type GatewayPresenceUpdateDispatchData = RawGatewayPresenceUpdate;
/**
* https://discord.com/developers/docs/topics/gateway#typing-start
*/
export type GatewayTypingStartDispatch = DataPayload<GatewayDispatchEvents.TypingStart, GatewayTypingStartDispatchData>;
/**
* https://discord.com/developers/docs/topics/gateway#typing-start
*/
export interface GatewayTypingStartDispatchData {
channel_id: string;
guild_id?: string;
user_id: string;
timestamp: number;
member?: APIGuildMember;
}
/**
* https://discord.com/developers/docs/topics/gateway#user-update
*/
export type GatewayUserUpdateDispatch = DataPayload<GatewayDispatchEvents.UserUpdate, GatewayUserUpdateDispatchData>;
/**
* https://discord.com/developers/docs/topics/gateway#user-update
*/
export type GatewayUserUpdateDispatchData = APIUser;
/**
* https://discord.com/developers/docs/topics/gateway#voice-state-update
*/
export type GatewayVoiceStateUpdateDispatch = DataPayload<
GatewayDispatchEvents.VoiceStateUpdate,
GatewayVoiceStateUpdateDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#voice-state-update
*/
export type GatewayVoiceStateUpdateDispatchData = GatewayVoiceState;
/**
* https://discord.com/developers/docs/topics/gateway#voice-server-update
*/
export type GatewayVoiceServerUpdateDispatch = DataPayload<
GatewayDispatchEvents.VoiceServerUpdate,
GatewayVoiceServerUpdateDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#voice-server-update
*/
export interface GatewayVoiceServerUpdateDispatchData {
token: string;
guild_id: string;
endpoint: string;
}
/**
* https://discord.com/developers/docs/topics/gateway#webhooks-update
*/
export type GatewayWebhooksUpdateDispatch = DataPayload<
GatewayDispatchEvents.WebhooksUpdate,
GatewayWebhooksUpdateDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#webhooks-update
*/
export interface GatewayWebhooksUpdateDispatchData {
guild_id: string;
channel_id: string;
}
// #endregion Dispatch Payloads
// #region Sendable Payloads
/**
* https://discord.com/developers/docs/topics/gateway#heartbeating
*/
export interface GatewayHeartbeat {
op: GatewayOPCodes.Heartbeat;
d: GatewayHeartbeatData;
}
/**
* https://discord.com/developers/docs/topics/gateway#heartbeating
*/
export type GatewayHeartbeatData = number | null;
/**
* https://discord.com/developers/docs/topics/gateway#identify-identify-connection-properties
*/
export interface GatewayIdentifyProperties {
$os: string;
$browser: string;
$device: string;
}
/**
* https://discord.com/developers/docs/topics/gateway#identify
*/
export interface GatewayIdentify {
op: GatewayOPCodes.Identify;
d: GatewayIdentifyData;
}
/**
* https://discord.com/developers/docs/topics/gateway#identify
*/
export interface GatewayIdentifyData {
token: string;
properties: GatewayIdentifyProperties;
compress?: boolean;
large_threshold?: number;
// eslint-disable-next-line prettier/prettier
shard?: [shard_id: number, shard_count: number];
presence?: GatewayPresenceUpdateData;
guild_subscriptions?: boolean;
intents: number;
}
/**
* https://discord.com/developers/docs/topics/gateway#resume
*/
export interface GatewayResume {
op: GatewayOPCodes.Resume;
d: GatewayResumeData;
}
/**
* https://discord.com/developers/docs/topics/gateway#resume
*/
export interface GatewayResumeData {
token: string;
session_id: string;
seq: number;
}
/**
* https://discord.com/developers/docs/topics/gateway#request-guild-members
*/
export interface GatewayRequestGuildMembers {
op: GatewayOPCodes.RequestGuildMembers;
d: GatewayRequestGuildMembersData;
}
/**
* https://discord.com/developers/docs/topics/gateway#request-guild-members
*/
export interface GatewayRequestGuildMembersData {
guild_id: string | string[];
query?: string;
limit: number;
presences?: boolean;
user_ids?: string | string[];
nonce?: string;
}
/**
* https://discord.com/developers/docs/topics/gateway#update-voice-state
*/
export interface GatewayVoiceStateUpdate {
op: GatewayOPCodes.VoiceStateUpdate;
d: GatewayVoiceStateUpdateData;
}
/**
* https://discord.com/developers/docs/topics/gateway#update-voice-state
*/
export interface GatewayVoiceStateUpdateData {
guild_id: string;
channel_id: string | null;
self_mute: boolean;
self_deaf: boolean;
}
/**
* https://discord.com/developers/docs/topics/gateway#update-status
*/
export interface GatewayUpdatePresence {
op: GatewayOPCodes.PresenceUpdate;
d: GatewayPresenceUpdateData;
}
/**
* https://discord.com/developers/docs/topics/gateway#update-status-gateway-status-update-structure
*/
export interface GatewayPresenceUpdateData {
since: number | null;
activities: GatewayActivityUpdateData[] | null;
status: PresenceUpdateStatus;
afk: boolean;
}
/**
* https://discord.com/developers/docs/topics/gateway#activity-object-activity-structure
*/
export type GatewayActivityUpdateData = Pick<GatewayActivity, 'name' | 'type' | 'url'>;
// #endregion Sendable Payloads
// #region Shared
interface BasePayload {
op: GatewayOPCodes;
s: number;
d?: unknown;
t?: string;
}
type NonDispatchPayload = Omit<BasePayload, 't'>;
interface DataPayload<Event extends GatewayDispatchEvents, D = unknown> extends BasePayload {
op: GatewayOPCodes.Dispatch;
t: Event;
d: D;
}
type ReactionData<E extends GatewayDispatchEvents, O extends string = never> = DataPayload<
E,
Omit<
{
user_id: string;
channel_id: string;
message_id: string;
guild_id?: string;
member?: APIGuildMember;
emoji: APIEmoji;
},
O
>
>;
interface MessageReactionRemoveData {
channel_id: string;
message_id: string;
guild_id?: string;
}
// #endregion Shared

4
v8/index.ts Normal file
View File

@@ -0,0 +1,4 @@
export * from '../common';
export * from './gateway';
export * from './payloads';
export * from './rest';

467
v8/payloads/auditLog.ts Normal file
View File

@@ -0,0 +1,467 @@
/**
* Types extracted from https://discord.com/developers/docs/resources/audit-log
*/
import type { APIOverwrite, ChannelType } from './channel';
import type {
APIGuildIntegration,
GuildDefaultMessageNotifications,
GuildExplicitContentFilter,
GuildMFALevel,
GuildVerificationLevel,
IntegrationExpireBehavior,
} from './guild';
import type { APIRole } from './permissions';
import type { APIUser } from './user';
import type { APIWebhook } from './webhook';
/**
* https://discord.com/developers/docs/resources/audit-log#audit-log-object-audit-log-structure
*/
export interface APIAuditLog {
webhooks: APIWebhook[];
users: APIUser[];
audit_log_entries: APIAuditLogEntry[];
integrations: APIGuildIntegration[];
}
/**
* https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-entry-structure
*/
export interface APIAuditLogEntry {
target_id: string | null;
changes?: APIAuditLogChange[];
user_id: string;
id: string;
action_type: AuditLogEvent;
options?: APIAuditLogOptions;
reason?: string;
}
/**
* https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-events
*/
export const enum AuditLogEvent {
GUILD_UPDATE = 1,
CHANNEL_CREATE = 10,
CHANNEL_UPDATE,
CHANNEL_DELETE,
CHANNEL_OVERWRITE_CREATE,
CHANNEL_OVERWRITE_UPDATE,
CHANNEL_OVERWRITE_DELETE,
MEMBER_KICK = 20,
MEMBER_PRUNE,
MEMBER_BAN_ADD,
MEMBER_BAN_REMOVE,
MEMBER_UPDATE,
MEMBER_ROLE_UPDATE,
MEMBER_MOVE,
MEMBER_DISCONNECT,
BOT_ADD,
ROLE_CREATE = 30,
ROLE_UPDATE,
ROLE_DELETE,
INVITE_CREATE = 40,
INVITE_UPDATE,
INVITE_DELETE,
WEBHOOK_CREATE = 50,
WEBHOOK_UPDATE,
WEBHOOK_DELETE,
EMOJI_CREATE = 60,
EMOJI_UPDATE,
EMOJI_DELETE,
MESSAGE_DELETE = 72,
MESSAGE_BULK_DELETE,
MESSAGE_PIN,
MESSAGE_UNPIN,
INTEGRATION_CREATE = 80,
INTEGRATION_UPDATE,
INTEGRATION_DELETE,
}
/**
* https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-optional-audit-entry-info
*/
export interface APIAuditLogOptions {
/**
* Present from:
* - MEMBER_PRUNE
*/
delete_member_days?: string;
/**
* Present from:
* - MEMBER_PRUNE
*/
members_removed?: string;
/**
* Present from:
* - MEMBER_MOVE
* - MESSAGE_PIN
* - MESSAGE_UNPIN
* - MESSAGE_DELETE
*/
channel_id?: string;
/**
* Present from:
* - MESSAGE_PIN
* - MESSAGE_UNPIN
*/
message_id?: string;
/**
* Present from:
* - MESSAGE_DELETE
* - MESSAGE_BULK_DELETE
* - MEMBER_DISCONNECT
* - MEMBER_MOVE
*/
count?: string;
/**
* Present from:
* - CHANNEL_OVERWRITE_CREATE
* - CHANNEL_OVERWRITE_UPDATE
* - CHANNEL_OVERWRITE_DELETE
*/
id?: string;
/**
* Present from:
* - CHANNEL_OVERWRITE_CREATE
* - CHANNEL_OVERWRITE_UPDATE
* - CHANNEL_OVERWRITE_DELETE
*/
type: AuditLogOptionsType;
/**
* Present from:
* - CHANNEL_OVERWRITE_CREATE
* - CHANNEL_OVERWRITE_UPDATE
* - CHANNEL_OVERWRITE_DELETE
*
* **Present only if the {@link APIAuditLogOptions#type entry type} is "role"**
*/
role_name?: string;
}
export const enum AuditLogOptionsType {
Role = '0',
Member = '1',
}
/**
* https://discord.com/developers/docs/resources/audit-log#audit-log-change-object-audit-log-change-structure
*/
export type APIAuditLogChange =
| APIAuditLogChangeKeyName
| APIAuditLogChangeKeyIconHash
| APIAuditLogChangeKeySplashHash
| APIAuditLogChangeKeyOwnerID
| APIAuditLogChangeKeyRegion
| APIAuditLogChangeKeyAFKChannelID
| APIAuditLogChangeKeyAFKTimeout
| APIAuditLogChangeKeyMFALevel
| APIAuditLogChangeKeyVerificationLevel
| APIAuditLogChangeKeyExplicitContentFilter
| APIAuditLogChangeKeyDefaultMessageNotifications
| APIAuditLogChangeKeyVanityURLCode
| APIAuditLogChangeKey$Add
| APIAuditLogChangeKey$Remove
| APIAuditLogChangeKeyPruneDeleteDays
| APIAuditLogChangeKeyWidgetEnabled
| APIAuditLogChangeKeyWidgetChannelID
| APIAuditLogChangeKeySystemChannelID
| APIAuditLogChangeKeyPosition
| APIAuditLogChangeKeyTopic
| APIAuditLogChangeKeyBitrate
| APIAuditLogChangeKeyPermissionOverwrites
| APIAuditLogChangeKeyNSFW
| APIAuditLogChangeKeyApplicationID
| APIAuditLogChangeKeyRateLimitPerUser
| APIAuditLogChangeKeyPermissions
| APIAuditLogChangeKeyColor
| APIAuditLogChangeKeyHoist
| APIAuditLogChangeKeyMentionable
| APIAuditLogChangeKeyAllow
| APIAuditLogChangeKeyDeny
| APIAuditLogChangeKeyCode
| APIAuditLogChangeKeyChannelID
| APIAuditLogChangeKeyInviterID
| APIAuditLogChangeKeyMaxUses
| APIAuditLogChangeKeyUses
| APIAuditLogChangeKeyMaxAge
| APIAuditLogChangeKeyTemporary
| APIAuditLogChangeKeyDeaf
| APIAuditLogChangeKeyMute
| APIAuditLogChangeKeyNick
| APIAuditLogChangeKeyAvatarHash
| APIAuditLogChangeKeyID
| APIAuditLogChangeKeyType
| APIAuditLogChangeKeyEnableEmoticons
| APIAuditLogChangeKeyExpireBehavior
| APIAuditLogChangeKeyExpireGracePeriod;
/**
* Returned when a guild's name is changed
*/
export type APIAuditLogChangeKeyName = AuditLogChangeData<'name', string>;
/**
* Returned when a guild's icon is changed
*/
export type APIAuditLogChangeKeyIconHash = AuditLogChangeData<'icon_hash', string>;
/**
* Returned when a guild's splash is changed
*/
export type APIAuditLogChangeKeySplashHash = AuditLogChangeData<'splash_hash', string>;
/**
* Returned when a guild's owner ID is changed
*/
export type APIAuditLogChangeKeyOwnerID = AuditLogChangeData<'owner_id', string>;
/**
* Returned when a guild's region is changed
*/
export type APIAuditLogChangeKeyRegion = AuditLogChangeData<'region', string>;
/**
* Returned when a guild's afk_channel_id is changed
*/
export type APIAuditLogChangeKeyAFKChannelID = AuditLogChangeData<'afk_channel_id', string>;
/**
* Returned when a guild's afk_timeout is changed
*/
export type APIAuditLogChangeKeyAFKTimeout = AuditLogChangeData<'afk_timeout', number>;
/**
* Returned when a guild's mfa_level is changed
*/
export type APIAuditLogChangeKeyMFALevel = AuditLogChangeData<'mfa_level', GuildMFALevel>;
/**
* Returned when a guild's verification_level is changed
*/
export type APIAuditLogChangeKeyVerificationLevel = AuditLogChangeData<'verification_level', GuildVerificationLevel>;
/**
* Returned when a guild's explicit_content_filter is changed
*/
export type APIAuditLogChangeKeyExplicitContentFilter = AuditLogChangeData<
'explicit_content_filter',
GuildExplicitContentFilter
>;
/**
* Returned when a guild's default_message_notifications is changed
*/
export type APIAuditLogChangeKeyDefaultMessageNotifications = AuditLogChangeData<
'default_message_notifications',
GuildDefaultMessageNotifications
>;
/**
* Returned when a guild's vanity_url_code is changed
*/
export type APIAuditLogChangeKeyVanityURLCode = AuditLogChangeData<'vanity_url_code', string>;
/**
* Returned when new role(s) are added
*/
export type APIAuditLogChangeKey$Add = AuditLogChangeData<'$add', APIRole[]>;
/**
* Returned when role(s) are removed
*/
export type APIAuditLogChangeKey$Remove = AuditLogChangeData<'$remove', APIRole[]>;
/**
* Returned when there is a change in number of days after which inactive and role-unassigned members are kicked
*/
export type APIAuditLogChangeKeyPruneDeleteDays = AuditLogChangeData<'prune_delete_days', number>;
/**
* Returned when a guild's widget is enabled
*/
export type APIAuditLogChangeKeyWidgetEnabled = AuditLogChangeData<'widget_enabled', boolean>;
/**
* Returned when a guild's widget_channel_id is changed
*/
export type APIAuditLogChangeKeyWidgetChannelID = AuditLogChangeData<'widget_channel_id', string>;
/**
* Returned when a guild's system_channel_id is changed
*/
export type APIAuditLogChangeKeySystemChannelID = AuditLogChangeData<'system_channel_id', string>;
/**
* Returned when a channel's position is changed
*/
export type APIAuditLogChangeKeyPosition = AuditLogChangeData<'position', number>;
/**
* Returned when a channel's topic is changed
*/
export type APIAuditLogChangeKeyTopic = AuditLogChangeData<'topic', string>;
/**
* Returned when a voice channel's bitrate is changed
*/
export type APIAuditLogChangeKeyBitrate = AuditLogChangeData<'bitrate', number>;
/**
* Returned when a channel's permission overwrites is changed
*/
export type APIAuditLogChangeKeyPermissionOverwrites = AuditLogChangeData<'permission_overwrites', APIOverwrite[]>;
/**
* Returned when a channel's NSFW restriction is changed
*/
export type APIAuditLogChangeKeyNSFW = AuditLogChangeData<'nsfw', boolean>;
/**
* The application ID of the added or removed Webhook or Bot
*/
export type APIAuditLogChangeKeyApplicationID = AuditLogChangeData<'application_id', string>;
/**
* Returned when a channel's amount of seconds a user has to wait before sending another message
* is changed
*/
export type APIAuditLogChangeKeyRateLimitPerUser = AuditLogChangeData<'rate_limit_per_user', number>;
/**
* Returned when a permission bitfield is changed
*/
export type APIAuditLogChangeKeyPermissions = AuditLogChangeData<'permissions', string>;
/**
* Returned when a role's color is changed
*/
export type APIAuditLogChangeKeyColor = AuditLogChangeData<'color', number>;
/**
* Returned when a role's hoist status is changed
*/
export type APIAuditLogChangeKeyHoist = AuditLogChangeData<'hoist', boolean>;
/**
* Returned when a role's mentionable status is changed
*/
export type APIAuditLogChangeKeyMentionable = AuditLogChangeData<'mentionable', boolean>;
/**
* Returned when an overwrite's allowed permissions bitfield is changed
*/
export type APIAuditLogChangeKeyAllow = AuditLogChangeData<'allow', string>;
/**
* Returned when an overwrite's denied permissions bitfield is changed
*/
export type APIAuditLogChangeKeyDeny = AuditLogChangeData<'deny', string>;
/**
* Returned when an invite's code is changed
*/
export type APIAuditLogChangeKeyCode = AuditLogChangeData<'code', string>;
/**
* Returned when an invite's channel_id is changed
*/
export type APIAuditLogChangeKeyChannelID = AuditLogChangeData<'channel_id', string>;
/**
* Returned when an invite's inviter_id is changed
*/
export type APIAuditLogChangeKeyInviterID = AuditLogChangeData<'inviter_id', string>;
/**
* Returned when an invite's max_uses is changed
*/
export type APIAuditLogChangeKeyMaxUses = AuditLogChangeData<'max_uses', number>;
/**
* Returned when an invite's uses is changed
*/
export type APIAuditLogChangeKeyUses = AuditLogChangeData<'uses', number>;
/**
* Returned when an invite's max_age is changed
*/
export type APIAuditLogChangeKeyMaxAge = AuditLogChangeData<'max_age', number>;
/**
* Returned when an invite's temporary status is changed
*/
export type APIAuditLogChangeKeyTemporary = AuditLogChangeData<'temporary', boolean>;
/**
* Returned when a user's deaf status is changed
*/
export type APIAuditLogChangeKeyDeaf = AuditLogChangeData<'deaf', boolean>;
/**
* Returned when a user's mute status is changed
*/
export type APIAuditLogChangeKeyMute = AuditLogChangeData<'mute', boolean>;
/**
* Returned when a user's nick is changed
*/
export type APIAuditLogChangeKeyNick = AuditLogChangeData<'mute', boolean>;
/**
* Returned when a user's avatar_hash is changed
*/
export type APIAuditLogChangeKeyAvatarHash = AuditLogChangeData<'avatar_hash', string>;
/**
* The ID of the changed entity - sometimes used in conjunction with other keys
*/
export interface APIAuditLogChangeKeyID {
key: 'id';
new_value: string;
old_value?: string;
}
/**
* The type of entity created
*/
export type APIAuditLogChangeKeyType = AuditLogChangeData<'type', ChannelType | string>;
/**
* Returned when an integration's enable_emoticons is changed
*/
export type APIAuditLogChangeKeyEnableEmoticons = AuditLogChangeData<'enable_emoticons', boolean>;
/**
* Returned when an integration's expire_behavior is changed
*/
export type APIAuditLogChangeKeyExpireBehavior = AuditLogChangeData<'expire_behavior', IntegrationExpireBehavior>;
/**
* Returned when an integration's expire_grace_period is changed
*/
export type APIAuditLogChangeKeyExpireGracePeriod = AuditLogChangeData<'expire_grace_period', number>;
/**
* @internal
*/
interface AuditLogChangeData<K extends string, D extends unknown> {
key: K;
new_value?: D;
old_value?: D;
}

332
v8/payloads/channel.ts Normal file
View File

@@ -0,0 +1,332 @@
/**
* Types extracted from https://discord.com/developers/docs/resources/channel
*/
import type { APIPartialEmoji } from './emoji';
import type { APIGuildMember } from './guild';
import type { APIUser } from './user';
/**
* Not documented, but partial only includes id, name, and type
*/
export interface APIPartialChannel {
id: string;
type: ChannelType;
name?: string;
}
/**
* https://discord.com/developers/docs/resources/channel#channel-object-channel-structure
*/
export interface APIChannel extends APIPartialChannel {
guild_id?: string;
position?: number;
permission_overwrites?: APIOverwrite[];
name?: string;
topic?: string | null;
nsfw?: boolean;
last_message_id?: string | null;
bitrate?: number;
user_limit?: number;
rate_limit_per_user?: number;
recipients?: APIUser[];
icon?: string | null;
owner_id?: string;
application_id?: string;
parent_id?: string | null;
last_pin_timestamp?: string | null;
}
/**
* https://discord.com/developers/docs/resources/channel#channel-object-channel-types
*/
export const enum ChannelType {
GUILD_TEXT = 0,
DM,
GUILD_VOICE,
GROUP_DM,
GUILD_CATEGORY,
GUILD_NEWS,
GUILD_STORE,
}
/**
* https://discord.com/developers/docs/resources/channel#message-object-message-structure
*/
export interface APIMessage {
id: string;
channel_id: string;
guild_id?: string;
author: APIUser;
member?: APIGuildMember;
content: string;
timestamp: string;
edited_timestamp: string | null;
tts: boolean;
mention_everyone: boolean;
mentions: (APIUser & { member?: Omit<APIGuildMember, 'user'> })[];
mention_roles: string[];
mention_channels?: APIChannelMention[];
attachments: APIAttachment[];
embeds: APIEmbed[];
reactions?: APIReaction[];
nonce?: string | number;
pinned: boolean;
webhook_id?: string;
type: MessageType;
activity?: APIMessageActivity;
application?: APIMessageApplication;
message_reference?: APIMessageReference;
flags?: MessageFlags;
referenced_message?: APIMessage | null;
stickers?: APISticker[];
}
/**
* https://discord.com/developers/docs/resources/channel#message-object-message-types
*/
export const enum MessageType {
DEFAULT,
RECIPIENT_ADD,
RECIPIENT_REMOVE,
CALL,
CHANNEL_NAME_CHANGE,
CHANNEL_ICON_CHANGE,
CHANNEL_PINNED_MESSAGE,
GUILD_MEMBER_JOIN,
USER_PREMIUM_GUILD_SUBSCRIPTION,
USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_1,
USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_2,
USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_3,
CHANNEL_FOLLOW_ADD,
GUILD_DISCOVERY_DISQUALIFIED = 14,
GUILD_DISCOVERY_REQUALIFIED,
GUILD_DISCOVERY_GRACE_PERIOD_INITIAL_WARNING,
GUILD_DISCOVERY_GRACE_PERIOD_FINAL_WARNING,
REPLY = 19,
}
/**
* https://discord.com/developers/docs/resources/channel#message-object-message-activity-structure
*/
export interface APIMessageActivity {
type: MessageActivityType;
party_id?: string;
}
/**
* https://discord.com/developers/docs/resources/channel#message-object-message-application-structure
*/
export interface APIMessageApplication {
id: string;
cover_image?: string;
description: string;
icon: string | null;
name: string;
}
/**
* https://discord.com/developers/docs/resources/channel#message-object-message-reference-structure
*/
export interface APIMessageReference {
message_id?: string;
channel_id?: string;
guild_id?: string;
}
/**
* https://discord.com/developers/docs/resources/channel#message-object-message-activity-types
*/
export const enum MessageActivityType {
JOIN = 1,
SPECTATE,
LISTEN,
JOIN_REQUEST = 5,
}
/**
* https://discord.com/developers/docs/resources/channel#message-object-message-flags
*/
export const enum MessageFlags {
CROSSPOSTED = 1 << 0,
IS_CROSSPOST = 1 << 1,
SUPPRESS_EMBEDS = 1 << 2,
SOURCE_MESSAGE_DELETED = 1 << 3,
URGENT = 1 << 4,
EPHEMERAL = 1 << 6,
}
/**
* https://discord.com/developers/docs/resources/channel#message-object-message-sticker-structure
*/
export interface APISticker {
id: string;
pack_id: string;
name: string;
description: string;
tags?: string;
asset: string;
preview_asset: string | null;
format_type: StickerFormatType;
}
/**
* https://discord.com/developers/docs/resources/channel#message-object-message-sticker-format-types
*/
export const enum StickerFormatType {
PNG = 1,
APNG,
LOTTIE,
}
/**
* https://discord.com/developers/docs/resources/channel#reaction-object-reaction-structure
*/
export interface APIReaction {
count: number;
me: boolean;
emoji: APIPartialEmoji;
}
/**
* https://discord.com/developers/docs/resources/channel#overwrite-object-overwrite-structure
*/
export interface APIOverwrite {
id: string;
type: OverwriteType;
allow: string;
deny: string;
}
export const enum OverwriteType {
Role,
Member,
}
/**
* https://discord.com/developers/docs/resources/channel#embed-object-embed-structure
*/
export interface APIEmbed {
title?: string;
/**
* @deprecated *Embed types should be considered deprecated and might be removed in a future API version*
*/
type?: EmbedType;
description?: string;
url?: string;
timestamp?: string;
color?: number;
footer?: APIEmbedFooter;
image?: APIEmbedImage;
thumbnail?: APIEmbedThumbnail;
video?: APIEmbedVideo;
provider?: APIEmbedProvider;
author?: APIEmbedAuthor;
fields?: APIEmbedField[];
}
/**
* 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*
*/
export const enum EmbedType {
Rich = 'rich',
Image = 'image',
Video = 'video',
GifV = 'gifv',
Article = 'article',
Link = 'link',
}
/**
* https://discord.com/developers/docs/resources/channel#embed-object-embed-thumbnail-structure
*/
export interface APIEmbedThumbnail {
url?: string;
proxy_url?: string;
height?: number;
width?: number;
}
/**
* https://discord.com/developers/docs/resources/channel#embed-object-embed-video-structure
*/
export interface APIEmbedVideo {
url?: string;
height?: number;
width?: number;
}
/**
* https://discord.com/developers/docs/resources/channel#embed-object-embed-image-structure
*/
export interface APIEmbedImage {
url?: string;
proxy_url?: string;
height?: number;
width?: number;
}
/**
* https://discord.com/developers/docs/resources/channel#embed-object-embed-provider-structure
*/
export interface APIEmbedProvider {
name?: string;
url?: string;
}
/**
* https://discord.com/developers/docs/resources/channel#embed-object-embed-author-structure
*/
export interface APIEmbedAuthor {
name?: string;
url?: string;
icon_url?: string;
proxy_icon_url?: string;
}
/**
* https://discord.com/developers/docs/resources/channel#embed-object-embed-footer-structure
*/
export interface APIEmbedFooter {
text: string;
icon_url?: string;
proxy_icon_url?: string;
}
/**
* https://discord.com/developers/docs/resources/channel#embed-object-embed-field-structure
*/
export interface APIEmbedField {
name: string;
value: string;
inline?: boolean;
}
/**
* https://discord.com/developers/docs/resources/channel#attachment-object-attachment-structure
*/
export interface APIAttachment {
id: string;
filename: string;
size: number;
url: string;
proxy_url: string;
height: number | null;
width: number | null;
}
/**
* https://discord.com/developers/docs/resources/channel#channel-mention-object-channel-mention-structure
*/
export interface APIChannelMention {
id: string;
guild_id: string;
type: ChannelType;
name: string;
}
export interface APIFollowedChannel {
channel_id: string;
webhook_id: string;
}

25
v8/payloads/emoji.ts Normal file
View File

@@ -0,0 +1,25 @@
/**
* Types extracted from https://discord.com/developers/docs/resources/emoji
*/
import type { APIUser } from './user';
/**
* Not documented but mentioned
*/
export interface APIPartialEmoji {
id: string | null;
name: string | null;
animated?: boolean;
}
/**
* https://discord.com/developers/docs/resources/emoji#emoji-object-emoji-structure
*/
export interface APIEmoji extends APIPartialEmoji {
roles?: string[];
user?: APIUser;
require_colons?: boolean;
managed?: boolean;
available?: boolean;
}

134
v8/payloads/gateway.ts Normal file
View File

@@ -0,0 +1,134 @@
/**
* Types extracted from https://discord.com/developers/docs/topics/gateway
*/
import type { APIEmoji } from './emoji';
import type { APIUser } from './user';
/**
* https://discord.com/developers/docs/topics/gateway#get-gateway
*/
export interface APIGatewayInfo {
url: string;
}
/**
* https://discord.com/developers/docs/topics/gateway#get-gateway-bot
*/
export interface APIGatewayBotInfo extends APIGatewayInfo {
shards: number;
session_start_limit: APIGatewaySessionStartLimit;
}
/**
* https://discord.com/developers/docs/topics/gateway#session-start-limit-object
*/
export interface APIGatewaySessionStartLimit {
total: number;
remaining: number;
reset_after: number;
}
/**
* https://discord.com/developers/docs/topics/gateway#presence-update-presence-update-event-fields
*/
export interface GatewayPresenceUpdate {
user: Partial<APIUser> & {
id: string;
};
guild_id?: string;
status?: PresenceUpdateStatus;
activities?: GatewayActivity[];
client_status?: GatewayPresenceClientStatus;
}
export const enum PresenceUpdateStatus {
DoNotDisturb = 'dnd',
Idle = 'idle',
Invisible = 'invisible',
Offline = 'offline',
Online = 'online',
}
/**
* https://discord.com/developers/docs/topics/gateway#client-status-object
*/
export type GatewayPresenceClientStatus = Partial<Record<'desktop' | 'mobile' | 'web', PresenceUpdateStatus>>;
/**
* https://discord.com/developers/docs/topics/gateway#activity-object-activity-structure
*/
export interface GatewayActivity {
name: string;
type: ActivityType;
url?: string | null;
created_at: number;
timestamps?: GatewayActivityTimestamps;
application_id?: string;
details?: string | null;
state?: string | null;
emoji?: GatewayActivityEmoji;
party?: GatewayActivityParty;
assets?: GatewayActivityAssets;
secrets?: GatewayActivitySecrets;
instance?: boolean;
flags?: ActivityFlags;
}
/**
* https://discord.com/developers/docs/topics/gateway#activity-object-activity-types
*/
export const enum ActivityType {
Game,
Streaming,
Listening,
Custom = 4,
Competing,
}
/**
* https://discord.com/developers/docs/topics/gateway#activity-object-activity-timestamps
*/
export interface GatewayActivityTimestamps {
start?: number;
end?: number;
}
/**
* https://discord.com/developers/docs/topics/gateway#activity-object-activity-emoji
*/
export type GatewayActivityEmoji = Partial<Pick<APIEmoji, 'name' | 'animated'>> & Pick<APIEmoji, 'id'>;
/**
* https://discord.com/developers/docs/topics/gateway#activity-object-activity-party
*/
export interface GatewayActivityParty {
id?: string;
// eslint-disable-next-line prettier/prettier
size?: [currentSize: number, maxSize: number];
}
/**
* https://discord.com/developers/docs/topics/gateway#activity-object-activity-assets
*/
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
*/
export type GatewayActivitySecrets = Partial<Record<'join' | 'spectate' | 'match', string>>;
/**
* https://discord.com/developers/docs/topics/gateway#activity-object-activity-flags
*/
export const enum ActivityFlags {
INSTANCE = 1 << 0,
JOIN = 1 << 1,
SPECTATE = 1 << 2,
JOIN_REQUEST = 1 << 3,
SYNC = 1 << 4,
PLAY = 1 << 5,
}

310
v8/payloads/guild.ts Normal file
View File

@@ -0,0 +1,310 @@
/**
* Types extracted from https://discord.com/developers/docs/resources/guild
*/
import type { APIChannel } from './channel';
import type { APIEmoji } from './emoji';
import type { GatewayPresenceUpdate, PresenceUpdateStatus } from './gateway';
import type { APIRole } from './permissions';
import type { APIUser } from './user';
import type { GatewayVoiceState } from './voice';
/**
* https://discord.com/developers/docs/resources/guild#unavailable-guild-object
*/
export interface APIUnavailableGuild {
id: string;
unavailable: boolean;
}
/**
* https://discord.com/developers/docs/resources/guild#guild-object-guild-structure
*/
export interface APIPartialGuild extends Omit<APIUnavailableGuild, 'unavailable'>, Pick<APIGuild, 'welcome_screen'> {
name: string;
icon: string | null;
splash: string | null;
banner?: string | null;
description?: string | null;
features?: GuildFeature[];
verification_level?: GuildVerificationLevel;
vanity_url_code?: string | null;
unavailable?: boolean;
}
/**
* https://discord.com/developers/docs/resources/guild#guild-object-guild-structure
*/
export interface APIGuild extends APIPartialGuild {
icon_hash?: string | null;
discovery_splash: string | null;
owner?: boolean;
owner_id: string;
permissions?: string;
region: string;
afk_channel_id: string | null;
afk_timeout: number;
widget_enabled?: boolean;
widget_channel_id?: string | null;
verification_level: GuildVerificationLevel;
default_message_notifications: GuildDefaultMessageNotifications;
explicit_content_filter: GuildExplicitContentFilter;
roles: APIRole[];
emojis: APIEmoji[];
features: GuildFeature[];
mfa_level: GuildMFALevel;
application_id: string | null;
system_channel_id: string | null;
system_channel_flags: GuildSystemChannelFlags;
rules_channel_id: string | null;
joined_at?: string;
large?: boolean;
member_count?: number;
voice_states?: Omit<GatewayVoiceState, 'guild_id'>[];
members?: APIGuildMember[];
channels?: APIChannel[];
presences?: GatewayPresenceUpdate[];
max_presences?: number | null;
max_members?: number;
vanity_url_code: string | null;
description: string | null;
banner: string | null;
premium_tier: GuildPremiumTier;
premium_subscription_count?: number;
preferred_locale: string;
public_updates_channel_id: string | null;
max_video_channel_users?: number;
/**
* Returned by calling GET `/guilds/{guild.id}` with the query `with_counts` set to `true`
*/
approximate_member_count?: number;
/**
* Returned by calling GET `/guilds/{guild.id}` with the query `with_counts` set to `true`
*/
approximate_presence_count?: number;
welcome_screen?: APIGuildWelcomeScreen;
}
/**
* https://discord.com/developers/docs/resources/guild#guild-object-default-message-notification-level
*/
export const enum GuildDefaultMessageNotifications {
ALL_MESSAGES,
ONLY_MENTIONS,
}
/**
* https://discord.com/developers/docs/resources/guild#guild-object-explicit-content-filter-level
*/
export const enum GuildExplicitContentFilter {
DISABLED,
MEMBERS_WITHOUT_ROLES,
ALL_MEMBERS,
}
/**
* https://discord.com/developers/docs/resources/guild#guild-object-mfa-level
*/
export const enum GuildMFALevel {
NONE,
ELEVATED,
}
/**
* https://discord.com/developers/docs/resources/guild#guild-object-verification-level
*/
export const enum GuildVerificationLevel {
NONE,
LOW,
MEDIUM,
HIGH,
VERY_HIGH,
}
/**
* https://discord.com/developers/docs/resources/guild#guild-object-premium-tier
*/
export const enum GuildPremiumTier {
NONE,
TIER_1,
TIER_2,
TIER_3,
}
/**
* https://discord.com/developers/docs/resources/guild#guild-object-system-channel-flags
*/
export const enum GuildSystemChannelFlags {
SUPPRESS_JOIN_NOTIFICATIONS = 1 << 0,
SUPPRESS_PREMIUM_SUBSCRIPTIONS = 1 << 1,
}
/**
* https://discord.com/developers/docs/resources/guild#guild-object-guild-features
*/
export const enum GuildFeature {
ANIMATED_ICON = 'ANIMATED_ICON',
BANNER = 'BANNER',
COMMERCE = 'COMMERCE',
COMMUNITY = 'COMMUNITY',
DISCOVERABLE = 'DISCOVERABLE',
FEATURABLE = 'FEATURABLE',
INVITE_SPLASH = 'INVITE_SPLASH',
NEWS = 'NEWS',
PARTNERED = 'PARTNERED',
RELAY_ENABLED = 'RELAY_ENABLED',
VANITY_URL = 'VANITY_URL',
VERIFIED = 'VERIFIED',
VIP_REGIONS = 'VIP_REGIONS',
WELCOME_SCREEN_ENABLED = 'WELCOME_SCREEN_ENABLED',
}
/**
* https://discord.com/developers/docs/resources/guild#guild-preview-object
*/
export interface APIGuildPreview {
id: string;
name: string;
icon: string | null;
splash: string | null;
discovery_splash: string | null;
emojis: APIEmoji[];
features: GuildFeature[];
approximate_member_count: number;
approximate_presence_count: number;
}
/**
* https://discord.com/developers/docs/resources/guild#guild-widget-object
*/
export interface APIGuildWidgetSettings {
enabled: boolean;
channel_id: string | null;
}
/**
* https://discord.com/developers/docs/resources/guild#get-guild-widget-example-get-guild-widget
*/
export interface APIGuildWidget {
id: string;
name: string;
instant_invite: string | null;
channels: APIGuildWidgetChannel[];
members: APIGuildWidgetMember[];
presence_count: number;
}
/**
* https://discord.com/developers/docs/resources/guild#get-guild-widget-example-get-guild-widget
*/
export interface APIGuildWidgetChannel {
id: string;
name: string;
position: number;
}
/**
* https://discord.com/developers/docs/resources/guild#get-guild-widget-example-get-guild-widget
*/
export interface APIGuildWidgetMember {
id: string;
username: string;
discriminator: string;
avatar: string | null;
status: PresenceUpdateStatus;
activity?: { name: string };
avatar_url: string;
}
/**
* https://discord.com/developers/docs/resources/guild#guild-member-object
*/
export interface APIGuildMember {
user?: APIUser;
nick: string | null;
roles: string[];
joined_at: string;
premium_since?: string | null;
deaf: boolean;
mute: boolean;
pending?: boolean;
}
/**
* https://discord.com/developers/docs/resources/guild#integration-object
*/
export interface APIGuildIntegration {
id: string;
name: string;
type: string;
enabled: boolean;
syncing?: boolean;
role_id?: string;
enable_emoticons?: boolean;
expire_behavior?: IntegrationExpireBehavior;
expire_grace_period?: number;
user?: APIUser;
account: APIIntegrationAccount;
synced_at?: string;
subscriber_count?: number;
revoked?: boolean;
application?: APIGuildIntegrationApplication;
}
/**
* https://discord.com/developers/docs/resources/guild#integration-object-integration-expire-behaviors
*/
export const enum IntegrationExpireBehavior {
RemoveRole,
Kick,
}
/**
* https://discord.com/developers/docs/resources/guild#integration-account-object
*/
export interface APIIntegrationAccount {
id: string;
name: string;
}
/**
* https://discord.com/developers/docs/resources/guild#integration-application-object
*/
export interface APIGuildIntegrationApplication {
id: string;
name: string;
icon: string | null;
description: string;
summary: string;
bot?: APIUser;
}
/**
* https://discord.com/developers/docs/resources/guild#ban-object
*/
export interface APIBan {
reason: string | null;
user: APIUser;
}
/**
* https://discord.com/developers/docs/resources/guild#get-guild-widget-image-widget-style-options
*/
export const enum GuildWidgetStyle {
Banner1 = 'banner1',
Banner2 = 'banner2',
Banner3 = 'banner3',
Banner4 = 'banner4',
Shield = 'shield',
}
export interface APIGuildWelcomeScreen {
description: string | null;
welcome_channels: APIGuildWelcomeScreenChannel[];
}
export interface APIGuildWelcomeScreenChannel {
channel_id: string;
emoji_id: string | null;
emoji_name: string | null;
}

14
v8/payloads/index.ts Normal file
View File

@@ -0,0 +1,14 @@
export * from './auditLog';
export * from './channel';
export * from './emoji';
export * from './gateway';
export * from './guild';
export * from './interactions';
export * from './invite';
export * from './oauth2';
export * from './permissions';
export * from './teams';
export * from './template';
export * from './user';
export * from './voice';
export * from './webhook';

180
v8/payloads/interactions.ts Normal file
View File

@@ -0,0 +1,180 @@
import type { APIGuildMember, APIUser, MessageFlags } from './';
import type { RESTPostAPIWebhookWithTokenJSONBody } from '../rest';
/**
* https://discord.com/developers/docs/interactions/slash-commands#applicationcommand
*/
export interface APIApplicationCommand {
id: string;
application_id: string;
name: string;
description: string;
options?: APIApplicationCommandOption[];
}
interface APIApplicationCommandOptionBase {
type:
| ApplicationCommandOptionType.BOOLEAN
| ApplicationCommandOptionType.USER
| ApplicationCommandOptionType.CHANNEL
| ApplicationCommandOptionType.ROLE;
name: string;
description: string;
default?: boolean;
required?: boolean;
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#applicationcommandoption
*/
export type APIApplicationCommandOption =
| APIApplicationCommandArgumentOptions
| APIApplicationCommandSubCommandOptions
| APIApplicationCommandOptionBase;
/**
* This type is exported as a way to make it stricter for you when you're writing your commands.
*
* If the option is a `SUB_COMMAND` or `SUB_COMMAND_GROUP` type, this nested options will be the parameters
*/
export interface APIApplicationCommandSubCommandOptions extends Omit<APIApplicationCommandOptionBase, 'type'> {
type: ApplicationCommandOptionType.SUB_COMMAND | ApplicationCommandOptionType.SUB_COMMAND_GROUP;
options?: APIApplicationCommandOption[];
}
/**
* This type is exported as a way to make it stricter for you when you're writing your commands.
*
* In contrast to {@see APIApplicationCommandSubCommandOptions}, these types cannot have an `options` array,
* but they can have a `choices` one
*/
export interface APIApplicationCommandArgumentOptions extends Omit<APIApplicationCommandOptionBase, 'type'> {
type: ApplicationCommandOptionType.STRING | ApplicationCommandOptionType.INTEGER;
choices?: APIApplicationCommandOptionChoice[];
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#applicationcommandoptiontype
*/
export const enum ApplicationCommandOptionType {
SUB_COMMAND = 1,
SUB_COMMAND_GROUP,
STRING,
INTEGER,
BOOLEAN,
USER,
CHANNEL,
ROLE,
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#applicationcommandoptionchoice
*/
export interface APIApplicationCommandOptionChoice {
name: string;
value: string | number;
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction
*/
export interface APIInteraction {
id: string;
type: InteractionType;
data?: APIApplicationCommandInteractionData;
guild_id: string;
channel_id: string;
member: APIGuildMember & { user: APIUser };
token: string;
version: 1;
}
/**
* Like {@see APIInteraction}, only with the `data` property always present
*/
export type APIApplicationCommandInteraction = Required<APIInteraction>;
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-interactiontype
*/
export const enum InteractionType {
Ping = 1,
ApplicationCommand,
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-applicationcommandinteractiondata
*/
export interface APIApplicationCommandInteractionData {
id: string;
name: string;
options?: APIApplicationCommandInteractionDataOption[];
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-applicationcommandinteractiondataoption
*/
export interface APIApplicationCommandInteractionDataOption {
name: string;
/**
* The value returned here depends on the `ApplicationCommandOptionType` type of the option with the name
* that matches this interface's `name`.
*
* You will need to manually cast this to the appropriate type based on the returned data.
*/
value?: unknown;
options?: APIApplicationCommandInteractionDataOption[];
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-interaction-response
*/
export type APIInteractionResponse =
| APIInteractionResponsePong
| APIInteractionResponseAcknowledge
| APIInteractionResponseAcknowledgeWithSource
| APIInteractionResponseChannelMessage
| APIInteractionResponseChannelMessageWithSource;
export type APIInteractionResponsePong = InteractionResponsePayload<APIInteractionResponseType.Pong>;
export type APIInteractionResponseAcknowledge = InteractionResponsePayload<APIInteractionResponseType.Acknowledge>;
export type APIInteractionResponseAcknowledgeWithSource = InteractionResponsePayload<APIInteractionResponseType.AcknowledgeWithSource>;
export type APIInteractionResponseChannelMessage = InteractionResponsePayload<
APIInteractionResponseType.ChannelMessage,
true
>;
export type APIInteractionResponseChannelMessageWithSource = InteractionResponsePayload<
APIInteractionResponseType.ChannelMessageWithSource,
true
>;
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-interactionresponsetype
*/
export const enum APIInteractionResponseType {
Pong = 1,
Acknowledge,
ChannelMessage,
ChannelMessageWithSource,
AcknowledgeWithSource,
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-interactionapplicationcommandcallbackdata
*/
export type APIInteractionApplicationCommandCallbackData = Omit<
RESTPostAPIWebhookWithTokenJSONBody,
'username' | 'avatar_url'
> & { flags?: MessageFlags };
/**
* @internal
*/
interface InteractionResponsePayload<T extends APIInteractionResponseType, D = false> {
type: T;
data?: D extends true ? APIInteractionApplicationCommandCallbackData : never;
}

39
v8/payloads/invite.ts Normal file
View File

@@ -0,0 +1,39 @@
/**
* Types extracted from https://discord.com/developers/docs/resources/invite
*/
import type { APIPartialChannel } from './channel';
import type { APIPartialGuild } from './guild';
import type { APIUser } from './user';
/**
* https://discord.com/developers/docs/resources/invite#invite-object
*/
export interface APIInvite {
code: string;
guild?: APIPartialGuild;
channel?: Required<APIPartialChannel>;
inviter?: APIUser;
target_user?: APIUser;
target_user_type?: InviteTargetUserType;
approximate_presence_count?: number;
approximate_member_count?: number;
}
/**
* https://discord.com/developers/docs/resources/invite#invite-object-target-user-types
*/
export const enum InviteTargetUserType {
STREAM = 1,
}
/**
* https://discord.com/developers/docs/resources/invite#invite-metadata-object
*/
export interface APIExtendedInvite extends APIInvite {
uses: number;
max_uses: number;
max_age: number;
temporary: boolean;
created_at: string;
}

28
v8/payloads/oauth2.ts Normal file
View File

@@ -0,0 +1,28 @@
/**
* Types extracted from https://discord.com/developers/docs/topics/oauth2
*/
import type { APITeam } from './teams';
import type { APIUser } from './user';
/**
* https://discord.com/developers/docs/topics/oauth2#get-current-application-information-response-structure
*/
export interface APIApplication {
id: string;
name: string;
icon: string | null;
description: string;
rpc_origins?: string[];
bot_public: boolean;
bot_require_code_grant: boolean;
owner: APIUser;
summary: string;
verify_key: string;
team: APITeam | null;
guild_id?: string;
primary_sku_id?: string;
slug?: string;
cover_image?: string;
flags?: number;
}

View File

@@ -0,0 +1,72 @@
/**
* Types extracted from https://discord.com/developers/docs/topics/permissions
*/
/**
* https://discord.com/developers/docs/topics/permissions#permissions-bitwise-permission-flags
*
* These flags are exported as `BigInt`s and NOT numbers. For most of them, you can
* convert them in a number by wrapping it in `Number()`, however be careful as any
* further bits added may cause issues if done so. Try to use BigInts as much as possible
* or modules that can replicate them in some way.
*/
export const PermissionFlagsBits = {
CREATE_INSTANT_INVITE: 1n,
KICK_MEMBERS: 2n,
BAN_MEMBERS: 4n,
ADMINISTRATOR: 8n,
MANAGE_CHANNELS: 16n,
MANAGE_GUILD: 32n,
ADD_REACTIONS: 64n,
VIEW_AUDIT_LOG: 128n,
PRIORITY_SPEAKER: 256n,
STREAM: 512n,
VIEW_CHANNEL: 1024n,
SEND_MESSAGES: 2048n,
SEND_TTS_MESSAGES: 4096n,
MANAGE_MESSAGES: 8192n,
EMBED_LINKS: 16384n,
ATTACH_FILES: 32768n,
READ_MESSAGE_HISTORY: 65536n,
MENTION_EVERYONE: 131072n,
USE_EXTERNAL_EMOJIS: 262144n,
VIEW_GUILD_INSIGHTS: 524288n,
CONNECT: 1048576n,
SPEAK: 2097152n,
MUTE_MEMBERS: 4194304n,
DEAFEN_MEMBERS: 8388608n,
MOVE_MEMBERS: 16777216n,
USE_VAD: 33554432n,
CHANGE_NICKNAME: 67108864n,
MANAGE_NICKNAMES: 134217728n,
MANAGE_ROLES: 268435456n,
MANAGE_WEBHOOKS: 536870912n,
MANAGE_EMOJIS: 1073741824n,
} as const;
/**
* Freeze the object of bits, preventing any modifications to it.
* @internal
*/
Object.freeze(PermissionFlagsBits);
/**
* https://discord.com/developers/docs/topics/permissions#role-object
*/
export interface APIRole {
id: string;
name: string;
color: number;
hoist: boolean;
position: number;
permissions: string;
managed: boolean;
mentionable: boolean;
tags?: APIRoleTags;
}
export interface APIRoleTags {
bot_id?: string;
premium_subscriber?: null;
integration_id?: string;
}

33
v8/payloads/teams.ts Normal file
View File

@@ -0,0 +1,33 @@
/**
* Types extracted from https://discord.com/developers/docs/topics/teams
*/
import type { APIUser } from './user';
/**
* https://discord.com/developers/docs/topics/teams#data-models-team-object
*/
export interface APITeam {
id: string;
icon: string | null;
members: APITeamMember[];
owner_user_id: string;
}
/**
* https://discord.com/developers/docs/topics/teams#data-models-team-members-object
*/
export interface APITeamMember {
membership_state: TeamMemberMembershipState;
permissions: string[];
team_id: string;
user: APIUser;
}
/**
* https://discord.com/developers/docs/topics/teams#data-models-membership-state-enum
*/
export const enum TeamMemberMembershipState {
INVITED = 1,
ACCEPTED,
}

29
v8/payloads/template.ts Normal file
View File

@@ -0,0 +1,29 @@
/**
* Types extracted from https://discord.com/developers/docs/resources/template
*/
import type { APIUser } from './user';
import type { RESTPostAPIGuildsJSONBody } from '../rest';
/**
* https://discord.com/developers/docs/resources/template#template-object
*/
export interface APITemplate {
code: string;
name: string;
description: string | null;
usage_count: number;
creator_id: string;
creator: APIUser;
created_at: string;
updated_at: string;
source_guild_id: string;
serialized_source_guild: APITemplateSerializedSourceGuild;
is_dirty: boolean | null;
}
export interface APITemplateSerializedSourceGuild extends Omit<RESTPostAPIGuildsJSONBody, 'icon'> {
description: string | null;
preferred_locale: string;
icon_hash: string | null;
}

73
v8/payloads/user.ts Normal file
View File

@@ -0,0 +1,73 @@
/**
* Types extracted from https://discord.com/developers/docs/resources/user
*/
import type { APIGuildIntegration } from './guild';
/**
* https://discord.com/developers/docs/resources/user#user-object
*/
export interface APIUser {
id: string;
username: string;
discriminator: string;
avatar: string | null;
bot?: boolean;
system?: boolean;
mfa_enabled?: boolean;
locale?: string;
verified?: boolean;
email?: string | null;
flags?: UserFlags;
premium_type?: UserPremiumType;
public_flags?: UserFlags;
}
/**
* https://discord.com/developers/docs/resources/user#user-object-user-flags
*/
export const enum UserFlags {
None = 0,
DiscordEmployee = 1 << 0,
PartneredServerOwner = 1 << 1,
DiscordHypeSquadEvents = 1 << 2,
BugHunterLevel1 = 1 << 3,
HypeSquadHouseBravery = 1 << 6,
HypeSquadHouseBrilliance = 1 << 7,
HypeSquadHouseBalance = 1 << 8,
EarlySupporter = 1 << 9,
TeamUser = 1 << 10,
System = 1 << 12,
BugHunterLevel2 = 1 << 14,
VerifiedBot = 1 << 16,
EarlyVerifiedBotDeveloper = 1 << 17,
}
/**
* https://discord.com/developers/docs/resources/user#user-object-premium-types
*/
export const enum UserPremiumType {
None,
NitroClassic,
Nitro,
}
/**
* https://discord.com/developers/docs/resources/user#connection-object
*/
export interface APIConnection {
id: string;
name: string;
type: string;
revoked?: boolean;
integrations?: Partial<APIGuildIntegration>[];
verified: boolean;
friend_sync: boolean;
show_activity: boolean;
visibility: ConnectionVisibility;
}
export const enum ConnectionVisibility {
None,
Everyone,
}

35
v8/payloads/voice.ts Normal file
View File

@@ -0,0 +1,35 @@
/**
* Types extracted from https://discord.com/developers/docs/resources/voice
*/
import type { APIGuildMember } from './guild';
/**
* https://discord.com/developers/docs/resources/voice#voice-state-object
*/
export interface GatewayVoiceState {
guild_id?: string;
channel_id: string | null;
user_id: string;
member?: APIGuildMember;
session_id: string;
deaf: boolean;
mute: boolean;
self_deaf: boolean;
self_mute: boolean;
self_stream?: boolean;
self_video: boolean;
suppress: boolean;
}
/**
* https://discord.com/developers/docs/resources/voice#voice-region-object
*/
export interface APIVoiceRegion {
id: string;
name: string;
vip: boolean;
optimal: boolean;
deprecated: boolean;
custom: boolean;
}

29
v8/payloads/webhook.ts Normal file
View File

@@ -0,0 +1,29 @@
/**
* Types extracted from https://discord.com/developers/docs/resources/webhook
*/
import type { APIPartialChannel } from './channel';
import type { APIPartialGuild } from './guild';
import type { APIUser } from './user';
/**
* https://discord.com/developers/docs/resources/webhook#webhook-object
*/
export interface APIWebhook {
id: string;
type: WebhookType;
guild_id?: string;
channel_id: string;
user?: APIUser;
name: string | null;
avatar: string | null;
token?: string;
source_guild?: APIPartialGuild;
source_channel?: APIPartialChannel;
application_id: string | null;
}
export const enum WebhookType {
Incoming = 1,
ChannelFollower,
}

13
v8/rest/auditLog.ts Normal file
View File

@@ -0,0 +1,13 @@
import type { APIAuditLog, AuditLogEvent } from '../payloads/auditLog';
/**
* https://discord.com/developers/docs/resources/audit-log#get-guild-audit-log
*/
export interface RESTGetAPIAuditLogQuery {
user_id?: string;
action_type?: AuditLogEvent;
before?: string;
limit?: number;
}
export type RESTGetAPIAuditLogResult = APIAuditLog;

218
v8/rest/channel.ts Normal file
View File

@@ -0,0 +1,218 @@
import type {
APIChannel,
APIEmbed,
APIFollowedChannel,
APIInvite,
APIMessage,
APIMessageReference,
APIOverwrite,
APIUser,
ChannelType,
InviteTargetUserType,
MessageFlags,
OverwriteType,
} from '../payloads';
// #region TypeDefs
/**
* https://discord.com/developers/docs/resources/channel#allowed-mentions-object-allowed-mention-types
*/
export const enum AllowedMentionsTypes {
Everyone = 'everyone',
Role = 'roles',
User = 'users',
}
/**
* https://discord.com/developers/docs/resources/channel#allowed-mentions-object-allowed-mentions-structure
*/
export interface APIAllowedMentionsSend {
parse?: AllowedMentionsTypes[];
roles?: string[];
users?: string[];
replied_user?: boolean;
}
// #endregion TypeDefs
/**
* https://discord.com/developers/docs/resources/channel#modify-channel
*/
export interface RESTPatchAPIChannelJSONBody {
name?: string;
type?: ChannelType.GUILD_NEWS | ChannelType.GUILD_TEXT;
position?: number | null;
topic?: string | null;
nsfw?: boolean | null;
rate_limit_per_user?: number | null;
user_limit?: number | null;
permission_overwrites?: APIOverwrite[] | null;
parent_id?: string | null;
}
export type RESTGetAPIChannelResult = APIChannel;
export type RESTPatchAPIChannelResult = APIChannel;
export type RESTDeleteAPIChannelResult = APIChannel;
/**
* https://discord.com/developers/docs/resources/channel#get-channel-messages
*/
export interface RESTGetAPIChannelMessagesQuery {
around?: string;
before?: string;
after?: string;
limit?: number;
}
export type RESTGetAPIChannelMessagesResult = APIMessage[];
export type APIMessageReferenceSend = APIMessageReference & Required<Pick<APIMessageReference, 'message_id'>>;
/**
* https://discord.com/developers/docs/resources/channel#create-message
*/
export interface RESTPostAPIChannelMessageJSONBody {
content?: string;
nonce?: number | string;
tts?: boolean;
embed?: APIEmbed;
allowed_mentions?: APIAllowedMentionsSend;
message_reference?: APIMessageReferenceSend;
}
/**
* https://discord.com/developers/docs/resources/channel#create-message
*/
export type RESTPostAPIChannelMessageFormDataBody =
| {
/**
* JSON stringified message body
*/
payload_json?: string;
/**
* The file contents
*/
file: unknown;
}
| {
content?: string;
nonce?: number | string;
tts?: boolean;
embed?: APIEmbed;
allowed_mentions?: APIAllowedMentionsSend;
message_reference?: APIMessageReferenceSend;
/**
* The file contents
*/
file: unknown;
};
/**
* https://discord.com/developers/docs/resources/channel#edit-message
*/
export interface RESTPatchAPIChannelMessageJSONBody {
content?: string | null;
embed?: APIEmbed | null;
allowed_mentions?: APIAllowedMentionsSend | null;
flags?: MessageFlags | null;
}
export type RESTGetAPIChannelMessageResult = APIMessage;
export type RESTPostAPIChannelMessageResult = APIMessage;
export type RESTPatchAPIChannelMessageResult = APIMessage;
export type RESTDeleteAPIChannelMessageResult = never;
/**
* https://discord.com/developers/docs/resources/channel#get-reactions
*/
export interface RESTGetAPIChannelMessageReactionsQuery {
before?: string;
after?: string;
limit?: number;
}
export type RESTGetAPIChannelMessageReactionsResult = APIUser[];
export type RESTPutAPIChannelMessageReactionResult = never;
export type RESTDeleteAPIChannelMessageReactionResult = never;
export type RESTDeleteAPIChannelAllMessageReactionsResult = never;
/**
* https://discord.com/developers/docs/resources/channel#bulk-delete-messages
*/
export interface RESTPostAPIChannelMessagesBulkDeleteJSONBody {
messages: string[];
}
export type RESTPostAPIChannelMessagesBulkDeleteResult = never;
/**
* https://discord.com/developers/docs/resources/channel#edit-channel-permissions
*/
export interface RESTPutAPIChannelPermissionsJSONBody {
allow: string;
deny: string;
type: OverwriteType;
}
export type RESTPutAPIChannelPermissionsResult = never;
export type RESTDeleteAPIChannelPermissionsResult = never;
/**
* https://discord.com/developers/docs/resources/channel#get-channel-invites
*/
export type RESTGetAPIChannelInvitesResult = APIInvite[];
export interface RESTPostAPIChannelInviteJSONBody {
max_age?: number;
max_uses?: number;
temporary?: boolean;
unique?: boolean;
target_user_id?: string;
target_user_type?: InviteTargetUserType;
}
/**
* https://discord.com/developers/docs/resources/channel#trigger-typing-indicator
*/
export type RESTPostAPIChannelTypingResult = never;
/**
* https://discord.com/developers/docs/resources/channel#get-pinned-messages
*/
export type RESTGetAPIChannelPinsResult = APIMessage[];
/**
* https://discord.com/developers/docs/resources/channel#add-pinned-channel-message
*/
export type RESTPutAPIChannelPinResult = never;
export type RESTDeleteAPIChannelPinResult = never;
/**
* https://discord.com/developers/docs/resources/channel#group-dm-add-recipient
*/
export interface RESTPutAPIChannelRecipientJSONBody {
access_token: string;
nick?: string;
}
export type RESTPutAPIChannelRecipientResult = unknown;
export type RESTDeleteAPIChannelRecipientResult = unknown;
/**
* https://discord.com/developers/docs/resources/channel#crosspost-message
*/
export type RESTPostAPIChannelMessageCrosspostResult = APIMessage;
/**
* https://discord.com/developers/docs/resources/channel#follow-news-channel
*/
export interface RESTPostAPIChannelFollowersJSONBody {
webhook_channel_id: string;
}
/**
* https://discord.com/developers/docs/resources/channel#follow-news-channel
*/
export type RESTPostAPIChannelFollowersResult = APIFollowedChannel;

40
v8/rest/emoji.ts Normal file
View File

@@ -0,0 +1,40 @@
import type { APIEmoji } from '../payloads';
/**
* https://discord.com/developers/docs/resources/emoji#list-guild-emojis
*/
export type RESTGetAPIGuildEmojisResult = APIEmoji[];
/**
* https://discord.com/developers/docs/resources/emoji#get-guild-emoji
*/
export type RESTGetAPIGuildEmojiResult = APIEmoji;
/**
* https://discord.com/developers/docs/resources/emoji#create-guild-emoji-json-params
*/
export interface RESTPostAPIGuildEmojiJSONBody {
name: string;
/**
* The image data, read more [here](https://discord.com/developers/docs/reference#image-data)
*/
image: string;
roles?: string[];
}
export type RESTPostAPIGuildEmojiResult = APIEmoji;
/**
* https://discord.com/developers/docs/resources/emoji#modify-guild-emoji
*/
export interface RESTPatchAPIGuildEmojiJSONBody {
name?: string;
roles?: string[] | null;
}
export type RESTPatchAPIGuildEmojiResult = APIEmoji;
/**
* https://discord.com/developers/docs/resources/emoji#delete-guild-emoji
*/
export type RESTDeleteAPIGuildEmojiResult = never;

11
v8/rest/gateway.ts Normal file
View File

@@ -0,0 +1,11 @@
import type { APIGatewayBotInfo, APIGatewayInfo } from '../payloads';
/**
* https://discord.com/developers/docs/topics/gateway#get-gateway
*/
export type RESTGetAPIGatewayResult = APIGatewayInfo;
/**
* https://discord.com/developers/docs/topics/gateway#get-gateway-bot
*/
export type RESTGetAPIGatewayBotResult = APIGatewayBotInfo;

383
v8/rest/guild.ts Normal file
View File

@@ -0,0 +1,383 @@
import type {
APIBan,
APIChannel,
APIGuild,
APIGuildIntegration,
APIGuildMember,
APIGuildPreview,
APIGuildWidget,
APIGuildWidgetSettings,
APIInvite,
APIRole,
APIVoiceRegion,
GuildDefaultMessageNotifications,
GuildExplicitContentFilter,
GuildFeature,
GuildSystemChannelFlags,
GuildVerificationLevel,
GuildWidgetStyle,
IntegrationExpireBehavior,
} from '../payloads';
import type { RESTPutAPIChannelPermissionsJSONBody } from './channel';
export interface APIGuildCreateOverwrite extends RESTPutAPIChannelPermissionsJSONBody {
id: number | string;
}
export type APIGuildCreatePartialChannel = Partial<
Pick<APIChannel, 'type' | 'topic' | 'nsfw' | 'bitrate' | 'user_limit' | 'rate_limit_per_user'>
> & {
name: string;
id?: number | string;
parent_id?: number | string;
permission_overwrites?: APIGuildCreateOverwrite[];
};
export interface APIGuildCreateRole extends RESTPostAPIGuildRoleJSONBody {
id: number | string;
}
/**
* https://discord.com/developers/docs/resources/guild#create-guild
*/
export interface RESTPostAPIGuildsJSONBody {
name: string;
region?: string;
icon?: string;
verification_level?: GuildVerificationLevel;
default_message_notifications?: GuildDefaultMessageNotifications;
explicit_content_filter?: GuildExplicitContentFilter;
roles?: APIGuildCreateRole[];
channels?: APIGuildCreatePartialChannel[];
afk_channel_id?: number | string;
afk_timeout?: number;
system_channel_id?: number | string;
system_channel_flags?: GuildSystemChannelFlags;
}
export type RESTPostAPIGuildsResult = APIGuild;
/**
* https://discord.com/developers/docs/resources/guild#get-guild
*/
export interface RESTGetAPIGuildQuery {
with_counts?: boolean;
}
export type RESTGetAPIGuildResult = APIGuild;
/**
* https://discord.com/developers/docs/resources/guild#get-guild-preview
*/
export type RESTGetAPIGuildPreviewResult = APIGuildPreview;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild
*/
export interface RESTPatchAPIGuildJSONBody {
name?: string;
region?: string | null;
verification_level?: GuildVerificationLevel | null;
default_message_notifications?: GuildDefaultMessageNotifications | null;
explicit_content_filter?: GuildExplicitContentFilter | null;
afk_channel_id?: string | null;
afk_timeout?: number;
icon?: string | null;
owner_id?: string;
splash?: string | null;
discovery_splash?: string | null;
banner?: string | null;
system_channel_id?: string | null;
system_channel_flags?: GuildSystemChannelFlags;
rules_channel_id?: string | null;
public_updates_channel_id?: string | null;
preferred_locale?: string | null;
features?: GuildFeature[];
description?: string | null;
}
export type RESTPatchAPIGuildResult = APIGuild;
/**
* https://discord.com/developers/docs/resources/guild#delete-guild
*/
export type RESTDeleteAPIGuildResult = never;
/**
* https://discord.com/developers/docs/resources/guild#get-guild-channels
*/
export type RESTGetAPIGuildChannelsResult = APIChannel[];
/**
* https://discord.com/developers/docs/resources/guild#create-guild-channel
*/
export type RESTPostAPIGuildChannelJSONBody = APIGuildCreatePartialChannel;
export type RESTPostAPIGuildChannelResult = APIChannel;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-channel-positions
*/
export type RESTPatchAPIGuildChannelPositionsJSONBody = Array<{
id: string;
position: number;
lock_permissions?: boolean;
parent_id?: string | null;
}>;
export type RESTPatchAPIGuildChannelPositionsResult = never;
/**
* https://discord.com/developers/docs/resources/guild#get-guild-member
*/
export type RESTGetAPIGuildMemberResult = APIGuildMember;
/**
* https://discord.com/developers/docs/resources/guild#list-guild-members
*/
export interface RESTGetAPIGuildMembersQuery {
limit?: number;
after?: string;
}
export type RESTGetAPIGuildMembersResult = APIGuildMember[];
export interface RESTGetAPIGuildMembersSearchQuery {
query: string;
limit?: number;
}
export type RESTGetAPIGuildMembersSearchResult = APIGuildMember[];
/**
* https://discord.com/developers/docs/resources/guild#add-guild-member
*/
export interface RESTPutAPIGuildMemberJSONBody {
access_token: string;
nick?: string;
roles?: string[];
mute?: boolean;
deaf?: boolean;
}
export type RESTPutAPIGuildMemberResult = APIGuildMember | undefined;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-member
*/
export interface RESTPatchAPIGuildMemberJSONBody {
nick?: string | null;
roles?: string[] | null;
mute?: boolean | null;
deaf?: boolean | null;
channel_id?: string | null;
}
export type RESTPatchAPIGuildMemberResult = APIGuildMember;
/**
* https://discord.com/developers/docs/resources/guild#modify-current-user-nick
*/
export interface RESTPatchAPICurrentGuildMemberNicknameJSONBody {
nick?: string | null;
}
export type RESTPatchAPICurrentGuildMemberNicknameResult = Required<RESTPatchAPICurrentGuildMemberNicknameJSONBody>;
/**
* https://discord.com/developers/docs/resources/guild#add-guild-member-role
*/
export type RESTPutAPIGuildMemberRoleResult = never;
/**
* https://discord.com/developers/docs/resources/guild#remove-guild-member-role
*/
export type RESTDeleteAPIGuildMemberRoleResult = never;
/**
* https://discord.com/developers/docs/resources/guild#remove-guild-member
*/
export type RESTDeleteAPIGuildMemberResult = never;
/**
* https://discord.com/developers/docs/resources/guild#get-guild-bans
*/
export type RESTGetAPIGuildBansResult = APIBan[];
/**
* https://discord.com/developers/docs/resources/guild#get-guild-ban
*/
export type RESTGetAPIGuildBanResult = APIBan;
/**
* https://discord.com/developers/docs/resources/guild#create-guild-ban
*/
export interface RESTPutAPIGuildBanJSONBody {
delete_message_days?: number;
reason?: string;
}
export type RESTPutAPIGuildBanResult = never;
/**
* https://discord.com/developers/docs/resources/guild#remove-guild-ban
*/
export type RESTDeleteAPIGuildBanResult = never;
/**
* https://discord.com/developers/docs/resources/guild#get-guild-roles
*/
export type RESTGetAPIGuildRolesResult = APIRole[];
/**
* https://discord.com/developers/docs/resources/guild#create-guild-role
*/
export interface RESTPostAPIGuildRoleJSONBody {
name?: string | null;
permissions?: string | null;
color?: number | null;
hoist?: boolean | null;
mentionable?: boolean | null;
}
export type RESTPostAPIGuildRoleResult = APIRole;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-role-positions
*/
export type RESTPatchAPIGuildRolePositionsJSONBody = Array<{
id: string;
position?: number;
}>;
export type RESTPatchAPIGuildRolePositionsResult = APIRole[];
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-role
*/
export interface RESTPatchAPIGuildRoleJSONBody {
name?: string;
permissions?: string;
color?: number;
hoist?: boolean;
mentionable?: boolean;
}
export type RESTPatchAPIGuildRoleResult = APIRole;
/**
* https://discord.com/developers/docs/resources/guild#delete-guild-role
*/
export type RESTDeleteAPIGuildRoleResult = never;
/**
* https://discord.com/developers/docs/resources/guild#get-guild-prune-count
*/
export interface RESTGetAPIGuildPruneCountQuery {
days?: number;
/**
* While this is typed as a string, it represents an array of
* role IDs delimited by commas.
*
* @see https://discord.com/developers/docs/resources/guild#get-guild-prune-count-query-string-params
*/
include_roles?: string;
}
export interface RESTGetAPIGuildPruneCountResult {
pruned: number;
}
/**
* https://discord.com/developers/docs/resources/guild#begin-guild-prune
*/
export interface RESTPostAPIGuildPruneJSONBody {
days?: number;
compute_prune_count?: boolean;
include_roles?: string[];
}
export interface RESTPostAPIGuildPruneResult {
pruned: number | null;
}
/**
* https://discord.com/developers/docs/resources/guild#get-guild-voice-regions
*/
export type RESTGetAPIGuildVoiceRegionsResult = APIVoiceRegion[];
/**
* https://discord.com/developers/docs/resources/guild#get-guild-invites
*/
export type RESTGetAPIGuildInvitesResult = APIInvite[];
export type RESTGetAPIGuildIntegrationsResult = APIGuildIntegration[];
/**
* https://discord.com/developers/docs/resources/guild#create-guild-integration
*/
export interface RESTPostAPIGuildIntegrationJSONBody {
type: string;
id: string;
}
export type RESTPostAPIGuildIntegrationResult = never;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-integration
*/
export interface RESTPatchAPIGuildIntegrationJSONBody {
expire_behavior?: IntegrationExpireBehavior | null;
expire_grace_period?: number | null;
enable_emoticons?: boolean | null;
}
export type RESTPatchAPIGuildIntegrationResult = never;
/**
* https://discord.com/developers/docs/resources/guild#delete-guild-integration
*/
export type RESTDeleteAPIGuildIntegrationResult = never;
/**
* https://discord.com/developers/docs/resources/guild#sync-guild-integration
*/
export type RESTPostAPIGuildIntegrationSyncResult = never;
/**
* https://discord.com/developers/docs/resources/guild#get-guild-widget-settings
*/
export type RESTGetAPIGuildWidgetSettingsResult = APIGuildWidgetSettings;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-widget
*/
export type RESTPatchAPIGuildWidgetSettingsJSONBody = Partial<APIGuildWidgetSettings>;
export type RESTPatchAPIGuildWidgetSettingsResult = APIGuildWidgetSettings;
/**
* https://discord.com/developers/docs/resources/guild#get-guild-widget
*/
export type RESTGetAPIGuildWidgetResult = APIGuildWidget;
/**
* https://discord.com/developers/docs/resources/guild#get-guild-vanity-url
*/
export interface RESTGetAPIGuildVanityUrlResult {
code: string | null;
uses: number;
}
/**
* https://discord.com/developers/docs/resources/guild#get-guild-widget-image
*/
export interface RESTGetAPIGuildWidgetImageQuery {
style?: GuildWidgetStyle;
}
/**
* Note: while the return type is `ArrayBuffer`, the expected result is
* a buffer of sorts (depends if in browser or on node.js/deno).
*/
export type RESTGetAPIGuildWidgetImageResult = ArrayBuffer;

606
v8/rest/index.ts Normal file
View File

@@ -0,0 +1,606 @@
export * from './auditLog';
export * from './channel';
export * from './emoji';
export * from './gateway';
export * from './guild';
export * from './interactions';
export * from './invite';
export * from './oauth2';
export * from './template';
export * from './user';
export * from './voice';
export * from './webhook';
export const APIVersion = '8';
export const Routes = {
/**
* Route for:
* - GET `/guilds/{guild.id}/audit-logs`
*/
guildAuditLog(guildID: string) {
return `/guilds/${guildID}/audit-logs`;
},
/**
* Route for:
* - GET `/channels/{channel.id}`
* - PATCH `/channels/{channel.id}`
* - DELETE `/channels/{channel.id}`
*/
channel(channelID: string) {
return `/channels/${channelID}`;
},
/**
* Route for:
* - GET `/channels/{channel.id}/messages`
* - POST `/channels/{channel.id}/messages`
*/
channelMessages(channelID: string) {
return `/channels/${channelID}/messages`;
},
/**
* Route for:
* - GET `/channels/{channel.id}/messages/{message.id}`
* - PATCH `/channels/{channel.id}/messages/{message.id}`
* - DELETE `/channels/{channel.id}/messages/{message.id}`
*/
channelMessage(channelID: string, messageID: string) {
return `/channels/${channelID}/messages/${messageID}`;
},
/**
* Route for:
* - POST `/channels/{channel.id}/messages/{message.id}/crosspost`
*/
channelMessageCrosspost(channelID: string, messageID: string) {
return `/channels/${channelID}/messages/${messageID}/crosspost`;
},
/**
* Route for:
* - PUT `/channels/{channel.id}/messages/{message.id}/reactions/{emoji}/@me`
* - DELETE `/channels/{channel.id}/messages/{message.id}/reactions/{emoji}/@me`
*
* **Note**: You need to URL encode the emoji yourself.
*/
channelMessageOwnReaction(channelID: string, messageID: string, emoji: string) {
return `/channels/${channelID}/messages/${messageID}/reactions/${emoji}/@me`;
},
/**
* Route for:
* - DELETE `/channels/{channel.id}/messages/{message.id}/reactions/{emoji}/{user.id}`
*
* **Note**: You need to URL encode the emoji yourself.
*/
channelMessageUserReaction(channelID: string, messageID: string, emoji: string, userID: string) {
return `/channels/${channelID}/messages/${messageID}/reactions/${emoji}/${userID}`;
},
/**
* Route for:
* - GET `/channels/{channel.id}/messages/{message.id}/reactions/{emoji}`
* - DELETE `/channels/{channel.id}/messages/{message.id}/reactions/{emoji}`
*
* **Note**: You need to URL encode the emoji yourself.
*/
channelMessageReaction(channelID: string, messageID: string, emoji: string) {
return `/channels/${channelID}/messages/${messageID}/reactions/${emoji}`;
},
/**
* Route for:
* - DELETE `/channels/{channel.id}/messages/{message.id}/reactions`
*/
channelMessageAllReactions(channelID: string, messageID: string) {
return `/channels/${channelID}/messages/${messageID}/reactions`;
},
/**
* Route for:
* - POST `/channels/{channel.id}/messages/bulk-delete`
*/
channelBulkDelete(channelID: string) {
return `/channels/${channelID}/messages/bulk-delete`;
},
/**
* Route for:
* - PUT `/channels/{channel.id}/permissions/{overwrite.id}`
* - DELETE `/channels/{channel.id}/permissions/{overwrite.id}`
*/
channelPermission(channelID: string, overwriteID: string) {
return `/channels/${channelID}/permissions/${overwriteID}`;
},
/**
* Route for:
* - GET `/channels/{channel.id}/invites`
* - POST `/channels/{channel.id}/invites`
*/
channelInvites(channelID: string) {
return `/channels/${channelID}/invites`;
},
/**
* Route for:
* - POST `/channels/{channel.id}/followers`
*/
channelFollowers(channelID: string) {
return `/channels/${channelID}/followers`;
},
/**
* Route for:
* - POST `/channels/{channel.id}/typing`
*/
channelTyping(channelID: string) {
return `/channels/${channelID}/typing`;
},
/**
* Route for:
* - GET `/channels/{channel.id}/pins`
*/
channelPins(channelID: string) {
return `/channels/${channelID}/pins`;
},
/**
* Route for:
* - PUT `/channels/{channel.id}/pins/{message.id}`
* - DELETE `/channels/{channel.id}/pins/{message.id}`
*/
channelPin(channelID: string, messageID: string) {
return `/channels/${channelID}/pins/${messageID}`;
},
/**
* Route for:
* - PUT `/channels/{channel.id}/recipients/{user.id}`
* - DELETE `/channels/{channel.id}/recipients/{user.id}`
*/
channelRecipient(channelID: string, userID: string) {
return `/channels/${channelID}/recipients/${userID}`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/emojis`
* - POST `/guilds/{guild.id}/emojis`
*/
guildEmojis(guildID: string) {
return `/guilds/${guildID}/emojis`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/emojis/{emoji.id}`
* - PATCH `/guilds/{guild.id}/emojis/{emoji.id}`
* - DELETE `/guilds/{guild.id}/emojis/{emoji.id}`
*/
guildEmoji(guildID: string, emojiID: string) {
return `/guilds/${guildID}/emojis/${emojiID}`;
},
/**
* Route for:
* - POST `/guilds`
*/
guilds() {
return '/guilds';
},
/**
* Route for:
* - GET `/guilds/{guild.id}`
* - PATCH `/guilds/{guild.id}`
* - DELETE `/guilds/{guild.id}`
*/
guild(guildID: string) {
return `/guilds/${guildID}`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/preview`
*/
guildPreview(guildID: string) {
return `/guilds/${guildID}/preview`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/channels`
* - POST `/guilds/{guild.id}/channels`
* - PATCH `/guilds/{guild.id}/channels`
*/
guildChannels(guildID: string) {
return `/guilds/${guildID}/channels`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/members/{user.id}`
* - PUT `/guilds/{guild.id}/members/{user.id}`
* - PATCH `/guilds/{guild.id}/members/{user.id}`
* - DELETE `/guilds/{guild.id}/members/{user.id}`
*/
guildMember(guildID: string, userID: string) {
return `/guilds/${guildID}/members/${userID}`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/members`
*/
guildMembers(guildID: string) {
return `/guilds/${guildID}/members`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/members/search`
*/
guildMembersSearch(guildID: string) {
return `/guilds/${guildID}/members/search`;
},
/**
* Route for:
* - PATCH `/guilds/{guild.id}/members/@me/nick`
*/
guildCurrentMemberNickname(guildID: string) {
return `/guilds/${guildID}/members/@me/nick`;
},
/**
* Route for:
* - 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) {
return `/guilds/${guildID}/members/${memberID}/roles/${roleID}`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/bans`
*/
guildBans(guildID: string) {
return `/guilds/${guildID}/bans`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/bans/{user.id}`
* - PUT `/guilds/{guild.id}/bans/{user.id}`
* - DELETE `/guilds/{guild.id}/bans/{user.id}`
*/
guildBan(guildID: string, userID: string) {
return `/guilds/${guildID}/bans/${userID}`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/roles`
* - POST `/guilds/{guild.id}/roles`
* - PATCH `/guilds/{guild.id}/roles`
*/
guildRoles(guildID: string) {
return `/guilds/${guildID}/roles`;
},
/**
* Route for:
* - PATCH `/guilds/{guild.id}/roles/{role.id}`
* - DELETE `/guilds/{guild.id}/roles/{role.id}`
*/
guildRole(guildID: string, roleID: string) {
return `/guilds/${guildID}/roles/${roleID}`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/prune`
* - POST `/guilds/{guild.id}/prune`
*/
guildPrune(guildID: string) {
return `/guilds/${guildID}/prune`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/regions`
*/
guildVoiceRegions(guildID: string) {
return `/guilds/${guildID}/regions`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/invites`
*/
guildInvites(guildID: string) {
return `/guilds/${guildID}/invites`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/integrations`
* - POST `/guilds/{guild.id}/integrations`
*/
guildIntegrations(guildID: string) {
return `/guilds/${guildID}/integrations`;
},
/**
* Route for:
* - PATCH `/guilds/{guild.id}/integrations/{integration.id}`
* - DELETE `/guilds/{guild.id}/integrations/{integration.id}`
*/
guildIntegration(guildID: string, integrationID: string) {
return `/guilds/${guildID}/integrations/${integrationID}`;
},
/**
* Route for:
* - POST `/guilds/{guild.id}/integrations/{integration.id}/sync`
*/
guildIntegrationSync(guildID: string, integrationID: string) {
return `/guilds/${guildID}/integrations/${integrationID}/sync`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/widget`
* - PATCH `/guilds/{guild.id}/widget`
*/
guildWidgetSettings(guildID: string) {
return `/guilds/${guildID}/widget`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/widget.json`
*/
guildWidgetJSON(guildID: string) {
return `/guilds/${guildID}/widget.json`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/vanity-url`
*/
guildVanityUrl(guildID: string) {
return `/guilds/${guildID}/vanity-url`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/widget.png`
*/
guildWidgetImage(guildID: string) {
return `/guilds/${guildID}/widget.png`;
},
/**
* Route for:
* - GET `/invites/{invite.code}`
* - DELETE `/invites/{invite.code}`
*/
invite(code: string) {
return `/invites/${code}`;
},
/**
* Route for:
* - GET `/guilds/templates/{template.code}`
* - POST `/guilds/templates/{template.code}`
*/
template(code: string) {
return `/guilds/templates/${code}`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/templates`
* - POST `/guilds/{guild.id}/templates`
*/
guildTemplates(guildID: string) {
return `/guilds/${guildID}/templates`;
},
/**
* Route for:
* - PUT `/guilds/{guild.id}/templates/{template.code}`
* - PATCH `/guilds/{guild.id}/templates/{template.code}`
* - DELETE `/guilds/{guild.id}/templates/{template.code}`
*/
guildTemplate(guildID: string, code: string) {
return `/guilds/${guildID}/templates/${code}`;
},
/**
* Route for:
* - GET `/users/@me`
* - GET `/users/{user.id}`
* - PATCH `/users/@me`
*
* @param [userID='@me'] The user ID, defaulted to `@me`
*/
user(userID = '@me') {
return `/users/${userID}`;
},
/**
* Route for:
* - GET `/users/@me/guilds`
*/
userGuilds() {
return `/users/@me/guilds`;
},
/**
* Route for:
* - DELETE `/users/@me/guilds/{guild.id}`
*/
userGuild(guildID: string) {
return `/users/@me/guilds/${guildID}`;
},
/**
* Route for:
* - POST `/users/@me/channels`
*/
userChannels() {
return `/users/@me/channels`;
},
/**
* Route for:
* - GET `/users/@me/connections`
*/
userConnections() {
return `/users/@me/connections`;
},
/**
* Route for:
* - GET `/voice/regions`
*/
voiceRegions() {
return `/voice/regions`;
},
/**
* Route for:
* - GET `/channels/{channel.id}/webhooks`
* - POST `/channels/{channel.id}/webhooks`
*/
channelWebhooks(channelID: string) {
return `/channels/${channelID}/webhooks`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/webhooks`
*/
guildWebhooks(guildID: string) {
return `/guilds/${guildID}/webhooks`;
},
/**
* Route for:
* - GET `/webhooks/{webhook.id}`
* - GET `/webhooks/{webhook.id}/{webhook.token}`
* - PATCH `/webhooks/{webhook.id}`
* - PATCH `/webhooks/{webhook.id}/{webhook.token}`
* - DELETE `/webhooks/{webhook.id}`
* - DELETE `/webhooks/{webhook.id}/{webhook.token}`
* - POST `/webhooks/{webhook.id}/{webhook.token}`
*
* - POST `/webhooks/{application.id}/{interaction.token}`
*/
webhook(webhookID: string, webhookToken?: string) {
const parts = ['', 'webhooks', webhookID];
if (webhookToken) parts.push(webhookToken);
return parts.join('/');
},
/**
* Route for:
* - PATCH `/webhooks/{webhook.id}/{webhook.token}/messages/@original`
* - PATCH `/webhooks/{webhook.id}/{webhook.token}/messages/{message.id}`
* - DELETE `/webhooks/{webhook.id}/{webhook.token}/messages/@original`
* - DELETE `/webhooks/{webhook.id}/{webhook.token}/messages/{message.id}`
*
* - PATCH `/webhooks/{application.id}/{interaction.token}/messages/@original`
* - PATCH `/webhooks/{application.id}/{interaction.token}/messages/{message.id}`
* - DELETE `/webhooks/{application.id}/{interaction.token}/messages/{message.id}`
*
* @param [messageID='@original'] The message ID to change, defaulted to `@original`
*/
webhookMessage(webhookID: string, webhookToken: string, messageID = '@original') {
return `/webhooks/${webhookID}/${webhookToken}/messages/${messageID}`;
},
/**
* Route for:
* - POST `/webhooks/{webhook.id}/{webhook.token}/github`
* - POST `/webhooks/{webhook.id}/{webhook.token}/slack`
*/
webhookPlatform(webhookID: string, webhookToken: string, platform: 'github' | 'slack') {
return `/webhooks/${webhookID}/${webhookToken}/${platform}`;
},
/**
* Route for:
* - GET `/gateway`
*/
gateway() {
return `/gateway`;
},
/**
* Route for:
* - GET `/gateway/bot`
*/
gatewayBot() {
return `/gateway/bot`;
},
/**
* Route for:
* - GET `/oauth2/applications/@me`
*/
oauth2CurrentApplication() {
return `/oauth2/applications/@me`;
},
/**
* Route for:
* - GET `/applications/{application.id}/commands`
* - POST `/applications/{application.id}/commands`
*/
applicationCommands(applicationID: string) {
return `/applications/${applicationID}/commands`;
},
/**
* - PATCH `/applications/{application.id}/commands/{command.id}`
* - DELETE `/applications/{application.id}/commands/{command.id}`
*/
applicationCommand(applicationID: string, commandID: string) {
return `/applications/${applicationID}/commands/${commandID}`;
},
/**
* Route for:
* - GET `/applications/{application.id}/guilds/{guild.id}/commands`
* - POST `/applications/{application.id}/guilds/{guild.id}/commands`
*/
applicationGuildCommands(applicationID: string, guildID: string) {
return `/applications/${applicationID}/guilds/${guildID}/commands`;
},
/**
* - 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) {
return `/applications/${applicationID}/guilds/${guildID}/commands/${commandID}`;
},
/**
* Route for:
* - POST `/interactions/{interaction.id}/{interaction.token}/callback`
*/
interactionCallback(interactionID: string, interactionToken: string) {
return `/interactions/${interactionID}/${interactionToken}/callback`;
},
};

77
v8/rest/interactions.ts Normal file
View File

@@ -0,0 +1,77 @@
import type { APIApplicationCommand, APIInteractionResponse } from '../payloads';
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-global-application-commands
*/
export type RESTGetAPIApplicationCommandsResult = APIApplicationCommand[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-global-application-command
*/
export type RESTPostAPIApplicationCommandsJSONBody = Omit<APIApplicationCommand, 'id' | 'application_id'>;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-global-application-command
*/
export type RESTPostAPIApplicationCommandsResult = APIApplicationCommand;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-global-application-command
*/
export type RESTPatchAPIApplicationCommandJSONBody = Partial<RESTPostAPIApplicationCommandsJSONBody>;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-global-application-command
*/
export type RESTPatchAPIApplicationCommandResult = APIApplicationCommand;
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-guild-application-commands
*/
export type RESTGetAPIApplicationGuildCommandsResult = APIApplicationCommand[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-guild-application-command
*/
export type RESTPostAPIApplicationGuildCommandsJSONBody = RESTPostAPIApplicationCommandsJSONBody;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-guild-application-command
*/
export type RESTPostAPIApplicationGuildCommandsResult = APIApplicationCommand;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-guild-application-command
*/
export type RESTPatchAPIApplicationGuildCommandJSONBody = Partial<RESTPostAPIApplicationCommandsJSONBody>;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-guild-application-command
*/
export type RESTPatchAPIApplicationGuildCommandResult = APIApplicationCommand;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-interaction-response
*/
export type RESTPostAPIInteractionCallbackJSONBody = APIInteractionResponse;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-interaction-response
*/
export type RESTPostAPIInteractionCallbackFormDataBody =
| {
/**
* JSON stringified message body
*/
payload_json?: string;
/**
* The file contents
*/
file: unknown;
}
| (RESTPostAPIInteractionCallbackJSONBody & {
/**
* The file contents
*/
file: unknown;
});

15
v8/rest/invite.ts Normal file
View File

@@ -0,0 +1,15 @@
import type { APIInvite } from '../payloads';
/**
* https://discord.com/developers/docs/resources/invite#get-invite
*/
export interface RESTGetAPIInviteQuery {
with_counts?: boolean;
}
export type RESTGetAPIInviteResult = APIInvite;
/**
* https://discord.com/developers/docs/resources/invite#delete-invite
*/
export type RESTDeleteAPIInviteResult = APIInvite;

159
v8/rest/oauth2.ts Normal file
View File

@@ -0,0 +1,159 @@
import type { APIApplication, APIGuild, APIWebhook } from '../payloads';
/**
* https://discord.com/developers/docs/topics/oauth2#get-current-application-information
*/
export type RESTGetAPIOauth2CurrentApplicationResult = APIApplication;
/**
* https://discord.com/developers/docs/topics/oauth2#authorization-code-grant
*/
export interface RESTOAuth2AuthorizationQuery {
response_type: 'code';
client_id: string;
scope: string;
redirect_uri?: string;
state?: string;
prompt?: 'consent' | 'none';
}
/**
* https://discord.com/developers/docs/topics/oauth2#authorization-code-grant-redirect-url-example
*/
export interface RESTOAuth2AuthorizationQueryResult {
code: string;
state?: string;
}
/**
* https://discord.com/developers/docs/topics/oauth2#authorization-code-grant-redirect-url-example
*/
export interface RESTPostOAuth2AccessTokenURIEncodedData {
client_id: string;
client_secret: string;
grant_type: 'authorization_code';
code: string;
redirect_uri?: string;
scope: string;
}
/**
* https://discord.com/developers/docs/topics/oauth2#authorization-code-grant-access-token-response
*/
export interface RESTPostOAuth2AccessTokenResult {
access_token: string;
token_type: string;
expires_in: number;
refresh_token: string;
scope: string;
}
/**
* https://discord.com/developers/docs/topics/oauth2#authorization-code-grant-refresh-token-exchange-example
*/
export interface RESTPostOAuth2RefreshTokenURIEncodedData {
client_id: string;
client_secret: string;
grant_type: 'refresh_token';
refresh_token: string;
redirect_uri?: string;
scope: string;
}
export type RESTPostOAuth2RefreshTokenResult = RESTPostOAuth2AccessTokenResult;
/**
* https://discord.com/developers/docs/topics/oauth2#implicit-grant
*/
export interface RESTOAuth2ImplicitAuthorizationQuery {
response_type: 'token';
client_id: string;
scope: string;
redirect_uri?: string;
state?: string;
prompt?: 'consent' | 'none';
}
/**
* https://discord.com/developers/docs/topics/oauth2#implicit-grant-redirect-url-example
*/
export type RESTOAuth2ImplicitAuthorizationURIFragmentResult = Omit<RESTPostOAuth2AccessTokenResult, 'refresh_token'>;
/**
* https://discord.com/developers/docs/topics/oauth2#client-credentials-grant
*/
export interface RESTPostOAuth2ClientCredentialsURIEncodedData {
client_id: string;
client_secret: string;
grant_type: 'client_credentials';
scope: string;
}
export type RESTPostOAuth2ClientCredentialsResult = RESTOAuth2ImplicitAuthorizationURIFragmentResult;
/**
* https://discord.com/developers/docs/topics/oauth2#bot-authorization-flow-bot-auth-parameters
*/
export interface RESTOAuth2BotAuthorizationQuery {
client_id: string;
scope: string;
/**
* The required permissions bitfield, stringified
*/
permissions?: string;
guild_id?: string;
disable_guild_select?: boolean;
}
/**
* https://discord.com/developers/docs/topics/oauth2#advanced-bot-authorization
*/
export interface RESTOAuth2AdvancedBotAuthorizationQuery {
client_id: string;
/**
* This assumes you include the `bot` scope alongside others (like `identify` for example)
*/
scope: string;
/**
* The required permissions bitfield, stringified
*/
permissions?: string;
guild_id?: string;
disable_guild_select?: boolean;
response_type: string;
redirect_uri?: string;
}
export interface RESTOAuth2AdvancedBotAuthorizationQueryResult {
code: string;
state?: string;
guild_id: string;
permissions: string;
}
/**
* https://discord.com/developers/docs/topics/oauth2#advanced-bot-authorization-extended-bot-authorization-access-token-example
*/
export interface RESTPostOAuth2AccessTokenWithBotAndGuildsScopeResult {
access_token: string;
token_type: string;
expires_in: number;
refresh_token: string;
scope: string;
guild: APIGuild;
}
/**
* https://discord.com/developers/docs/topics/oauth2#webhooks-webhook-token-response-example
*/
export interface RESTPostOAuth2AccessTokenWithBotAndWebhookIncomingScopeResult {
access_token: string;
token_type: string;
expires_in: number;
refresh_token: string;
scope: string;
webhook: APIWebhook;
}
export type RESTPostOAuth2AccessTokenWithBotAndGuildsAndWebhookIncomingScopeResult = RESTPostOAuth2AccessTokenWithBotAndGuildsScopeResult &
RESTPostOAuth2AccessTokenWithBotAndWebhookIncomingScopeResult;

33
v8/rest/template.ts Normal file
View File

@@ -0,0 +1,33 @@
import type { APIGuild, APITemplate } from '../payloads';
/**
* https://discord.com/developers/docs/resources/template#get-template
*/
export type RESTGetAPITemplateResult = APITemplate;
/**
* https://discord.com/developers/docs/resources/template#create-guild-from-template
*/
export interface RESTPostAPITemplateCreateGuildJSONBody {
name: string;
icon?: string;
}
/**
* https://discord.com/developers/docs/resources/template#create-guild-from-template
*/
export type RESTPostAPITemplateCreateGuildResult = APIGuild;
export type RESTGetAPIGuildTemplatesResult = APITemplate[];
export interface RESTPostAPIGuildTemplatesJSONBody {
name: string;
description?: string | null;
}
export type RESTPostAPIGuildTemplatesResult = APITemplate;
export type RESTPutAPIGuildTemplateSyncResult = APITemplate;
export type RESTPatchAPIGuildTemplateJSONBody = Partial<RESTPostAPIGuildTemplatesJSONBody>;
export type RESTPatchAPIGuildTemplateResult = APITemplate;
export type RESTDeleteAPIGuildTemplateResult = APITemplate;

60
v8/rest/user.ts Normal file
View File

@@ -0,0 +1,60 @@
import type { APIChannel, APIConnection, APIUser, GuildFeature } from '../payloads';
/**
* https://discord.com/developers/docs/resources/user#get-current-user
*/
export type RESTGetAPICurrentUserResult = APIUser;
/**
* https://discord.com/developers/docs/resources/user#get-user
*/
export type RESTGetAPIUserResult = APIUser;
/**
* https://discord.com/developers/docs/resources/user#modify-current-user
*/
export interface RESTPatchAPICurrentUserJSONBody {
username?: string;
avatar?: string | null;
}
export type RESTPatchAPICurrentUserResult = APIUser;
/**
* https://discord.com/developers/docs/resources/user#get-current-user-guilds
*/
export interface RESTGetAPICurrentUserGuildsQuery {
before?: string;
after?: string;
limit?: number;
}
export interface RESTAPIPartialCurrentUserGuild {
id: string;
name: string;
icon: string | null;
owner: boolean;
features: GuildFeature[];
permissions: string;
}
export type RESTGetAPICurrentUserGuildsResult = RESTAPIPartialCurrentUserGuild[];
/**
* https://discord.com/developers/docs/resources/user#leave-guild
*/
export type RESTDeleteAPICurrentUserGuildResult = never;
/**
* https://discord.com/developers/docs/resources/user#create-dm
*/
export interface RESTPostAPICurrentUserCreateDMChannelJSONBody {
recipient_id: string;
}
export type RESTPostAPICurrentUserCreateDMChannelResult = APIChannel;
/**
* https://discord.com/developers/docs/resources/user#get-user-connections
*/
export type RESTGetAPICurrentUserConnectionsResult = APIConnection[];

6
v8/rest/voice.ts Normal file
View File

@@ -0,0 +1,6 @@
import type { APIVoiceRegion } from '../payloads';
/**
* https://discord.com/developers/docs/resources/voice#list-voice-regions
*/
export type GetAPIVoiceRegionsResult = APIVoiceRegion[];

126
v8/rest/webhook.ts Normal file
View File

@@ -0,0 +1,126 @@
import type { APIAllowedMentionsSend } from './channel';
import type { APIEmbed, APIMessage, APIWebhook } from '../payloads';
/**
* https://discord.com/developers/docs/resources/webhook#create-webhook
*/
export interface RESTPostAPIChannelWebhookJSONBody {
name: string;
avatar?: string | null;
}
export type RESTPostAPIChannelWebhookResult = APIWebhook;
/**
* https://discord.com/developers/docs/resources/webhook#get-channel-webhooks
*/
export type RESTGetAPIChannelWebhooksResult = APIWebhook[];
/**
* https://discord.com/developers/docs/resources/webhook#get-guild-webhooks
*/
export type RESTGetAPIGuildWebhooksResult = APIWebhook[];
/**
* https://discord.com/developers/docs/resources/webhook#get-webhook
*/
export type RESTGetAPIWebhookResult = APIWebhook;
/**
* https://discord.com/developers/docs/resources/webhook#get-webhook-with-token
*/
export type RESTGetAPIWebhookWithTokenResult = Omit<APIWebhook, 'user'>;
/**
* https://discord.com/developers/docs/resources/webhook#modify-webhook
*/
export interface RESTPatchAPIWebhookJSONBody {
name?: string;
avatar?: string | null;
channel_id?: string;
}
export type RESTPatchAPIWebhookResult = APIWebhook;
/**
* https://discord.com/developers/docs/resources/webhook#modify-webhook-with-token
*/
export type RESTPatchAPIWebhookWithTokenJSONBody = Omit<RESTPatchAPIWebhookJSONBody, 'channel_id'>;
export type RESTPatchAPIWebhookWithTokenResult = Omit<APIWebhook, 'user'>;
/**
* https://discord.com/developers/docs/resources/webhook#delete-webhook
*/
export type RESTDeleteAPIWebhookResult = never;
export type RESTDeleteAPIWebhookWithTokenResult = never;
/**
* https://discord.com/developers/docs/resources/webhook#execute-webhook
*/
export interface RESTPostAPIWebhookWithTokenJSONBody {
content?: string;
username?: string;
avatar_url?: string;
tts?: boolean;
embeds?: APIEmbed[];
allowed_mentions?: APIAllowedMentionsSend;
}
/**
* https://discord.com/developers/docs/resources/webhook#execute-webhook
*/
export type RESTPostAPIWebhookWithTokenFormDataBody =
| {
/**
* JSON stringified message body
*/
payload_json?: string;
/**
* The file contents
*/
file: unknown;
}
| (RESTPostAPIWebhookWithTokenJSONBody & {
/**
* The file contents
*/
file: unknown;
});
/**
* https://discord.com/developers/docs/resources/webhook#execute-webhook-querystring-params
*/
export interface RESTPostAPIWebhookWithTokenQuery {
wait?: boolean;
}
export type RESTPostAPIWebhookWithTokenResult = never;
/**
* Received when a call to POST `/webhooks/{webhook.id}/{webhook.token}` receives
* the `wait` query parameter set to `true`
*
* @see https://discord.com/developers/docs/resources/webhook#execute-webhook-querystring-params
*/
export type RESTPostAPIWebhookWithTokenWaitResult = APIMessage;
/**
* https://discord.com/developers/docs/resources/webhook#execute-slackcompatible-webhook-querystring-params
*/
export type RESTPostAPIWebhookWithTokenSlackQuery = RESTPostAPIWebhookWithTokenQuery;
/**
* https://discord.com/developers/docs/resources/webhook#execute-githubcompatible-webhook-querystring-params
*/
export type RESTPostAPIWebhookWithTokenGitHubQuery = RESTPostAPIWebhookWithTokenQuery;
export type RESTPatchAPIWebhookWithTokenMessageJSONBody = RESTPostAPIWebhookWithTokenJSONBody;
export type RESTPatchAPIWebhookWithTokenMessageFormDataBody =
| {
payload_json: string;
}
| RESTPatchAPIWebhookWithTokenMessageJSONBody;
export type RESTDeleteAPIWebhookWithTokenMessageResult = never;