chore: initial jsdoc-ify of internals for intellisense sake

This commit is contained in:
Vlad Frangu
2024-07-17 14:33:40 +04:00
parent efa16a6095
commit 4d2a1110b8
75 changed files with 887 additions and 17 deletions

View File

@@ -1,6 +1,6 @@
{ {
"eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact"], "eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact"],
"eslint.experimental.useFlatConfig": true, "eslint.useFlatConfig": true,
"eslint.workingDirectories": [ "eslint.workingDirectories": [
{ "directory": "${workspaceFolder}" }, { "directory": "${workspaceFolder}" },
{ "pattern": "./apps/*/" }, { "pattern": "./apps/*/" },

View File

@@ -0,0 +1 @@
src/**/*.d.ts

View File

@@ -248,6 +248,13 @@
} }
] ]
} }
},
{
"files": ["src/client/actions/*.js", "src/client/websocket/handlers/*.js"],
"rules": {
"max-len": "warn",
"valid-jsdoc": "off"
}
} }
] ]
} }

View File

@@ -5,8 +5,8 @@
"description": "A powerful library for interacting with the Discord API", "description": "A powerful library for interacting with the Discord API",
"scripts": { "scripts": {
"test": "pnpm run docs:test && pnpm run test:typescript", "test": "pnpm run docs:test && pnpm run test:typescript",
"test:typescript": "tsc --noEmit && tsd", "test:typescript": "tsc && tsd",
"lint": "prettier --check . && tslint typings/index.d.ts && cross-env ESLINT_USE_FLAT_CONFIG=false eslint --format=pretty src typings", "lint": "prettier --check . && tslint typings/index.d.ts && cross-env ESLINT_USE_FLAT_CONFIG=false eslint --format=pretty src",
"format": "prettier --write . && cross-env ESLINT_USE_FLAT_CONFIG=false eslint --fix --format=pretty src", "format": "prettier --write . && cross-env ESLINT_USE_FLAT_CONFIG=false eslint --fix --format=pretty src",
"fmt": "pnpm run format", "fmt": "pnpm run format",
"docs": "docgen -i \"./src/*.js\" \"./src/**/*.js\" -c ./docs/index.json -r ../../ -o ./docs/docs.json && pnpm run docs:new", "docs": "docgen -i \"./src/*.js\" \"./src/**/*.js\" -c ./docs/index.json -r ../../ -o ./docs/docs.json && pnpm run docs:new",
@@ -14,7 +14,9 @@
"docs:new": "api-extractor run --local --minify && generate-split-documentation", "docs:new": "api-extractor run --local --minify && generate-split-documentation",
"prepack": "pnpm run lint && pnpm run test && node ./scripts/esmDts.mjs", "prepack": "pnpm run lint && pnpm run test && node ./scripts/esmDts.mjs",
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/discord.js/*'", "changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/discord.js/*'",
"release": "cliff-jumper" "release": "cliff-jumper",
"typecheck": "echo \"This is only used for vague type checking\" && tsc -p tsconfig.typechecking.json",
"scripts:generate-requires": "node scripts/generateRequires.mjs && pnpm run format"
}, },
"main": "./src/index.js", "main": "./src/index.js",
"types": "./typings/index.d.ts", "types": "./typings/index.d.ts",

View File

@@ -21,34 +21,159 @@ async function writeWebsocketHandlerImports() {
async function writeClientActionImports() { async function writeClientActionImports() {
const lines = [ const lines = [
"'use strict';\n", "'use strict';\n",
`/**
* @import Client from '../Client';
*/
`,
'class ActionsManager {', 'class ActionsManager {',
' // These symbols represent fully built data that we inject at times when calling actions manually.', ' // These symbols represent fully built data that we inject at times when calling actions manually.',
' // Action#getUser, for example, will return the injected data (which is assumed to be a built structure)', ' // Action#getUser, for example, will return the injected data (which is assumed to be a built structure)',
' // instead of trying to make it from provided data', ' // instead of trying to make it from provided data',
" injectedUser = Symbol('djs.actions.injectedUser');", " injectedUser = Symbol('djs.actions.injectedUser');",
" injectedChannel = Symbol('djs.actions.injectedChannel');", " injectedChannel = Symbol('djs.actions.injectedChannel');",
" injectedMessage = Symbol('djs.actions.injectedMessage');\n", " injectedMessage = Symbol('djs.actions.injectedMessage');",
'',
` /**
* @param {Client} client The client
* @internal
* @hideconstructor
*/`,
' constructor(client) {', ' constructor(client) {',
' this.client = client;\n', ' this.client = client;',
'',
];
const dtsLines = [
`import Action from './Action';
import Client from '../Client';
import { Guild } from '../../structures/Guild';
import { BaseChannel } from '../../structures/BaseChannel';
import WebSocketShard from '../websocket/WebSocketShard';
import { Message } from '../../structures/Message';
declare class ActionsManager {
injectedUser: symbol;
injectedChannel: symbol;
injectedMessage: symbol;
client: Client;
constructor(client: Client);
register(action: typeof Action): void;
// Autogenerated start`,
]; ];
const actionsDirectory = new URL('../src/client/actions', import.meta.url); const actionsDirectory = new URL('../src/client/actions', import.meta.url);
for (const file of (await readdir(actionsDirectory)).sort()) { for (const file of (await readdir(actionsDirectory)).sort()) {
if (file === 'Action.js' || file === 'ActionsManager.js') continue; if (file === 'Action.js' || file === 'ActionsManager.js' || file === 'ActionsManager.d.ts') continue;
lines.push(` this.register(require('./${file.slice(0, -3)}'));`); const fileName = file.slice(0, -3);
lines.push(` this.register(require('./${fileName}'));`);
// d.ts uniqueness
switch (fileName) {
case 'GuildChannelsPositionUpdate': {
dtsLines.push(
` ${fileName}: Action<[{ guild_id: string; channels: { id: string; position: number }[] }], { guild: Guild }>;`,
);
break;
}
case 'GuildRolesPositionUpdate': {
dtsLines.push(
` ${fileName}: Action<[{ guild_id: string; roles: { id: string; position: number }[] }], { guild: Guild }>;`,
);
break;
}
case 'GuildEmojiCreate': {
dtsLines.push(` ${fileName}: Action<[guild: Guild, emoji: import('discord-api-types/v10').APIEmoji]>;`);
break;
}
case 'GuildEmojiDelete': {
dtsLines.push(` ${fileName}: Action<[emoji: import('discord-api-types/v10').APIEmoji]>;`);
break;
}
case 'GuildEmojiUpdate': {
dtsLines.push(
` ${fileName}: Action<[oldEmoji: import('discord-api-types/v10').APIEmoji, newEmoji: import('discord-api-types/v10').APIEmoji]>;`,
);
break;
}
case 'GuildStickerCreate': {
dtsLines.push(
` ${fileName}: Action<[guild: Guild, sticker: import('discord-api-types/v10').APISticker], { sticker: import('discord-api-types/v10').APISticker }>;`,
);
break;
}
case 'GuildStickerDelete': {
dtsLines.push(` ${fileName}: Action<[sticker: import('discord-api-types/v10').APISticker]>;`);
break;
}
case 'GuildStickerUpdate': {
dtsLines.push(
` ${fileName}: Action<[oldSticker: import('discord-api-types/v10').APISticker, newSticker: import('discord-api-types/v10').APISticker]>;`,
);
break;
}
case 'MessagePollVoteAdd':
case 'MessagePollVoteRemove': {
// TODO(vladfrangu): fix the missing type aliases in discord-api-types (GatewayMessagePollVoteAddDispatchData/GatewayMessagePollVoteRemoveDispatchData)
dtsLines.push(` ${fileName}: Action<[import('discord-api-types/v10').GatewayMessagePollVoteDispatchData]>;`);
break;
}
case 'ChannelUpdate': {
dtsLines.push(
` ${fileName}: Action<[import('discord-api-types/v10').GatewayChannelUpdateDispatchData], { old?: BaseChannel; updated?: BaseChannel; }>;`,
);
break;
}
case 'GuildMemberRemove': {
dtsLines.push(
` ${fileName}: Action<[import('discord-api-types/v10').GatewayGuildMemberRemoveDispatchData, WebSocketShard]>;`,
);
break;
}
case 'GuildMemberUpdate': {
dtsLines.push(
` ${fileName}: Action<[import('discord-api-types/v10').GatewayGuildMemberUpdateDispatchData, WebSocketShard]>;`,
);
break;
}
case 'MessageUpdate': {
dtsLines.push(
` ${fileName}: Action<[import('discord-api-types/v10').GatewayMessageUpdateDispatchData], { old?: Message; updated?: Message; }>;`,
);
break;
}
default: {
dtsLines.push(
` ${fileName}: Action<[import('discord-api-types/v10').Gateway${file.slice(0, -3)}DispatchData]>;`,
);
break;
}
}
} }
lines.push(' }\n'); lines.push(' }', '');
lines.push(' register(Action) {'); lines.push(' register(Action) {');
lines.push(" this[Action.name.replace(/Action$/, '')] = new Action(this.client);"); lines.push(" this[Action.name.replace(/Action$/, '')] = new Action(this.client);");
lines.push(' }'); lines.push(' }');
lines.push('}\n'); lines.push('}', '');
lines.push('module.exports = ActionsManager;\n'); lines.push('module.exports = ActionsManager;', '');
dtsLines.push(` // Autogenerated end
}
export = ActionsManager;
`);
const outputFile = new URL('../src/client/actions/ActionsManager.js', import.meta.url); const outputFile = new URL('../src/client/actions/ActionsManager.js', import.meta.url);
const outputDtsFile = new URL('../src/client/actions/ActionsManager.d.ts', import.meta.url);
await writeFile(outputFile, lines.join('\n')); await writeFile(outputFile, lines.join('\n'));
await writeFile(outputDtsFile, dtsLines.join('\n'));
} }
writeWebsocketHandlerImports(); writeWebsocketHandlerImports();

View File

@@ -1,5 +1,9 @@
'use strict'; 'use strict';
/**
* @import Client from '../Client';
*/
const Partials = require('../../util/Partials'); const Partials = require('../../util/Partials');
/* /*
@@ -14,13 +18,28 @@ that WebSocket events don't clash with REST methods.
*/ */
/**
* @template {any[]} Arguments
* @template {any} [ReturnType=void]
*/
class GenericAction { class GenericAction {
/**
* @param {Client} client The client
* @internal
* @hideconstructor
*/
constructor(client) { constructor(client) {
this.client = client; this.client = client;
} }
handle(data) { /**
return data; * @param {Arguments} _args Arguments passed to the handler
* @returns {ReturnType}
*/
handle(..._args) {
/** @type {any} */
const casted = _args;
return casted;
} }
getPayload(data, manager, id, partialType, cache) { getPayload(data, manager, id, partialType, cache) {

View File

@@ -0,0 +1,107 @@
import Action from './Action';
import Client from '../Client';
import { Guild } from '../../structures/Guild';
import { BaseChannel } from '../../structures/BaseChannel';
import WebSocketShard from '../websocket/WebSocketShard';
import { Message } from '../../structures/Message';
declare class ActionsManager {
injectedUser: symbol;
injectedChannel: symbol;
injectedMessage: symbol;
client: Client;
constructor(client: Client);
register(action: typeof Action): void;
// Autogenerated start
ApplicationCommandPermissionsUpdate: Action<
[import('discord-api-types/v10').GatewayApplicationCommandPermissionsUpdateDispatchData]
>;
AutoModerationActionExecution: Action<
[import('discord-api-types/v10').GatewayAutoModerationActionExecutionDispatchData]
>;
AutoModerationRuleCreate: Action<[import('discord-api-types/v10').GatewayAutoModerationRuleCreateDispatchData]>;
AutoModerationRuleDelete: Action<[import('discord-api-types/v10').GatewayAutoModerationRuleDeleteDispatchData]>;
AutoModerationRuleUpdate: Action<[import('discord-api-types/v10').GatewayAutoModerationRuleUpdateDispatchData]>;
ChannelCreate: Action<[import('discord-api-types/v10').GatewayChannelCreateDispatchData]>;
ChannelDelete: Action<[import('discord-api-types/v10').GatewayChannelDeleteDispatchData]>;
ChannelUpdate: Action<
[import('discord-api-types/v10').GatewayChannelUpdateDispatchData],
{ old?: BaseChannel; updated?: BaseChannel }
>;
EntitlementCreate: Action<[import('discord-api-types/v10').GatewayEntitlementCreateDispatchData]>;
EntitlementDelete: Action<[import('discord-api-types/v10').GatewayEntitlementDeleteDispatchData]>;
EntitlementUpdate: Action<[import('discord-api-types/v10').GatewayEntitlementUpdateDispatchData]>;
GuildAuditLogEntryCreate: Action<[import('discord-api-types/v10').GatewayGuildAuditLogEntryCreateDispatchData]>;
GuildBanAdd: Action<[import('discord-api-types/v10').GatewayGuildBanAddDispatchData]>;
GuildBanRemove: Action<[import('discord-api-types/v10').GatewayGuildBanRemoveDispatchData]>;
GuildChannelsPositionUpdate: Action<
[{ guild_id: string; channels: { id: string; position: number }[] }],
{ guild: Guild }
>;
GuildDelete: Action<[import('discord-api-types/v10').GatewayGuildDeleteDispatchData]>;
GuildEmojiCreate: Action<[guild: Guild, emoji: import('discord-api-types/v10').APIEmoji]>;
GuildEmojiDelete: Action<[emoji: import('discord-api-types/v10').APIEmoji]>;
GuildEmojiUpdate: Action<
[oldEmoji: import('discord-api-types/v10').APIEmoji, newEmoji: import('discord-api-types/v10').APIEmoji]
>;
GuildEmojisUpdate: Action<[import('discord-api-types/v10').GatewayGuildEmojisUpdateDispatchData]>;
GuildIntegrationsUpdate: Action<[import('discord-api-types/v10').GatewayGuildIntegrationsUpdateDispatchData]>;
GuildMemberRemove: Action<[import('discord-api-types/v10').GatewayGuildMemberRemoveDispatchData, WebSocketShard]>;
GuildMemberUpdate: Action<[import('discord-api-types/v10').GatewayGuildMemberUpdateDispatchData, WebSocketShard]>;
GuildRoleCreate: Action<[import('discord-api-types/v10').GatewayGuildRoleCreateDispatchData]>;
GuildRoleDelete: Action<[import('discord-api-types/v10').GatewayGuildRoleDeleteDispatchData]>;
GuildRoleUpdate: Action<[import('discord-api-types/v10').GatewayGuildRoleUpdateDispatchData]>;
GuildRolesPositionUpdate: Action<[{ guild_id: string; roles: { id: string; position: number }[] }], { guild: Guild }>;
GuildScheduledEventCreate: Action<[import('discord-api-types/v10').GatewayGuildScheduledEventCreateDispatchData]>;
GuildScheduledEventDelete: Action<[import('discord-api-types/v10').GatewayGuildScheduledEventDeleteDispatchData]>;
GuildScheduledEventUpdate: Action<[import('discord-api-types/v10').GatewayGuildScheduledEventUpdateDispatchData]>;
GuildScheduledEventUserAdd: Action<[import('discord-api-types/v10').GatewayGuildScheduledEventUserAddDispatchData]>;
GuildScheduledEventUserRemove: Action<
[import('discord-api-types/v10').GatewayGuildScheduledEventUserRemoveDispatchData]
>;
GuildStickerCreate: Action<
[guild: Guild, sticker: import('discord-api-types/v10').APISticker],
{ sticker: import('discord-api-types/v10').APISticker }
>;
GuildStickerDelete: Action<[sticker: import('discord-api-types/v10').APISticker]>;
GuildStickerUpdate: Action<
[oldSticker: import('discord-api-types/v10').APISticker, newSticker: import('discord-api-types/v10').APISticker]
>;
GuildStickersUpdate: Action<[import('discord-api-types/v10').GatewayGuildStickersUpdateDispatchData]>;
GuildUpdate: Action<[import('discord-api-types/v10').GatewayGuildUpdateDispatchData]>;
InteractionCreate: Action<[import('discord-api-types/v10').GatewayInteractionCreateDispatchData]>;
InviteCreate: Action<[import('discord-api-types/v10').GatewayInviteCreateDispatchData]>;
InviteDelete: Action<[import('discord-api-types/v10').GatewayInviteDeleteDispatchData]>;
MessageCreate: Action<[import('discord-api-types/v10').GatewayMessageCreateDispatchData]>;
MessageDelete: Action<[import('discord-api-types/v10').GatewayMessageDeleteDispatchData]>;
MessageDeleteBulk: Action<[import('discord-api-types/v10').GatewayMessageDeleteBulkDispatchData]>;
MessagePollVoteAdd: Action<[import('discord-api-types/v10').GatewayMessagePollVoteDispatchData]>;
MessagePollVoteRemove: Action<[import('discord-api-types/v10').GatewayMessagePollVoteDispatchData]>;
MessageReactionAdd: Action<[import('discord-api-types/v10').GatewayMessageReactionAddDispatchData]>;
MessageReactionRemove: Action<[import('discord-api-types/v10').GatewayMessageReactionRemoveDispatchData]>;
MessageReactionRemoveAll: Action<[import('discord-api-types/v10').GatewayMessageReactionRemoveAllDispatchData]>;
MessageReactionRemoveEmoji: Action<[import('discord-api-types/v10').GatewayMessageReactionRemoveEmojiDispatchData]>;
MessageUpdate: Action<
[import('discord-api-types/v10').GatewayMessageUpdateDispatchData],
{ old?: Message; updated?: Message }
>;
PresenceUpdate: Action<[import('discord-api-types/v10').GatewayPresenceUpdateDispatchData]>;
StageInstanceCreate: Action<[import('discord-api-types/v10').GatewayStageInstanceCreateDispatchData]>;
StageInstanceDelete: Action<[import('discord-api-types/v10').GatewayStageInstanceDeleteDispatchData]>;
StageInstanceUpdate: Action<[import('discord-api-types/v10').GatewayStageInstanceUpdateDispatchData]>;
ThreadCreate: Action<[import('discord-api-types/v10').GatewayThreadCreateDispatchData]>;
ThreadDelete: Action<[import('discord-api-types/v10').GatewayThreadDeleteDispatchData]>;
ThreadListSync: Action<[import('discord-api-types/v10').GatewayThreadListSyncDispatchData]>;
ThreadMemberUpdate: Action<[import('discord-api-types/v10').GatewayThreadMemberUpdateDispatchData]>;
ThreadMembersUpdate: Action<[import('discord-api-types/v10').GatewayThreadMembersUpdateDispatchData]>;
TypingStart: Action<[import('discord-api-types/v10').GatewayTypingStartDispatchData]>;
UserUpdate: Action<[import('discord-api-types/v10').GatewayUserUpdateDispatchData]>;
VoiceStateUpdate: Action<[import('discord-api-types/v10').GatewayVoiceStateUpdateDispatchData]>;
WebhooksUpdate: Action<[import('discord-api-types/v10').GatewayWebhooksUpdateDispatchData]>;
// Autogenerated end
}
export = ActionsManager;

View File

@@ -1,5 +1,9 @@
'use strict'; 'use strict';
/**
* @import Client from '../Client';
*/
class ActionsManager { class ActionsManager {
// These symbols represent fully built data that we inject at times when calling actions manually. // These symbols represent fully built data that we inject at times when calling actions manually.
// Action#getUser, for example, will return the injected data (which is assumed to be a built structure) // Action#getUser, for example, will return the injected data (which is assumed to be a built structure)
@@ -8,6 +12,11 @@ class ActionsManager {
injectedChannel = Symbol('djs.actions.injectedChannel'); injectedChannel = Symbol('djs.actions.injectedChannel');
injectedMessage = Symbol('djs.actions.injectedMessage'); injectedMessage = Symbol('djs.actions.injectedMessage');
/**
* @param {Client} client The client
* @internal
* @hideconstructor
*/
constructor(client) { constructor(client) {
this.client = client; this.client = client;

View File

@@ -7,7 +7,7 @@ const Partials = require('../../util/Partials');
/* /*
{ user_id: 'id', { user_id: 'id',
message_id: 'id', message_id: 'id',
emoji: { name: '<EFBFBD>', id: null }, emoji: { name: '', id: null },
channel_id: 'id', channel_id: 'id',
// If originating from a guild // If originating from a guild
guild_id: 'id', guild_id: 'id',

View File

@@ -6,7 +6,7 @@ const Events = require('../../util/Events');
/* /*
{ user_id: 'id', { user_id: 'id',
message_id: 'id', message_id: 'id',
emoji: { name: '<EFBFBD>', id: null }, emoji: { name: '', id: null },
channel_id: 'id', channel_id: 'id',
guild_id: 'id' } guild_id: 'id' }
*/ */

View File

@@ -1,5 +1,14 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayApplicationCommandPermissionsUpdateDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayApplicationCommandPermissionsUpdateDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
client.actions.ApplicationCommandPermissionsUpdate.handle(packet.d); client.actions.ApplicationCommandPermissionsUpdate.handle(packet.d);
}; };

View File

@@ -1,5 +1,14 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayAutoModerationActionExecutionDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayAutoModerationActionExecutionDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
client.actions.AutoModerationActionExecution.handle(packet.d); client.actions.AutoModerationActionExecution.handle(packet.d);
}; };

View File

@@ -1,5 +1,14 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayAutoModerationRuleCreateDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayAutoModerationRuleCreateDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
client.actions.AutoModerationRuleCreate.handle(packet.d); client.actions.AutoModerationRuleCreate.handle(packet.d);
}; };

View File

@@ -1,5 +1,14 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayAutoModerationRuleDeleteDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayAutoModerationRuleDeleteDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
client.actions.AutoModerationRuleDelete.handle(packet.d); client.actions.AutoModerationRuleDelete.handle(packet.d);
}; };

View File

@@ -1,5 +1,14 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayAutoModerationRuleUpdateDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayAutoModerationRuleUpdateDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
client.actions.AutoModerationRuleUpdate.handle(packet.d); client.actions.AutoModerationRuleUpdate.handle(packet.d);
}; };

View File

@@ -1,5 +1,14 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayChannelCreateDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayChannelCreateDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
client.actions.ChannelCreate.handle(packet.d); client.actions.ChannelCreate.handle(packet.d);
}; };

View File

@@ -1,5 +1,14 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayChannelDeleteDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayChannelDeleteDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
client.actions.ChannelDelete.handle(packet.d); client.actions.ChannelDelete.handle(packet.d);
}; };

View File

@@ -1,7 +1,16 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayChannelPinsUpdateDispatch } from 'discord-api-types/v10';
*/
const Events = require('../../../util/Events'); const Events = require('../../../util/Events');
/**
* @param {Client} client The client
* @param {GatewayChannelPinsUpdateDispatch} packet The received packet
*/
module.exports = (client, { d: data }) => { module.exports = (client, { d: data }) => {
const channel = client.channels.cache.get(data.channel_id); const channel = client.channels.cache.get(data.channel_id);
const time = data.last_pin_timestamp ? Date.parse(data.last_pin_timestamp) : null; const time = data.last_pin_timestamp ? Date.parse(data.last_pin_timestamp) : null;

View File

@@ -1,9 +1,19 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayChannelUpdateDispatch } from 'discord-api-types/v10';
*/
const Events = require('../../../util/Events'); const Events = require('../../../util/Events');
/**
* @param {Client} client The client
* @param {GatewayChannelUpdateDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
const { old, updated } = client.actions.ChannelUpdate.handle(packet.d); const { old, updated } = client.actions.ChannelUpdate.handle(packet.d);
if (old && updated) { if (old && updated) {
/** /**
* Emitted whenever a channel is updated - e.g. name change, topic change, channel type change. * Emitted whenever a channel is updated - e.g. name change, topic change, channel type change.

View File

@@ -1,5 +1,14 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayEntitlementCreateDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayEntitlementCreateDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
client.actions.EntitlementCreate.handle(packet.d); client.actions.EntitlementCreate.handle(packet.d);
}; };

View File

@@ -1,5 +1,14 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayEntitlementDeleteDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayEntitlementDeleteDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
client.actions.EntitlementDelete.handle(packet.d); client.actions.EntitlementDelete.handle(packet.d);
}; };

View File

@@ -1,5 +1,14 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayEntitlementUpdateDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayEntitlementUpdateDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
client.actions.EntitlementUpdate.handle(packet.d); client.actions.EntitlementUpdate.handle(packet.d);
}; };

View File

@@ -1,5 +1,14 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayGuildAuditLogEntryCreateDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayGuildAuditLogEntryCreateDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
client.actions.GuildAuditLogEntryCreate.handle(packet.d); client.actions.GuildAuditLogEntryCreate.handle(packet.d);
}; };

View File

@@ -1,5 +1,14 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayGuildBanAddDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayGuildBanAddDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
client.actions.GuildBanAdd.handle(packet.d); client.actions.GuildBanAdd.handle(packet.d);
}; };

View File

@@ -1,5 +1,14 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayGuildBanRemoveDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayGuildBanRemoveDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
client.actions.GuildBanRemove.handle(packet.d); client.actions.GuildBanRemove.handle(packet.d);
}; };

View File

@@ -3,6 +3,17 @@
const Events = require('../../../util/Events'); const Events = require('../../../util/Events');
const Status = require('../../../util/Status'); const Status = require('../../../util/Status');
/**
* @import Client from '../../Client';
* @import { GatewayGuildCreateDispatch } from 'discord-api-types/v10';
* @import WebSocketShard from '../WebSocketShard';
*/
/**
* @param {Client} client The client
* @param {GatewayGuildCreateDispatch} packet The received packet
* @param {WebSocketShard} shard The shard that the event was received on
*/
module.exports = (client, { d: data }, shard) => { module.exports = (client, { d: data }, shard) => {
let guild = client.guilds.cache.get(data.id); let guild = client.guilds.cache.get(data.id);
if (guild) { if (guild) {

View File

@@ -1,5 +1,14 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayGuildDeleteDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayGuildDeleteDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
client.actions.GuildDelete.handle(packet.d); client.actions.GuildDelete.handle(packet.d);
}; };

View File

@@ -1,5 +1,14 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayGuildEmojisUpdateDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayGuildEmojisUpdateDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
client.actions.GuildEmojisUpdate.handle(packet.d); client.actions.GuildEmojisUpdate.handle(packet.d);
}; };

View File

@@ -1,5 +1,14 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayGuildIntegrationsUpdateDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayGuildIntegrationsUpdateDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
client.actions.GuildIntegrationsUpdate.handle(packet.d); client.actions.GuildIntegrationsUpdate.handle(packet.d);
}; };

View File

@@ -3,6 +3,15 @@
const { Collection } = require('@discordjs/collection'); const { Collection } = require('@discordjs/collection');
const Events = require('../../../util/Events'); const Events = require('../../../util/Events');
/**
* @import Client from '../../Client';
* @import { GatewayGuildMembersChunkDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayGuildMembersChunkDispatch} packet The received packet
*/
module.exports = (client, { d: data }) => { module.exports = (client, { d: data }) => {
const guild = client.guilds.cache.get(data.guild_id); const guild = client.guilds.cache.get(data.guild_id);
if (!guild) return; if (!guild) return;

View File

@@ -3,6 +3,17 @@
const Events = require('../../../util/Events'); const Events = require('../../../util/Events');
const Status = require('../../../util/Status'); const Status = require('../../../util/Status');
/**
* @import Client from '../../Client';
* @import { GatewayGuildMemberAddDispatch } from 'discord-api-types/v10';
* @import WebSocketShard from '../WebSocketShard';
*/
/**
* @param {Client} client The client
* @param {GatewayGuildMemberAddDispatch} packet The received packet
* @param {WebSocketShard} shard The shard that the event was received on
*/
module.exports = (client, { d: data }, shard) => { module.exports = (client, { d: data }, shard) => {
const guild = client.guilds.cache.get(data.guild_id); const guild = client.guilds.cache.get(data.guild_id);
if (guild) { if (guild) {

View File

@@ -1,5 +1,16 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayGuildMemberRemoveDispatch } from 'discord-api-types/v10';
* @import WebSocketShard from '../WebSocketShard';
*/
/**
* @param {Client} client The client
* @param {GatewayGuildMemberRemoveDispatch} packet The received packet
* @param {WebSocketShard} shard The shard that the event was received on
*/
module.exports = (client, packet, shard) => { module.exports = (client, packet, shard) => {
client.actions.GuildMemberRemove.handle(packet.d, shard); client.actions.GuildMemberRemove.handle(packet.d, shard);
}; };

View File

@@ -1,5 +1,16 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayGuildMemberUpdateDispatch } from 'discord-api-types/v10';
* @import WebSocketShard from '../WebSocketShard';
*/
/**
* @param {Client} client The client
* @param {GatewayGuildMemberUpdateDispatch} packet The received packet
* @param {WebSocketShard} shard The shard that the event was received on
*/
module.exports = (client, packet, shard) => { module.exports = (client, packet, shard) => {
client.actions.GuildMemberUpdate.handle(packet.d, shard); client.actions.GuildMemberUpdate.handle(packet.d, shard);
}; };

View File

@@ -1,5 +1,14 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayGuildRoleCreateDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayGuildRoleCreateDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
client.actions.GuildRoleCreate.handle(packet.d); client.actions.GuildRoleCreate.handle(packet.d);
}; };

View File

@@ -1,5 +1,14 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayGuildRoleDeleteDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayGuildRoleDeleteDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
client.actions.GuildRoleDelete.handle(packet.d); client.actions.GuildRoleDelete.handle(packet.d);
}; };

View File

@@ -1,5 +1,14 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayGuildRoleUpdateDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayGuildRoleUpdateDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
client.actions.GuildRoleUpdate.handle(packet.d); client.actions.GuildRoleUpdate.handle(packet.d);
}; };

View File

@@ -1,5 +1,14 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayGuildScheduledEventCreateDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayGuildScheduledEventCreateDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
client.actions.GuildScheduledEventCreate.handle(packet.d); client.actions.GuildScheduledEventCreate.handle(packet.d);
}; };

View File

@@ -1,5 +1,14 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayGuildScheduledEventDeleteDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayGuildScheduledEventDeleteDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
client.actions.GuildScheduledEventDelete.handle(packet.d); client.actions.GuildScheduledEventDelete.handle(packet.d);
}; };

View File

@@ -1,5 +1,14 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayGuildScheduledEventUpdateDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayGuildScheduledEventUpdateDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
client.actions.GuildScheduledEventUpdate.handle(packet.d); client.actions.GuildScheduledEventUpdate.handle(packet.d);
}; };

View File

@@ -1,5 +1,14 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayGuildScheduledEventUserAddDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayGuildScheduledEventUserAddDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
client.actions.GuildScheduledEventUserAdd.handle(packet.d); client.actions.GuildScheduledEventUserAdd.handle(packet.d);
}; };

View File

@@ -1,5 +1,14 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayGuildScheduledEventUserRemoveDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayGuildScheduledEventUserRemoveDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
client.actions.GuildScheduledEventUserRemove.handle(packet.d); client.actions.GuildScheduledEventUserRemove.handle(packet.d);
}; };

View File

@@ -1,5 +1,14 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayGuildStickersUpdateDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayGuildStickersUpdateDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
client.actions.GuildStickersUpdate.handle(packet.d); client.actions.GuildStickersUpdate.handle(packet.d);
}; };

View File

@@ -1,5 +1,14 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayGuildUpdateDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayGuildUpdateDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
client.actions.GuildUpdate.handle(packet.d); client.actions.GuildUpdate.handle(packet.d);
}; };

View File

@@ -1,5 +1,14 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayInteractionCreateDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayInteractionCreateDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
client.actions.InteractionCreate.handle(packet.d); client.actions.InteractionCreate.handle(packet.d);
}; };

View File

@@ -1,5 +1,14 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayInviteCreateDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayInviteCreateDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
client.actions.InviteCreate.handle(packet.d); client.actions.InviteCreate.handle(packet.d);
}; };

View File

@@ -1,5 +1,14 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayInviteDeleteDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayInviteDeleteDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
client.actions.InviteDelete.handle(packet.d); client.actions.InviteDelete.handle(packet.d);
}; };

View File

@@ -1,5 +1,14 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayMessageCreateDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayMessageCreateDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
client.actions.MessageCreate.handle(packet.d); client.actions.MessageCreate.handle(packet.d);
}; };

View File

@@ -1,5 +1,14 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayMessageDeleteDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayMessageDeleteDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
client.actions.MessageDelete.handle(packet.d); client.actions.MessageDelete.handle(packet.d);
}; };

View File

@@ -1,5 +1,14 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayMessageDeleteBulkDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayMessageDeleteBulkDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
client.actions.MessageDeleteBulk.handle(packet.d); client.actions.MessageDeleteBulk.handle(packet.d);
}; };

View File

@@ -1,5 +1,14 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayMessagePollVoteAddDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayMessagePollVoteAddDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
client.actions.MessagePollVoteAdd.handle(packet.d); client.actions.MessagePollVoteAdd.handle(packet.d);
}; };

View File

@@ -1,5 +1,14 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayMessagePollVoteRemoveDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayMessagePollVoteRemoveDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
client.actions.MessagePollVoteRemove.handle(packet.d); client.actions.MessagePollVoteRemove.handle(packet.d);
}; };

View File

@@ -1,5 +1,14 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayMessageReactionAddDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayMessageReactionAddDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
client.actions.MessageReactionAdd.handle(packet.d); client.actions.MessageReactionAdd.handle(packet.d);
}; };

View File

@@ -1,5 +1,14 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayMessageReactionRemoveDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayMessageReactionRemoveDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
client.actions.MessageReactionRemove.handle(packet.d); client.actions.MessageReactionRemove.handle(packet.d);
}; };

View File

@@ -1,5 +1,14 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayMessageReactionRemoveAllDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayMessageReactionRemoveAllDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
client.actions.MessageReactionRemoveAll.handle(packet.d); client.actions.MessageReactionRemoveAll.handle(packet.d);
}; };

View File

@@ -1,5 +1,14 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayMessageReactionRemoveEmojiDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayMessageReactionRemoveEmojiDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
client.actions.MessageReactionRemoveEmoji.handle(packet.d); client.actions.MessageReactionRemoveEmoji.handle(packet.d);
}; };

View File

@@ -2,6 +2,15 @@
const Events = require('../../../util/Events'); const Events = require('../../../util/Events');
/**
* @import Client from '../../Client';
* @import { GatewayMessageUpdateDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayMessageUpdateDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
const { old, updated } = client.actions.MessageUpdate.handle(packet.d); const { old, updated } = client.actions.MessageUpdate.handle(packet.d);
if (old && updated) { if (old && updated) {

View File

@@ -1,5 +1,14 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayPresenceUpdateDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayPresenceUpdateDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
client.actions.PresenceUpdate.handle(packet.d); client.actions.PresenceUpdate.handle(packet.d);
}; };

View File

@@ -3,6 +3,17 @@
const ClientApplication = require('../../../structures/ClientApplication'); const ClientApplication = require('../../../structures/ClientApplication');
let ClientUser; let ClientUser;
/**
* @import Client from '../../Client';
* @import { GatewayReadyDispatch } from 'discord-api-types/v10';
* @import WebSocketShard from '../WebSocketShard';
*/
/**
* @param {Client} client The client
* @param {GatewayReadyDispatch} packet The received packet
* @param {WebSocketShard} shard The shard that the event was received on
*/
module.exports = (client, { d: data }, shard) => { module.exports = (client, { d: data }, shard) => {
if (client.user) { if (client.user) {
client.user._patch(data.user); client.user._patch(data.user);

View File

@@ -2,7 +2,18 @@
const Events = require('../../../util/Events'); const Events = require('../../../util/Events');
module.exports = (client, packet, shard) => { /**
* @import Client from '../../Client';
* @import { GatewayResumedDispatch } from 'discord-api-types/v10';
* @import WebSocketShard from '../WebSocketShard';
*/
/**
* @param {Client} client The client
* @param {GatewayResumedDispatch} _packet The received packet
* @param {WebSocketShard} shard The shard that the event was received on
*/
module.exports = (client, _packet, shard) => {
const replayed = shard.sessionInfo.sequence - shard.closeSequence; const replayed = shard.sessionInfo.sequence - shard.closeSequence;
/** /**
* Emitted when a shard resumes successfully. * Emitted when a shard resumes successfully.

View File

@@ -1,5 +1,14 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayStageInstanceCreateDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayStageInstanceCreateDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
client.actions.StageInstanceCreate.handle(packet.d); client.actions.StageInstanceCreate.handle(packet.d);
}; };

View File

@@ -1,5 +1,14 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayStageInstanceDeleteDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayStageInstanceDeleteDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
client.actions.StageInstanceDelete.handle(packet.d); client.actions.StageInstanceDelete.handle(packet.d);
}; };

View File

@@ -1,5 +1,14 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayStageInstanceUpdateDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayStageInstanceUpdateDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
client.actions.StageInstanceUpdate.handle(packet.d); client.actions.StageInstanceUpdate.handle(packet.d);
}; };

View File

@@ -1,5 +1,14 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayThreadCreateDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayThreadCreateDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
client.actions.ThreadCreate.handle(packet.d); client.actions.ThreadCreate.handle(packet.d);
}; };

View File

@@ -1,5 +1,14 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayThreadDeleteDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayThreadDeleteDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
client.actions.ThreadDelete.handle(packet.d); client.actions.ThreadDelete.handle(packet.d);
}; };

View File

@@ -1,5 +1,14 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayThreadListSyncDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayThreadListSyncDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
client.actions.ThreadListSync.handle(packet.d); client.actions.ThreadListSync.handle(packet.d);
}; };

View File

@@ -1,5 +1,14 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayThreadMembersUpdateDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayThreadMembersUpdateDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
client.actions.ThreadMembersUpdate.handle(packet.d); client.actions.ThreadMembersUpdate.handle(packet.d);
}; };

View File

@@ -1,5 +1,14 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayThreadMemberUpdateDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayThreadMemberUpdateDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
client.actions.ThreadMemberUpdate.handle(packet.d); client.actions.ThreadMemberUpdate.handle(packet.d);
}; };

View File

@@ -2,6 +2,15 @@
const Events = require('../../../util/Events'); const Events = require('../../../util/Events');
/**
* @import Client from '../../Client';
* @import { GatewayThreadUpdateDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayThreadUpdateDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
const { old, updated } = client.actions.ChannelUpdate.handle(packet.d); const { old, updated } = client.actions.ChannelUpdate.handle(packet.d);
if (old && updated) { if (old && updated) {

View File

@@ -1,5 +1,14 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayTypingStartDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayTypingStartDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
client.actions.TypingStart.handle(packet.d); client.actions.TypingStart.handle(packet.d);
}; };

View File

@@ -1,5 +1,14 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayUserUpdateDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayUserUpdateDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
client.actions.UserUpdate.handle(packet.d); client.actions.UserUpdate.handle(packet.d);
}; };

View File

@@ -1,5 +1,14 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayVoiceServerUpdateDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayVoiceServerUpdateDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
client.emit('debug', `[VOICE] received voice server: ${JSON.stringify(packet)}`); client.emit('debug', `[VOICE] received voice server: ${JSON.stringify(packet)}`);
client.voice.onVoiceServer(packet.d); client.voice.onVoiceServer(packet.d);

View File

@@ -1,5 +1,14 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayVoiceStateUpdateDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayVoiceStateUpdateDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
client.actions.VoiceStateUpdate.handle(packet.d); client.actions.VoiceStateUpdate.handle(packet.d);
}; };

View File

@@ -1,5 +1,14 @@
'use strict'; 'use strict';
/**
* @import Client from '../../Client';
* @import { GatewayWebhooksUpdateDispatch } from 'discord-api-types/v10';
*/
/**
* @param {Client} client The client
* @param {GatewayWebhooksUpdateDispatch} packet The received packet
*/
module.exports = (client, packet) => { module.exports = (client, packet) => {
client.actions.WebhooksUpdate.handle(packet.d); client.actions.WebhooksUpdate.handle(packet.d);
}; };

View File

@@ -2,6 +2,9 @@
"$schema": "https://json.schemastore.org/tsconfig.json", "$schema": "https://json.schemastore.org/tsconfig.json",
"extends": "../../tsconfig.json", "extends": "../../tsconfig.json",
"compilerOptions": { "compilerOptions": {
// Emit
"noEmit": true,
// Output Formatting // Output Formatting
"pretty": false, "pretty": false,
@@ -21,5 +24,7 @@
"undici", "undici",
"@sapphire/snowflake" "@sapphire/snowflake"
] ]
} },
"include": ["typings", "scripts"],
"exclude": ["src/**/*.d.ts"]
} }

View File

@@ -0,0 +1,15 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
// Modules
"module": "Node16",
"moduleResolution": "Node16",
// Language and Environment
"allowJs": true,
"checkJs": true,
"target": "ES2020"
},
"include": ["src"],
"exclude": ["typings"]
}