diff --git a/.vscode/settings.json b/.vscode/settings.json index 7f3769bc0..d5300e4a6 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,6 +1,6 @@ { "eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact"], - "eslint.experimental.useFlatConfig": true, + "eslint.useFlatConfig": true, "eslint.workingDirectories": [ { "directory": "${workspaceFolder}" }, { "pattern": "./apps/*/" }, diff --git a/packages/discord.js/.eslintignore b/packages/discord.js/.eslintignore new file mode 100644 index 000000000..c66ae6b38 --- /dev/null +++ b/packages/discord.js/.eslintignore @@ -0,0 +1 @@ +src/**/*.d.ts diff --git a/packages/discord.js/.eslintrc.json b/packages/discord.js/.eslintrc.json index ecfad0981..a06c2569b 100644 --- a/packages/discord.js/.eslintrc.json +++ b/packages/discord.js/.eslintrc.json @@ -248,6 +248,13 @@ } ] } + }, + { + "files": ["src/client/actions/*.js", "src/client/websocket/handlers/*.js"], + "rules": { + "max-len": "warn", + "valid-jsdoc": "off" + } } ] } diff --git a/packages/discord.js/package.json b/packages/discord.js/package.json index f010f410c..9fa89d286 100644 --- a/packages/discord.js/package.json +++ b/packages/discord.js/package.json @@ -5,8 +5,8 @@ "description": "A powerful library for interacting with the Discord API", "scripts": { "test": "pnpm run docs:test && pnpm run test:typescript", - "test:typescript": "tsc --noEmit && tsd", - "lint": "prettier --check . && tslint typings/index.d.ts && cross-env ESLINT_USE_FLAT_CONFIG=false eslint --format=pretty src typings", + "test:typescript": "tsc && tsd", + "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", "fmt": "pnpm run format", "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", "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/*'", - "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", "types": "./typings/index.d.ts", diff --git a/packages/discord.js/scripts/generateRequires.mjs b/packages/discord.js/scripts/generateRequires.mjs index b6e28db8a..52897016e 100644 --- a/packages/discord.js/scripts/generateRequires.mjs +++ b/packages/discord.js/scripts/generateRequires.mjs @@ -21,34 +21,159 @@ async function writeWebsocketHandlerImports() { async function writeClientActionImports() { const lines = [ "'use strict';\n", + `/** + * @import Client from '../Client'; + */ +`, 'class ActionsManager {', ' // 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)', ' // instead of trying to make it from provided data', " injectedUser = Symbol('djs.actions.injectedUser');", " 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) {', - ' 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); 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(" this[Action.name.replace(/Action$/, '')] = new Action(this.client);"); lines.push(' }'); - lines.push('}\n'); - lines.push('module.exports = ActionsManager;\n'); + lines.push('}', ''); + lines.push('module.exports = ActionsManager;', ''); + + dtsLines.push(` // Autogenerated end +} + +export = ActionsManager; +`); 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(outputDtsFile, dtsLines.join('\n')); } writeWebsocketHandlerImports(); diff --git a/packages/discord.js/src/client/actions/Action.js b/packages/discord.js/src/client/actions/Action.js index 96170ee87..b44292165 100644 --- a/packages/discord.js/src/client/actions/Action.js +++ b/packages/discord.js/src/client/actions/Action.js @@ -1,5 +1,9 @@ 'use strict'; +/** + * @import Client from '../Client'; + */ + 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 { + /** + * @param {Client} client The client + * @internal + * @hideconstructor + */ constructor(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) { diff --git a/packages/discord.js/src/client/actions/ActionsManager.d.ts b/packages/discord.js/src/client/actions/ActionsManager.d.ts new file mode 100644 index 000000000..c48679968 --- /dev/null +++ b/packages/discord.js/src/client/actions/ActionsManager.d.ts @@ -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; diff --git a/packages/discord.js/src/client/actions/ActionsManager.js b/packages/discord.js/src/client/actions/ActionsManager.js index dd305a948..3d50a89b8 100644 --- a/packages/discord.js/src/client/actions/ActionsManager.js +++ b/packages/discord.js/src/client/actions/ActionsManager.js @@ -1,5 +1,9 @@ 'use strict'; +/** + * @import Client from '../Client'; + */ + class ActionsManager { // 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) @@ -8,6 +12,11 @@ class ActionsManager { injectedChannel = Symbol('djs.actions.injectedChannel'); injectedMessage = Symbol('djs.actions.injectedMessage'); + /** + * @param {Client} client The client + * @internal + * @hideconstructor + */ constructor(client) { this.client = client; diff --git a/packages/discord.js/src/client/actions/MessageReactionAdd.js b/packages/discord.js/src/client/actions/MessageReactionAdd.js index ea97bd60d..d884eeb21 100644 --- a/packages/discord.js/src/client/actions/MessageReactionAdd.js +++ b/packages/discord.js/src/client/actions/MessageReactionAdd.js @@ -7,7 +7,7 @@ const Partials = require('../../util/Partials'); /* { user_id: 'id', message_id: 'id', - emoji: { name: '�', id: null }, + emoji: { name: '', id: null }, channel_id: 'id', // If originating from a guild guild_id: 'id', diff --git a/packages/discord.js/src/client/actions/MessageReactionRemove.js b/packages/discord.js/src/client/actions/MessageReactionRemove.js index 9ca3a8e5e..2ab479768 100644 --- a/packages/discord.js/src/client/actions/MessageReactionRemove.js +++ b/packages/discord.js/src/client/actions/MessageReactionRemove.js @@ -6,7 +6,7 @@ const Events = require('../../util/Events'); /* { user_id: 'id', message_id: 'id', - emoji: { name: '�', id: null }, + emoji: { name: '', id: null }, channel_id: 'id', guild_id: 'id' } */ diff --git a/packages/discord.js/src/client/websocket/handlers/APPLICATION_COMMAND_PERMISSIONS_UPDATE.js b/packages/discord.js/src/client/websocket/handlers/APPLICATION_COMMAND_PERMISSIONS_UPDATE.js index 73d4ec47f..1160eb4e0 100644 --- a/packages/discord.js/src/client/websocket/handlers/APPLICATION_COMMAND_PERMISSIONS_UPDATE.js +++ b/packages/discord.js/src/client/websocket/handlers/APPLICATION_COMMAND_PERMISSIONS_UPDATE.js @@ -1,5 +1,14 @@ '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) => { client.actions.ApplicationCommandPermissionsUpdate.handle(packet.d); }; diff --git a/packages/discord.js/src/client/websocket/handlers/AUTO_MODERATION_ACTION_EXECUTION.js b/packages/discord.js/src/client/websocket/handlers/AUTO_MODERATION_ACTION_EXECUTION.js index 22463b6e1..f39ee8007 100644 --- a/packages/discord.js/src/client/websocket/handlers/AUTO_MODERATION_ACTION_EXECUTION.js +++ b/packages/discord.js/src/client/websocket/handlers/AUTO_MODERATION_ACTION_EXECUTION.js @@ -1,5 +1,14 @@ '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) => { client.actions.AutoModerationActionExecution.handle(packet.d); }; diff --git a/packages/discord.js/src/client/websocket/handlers/AUTO_MODERATION_RULE_CREATE.js b/packages/discord.js/src/client/websocket/handlers/AUTO_MODERATION_RULE_CREATE.js index af64b9cbc..83bc53696 100644 --- a/packages/discord.js/src/client/websocket/handlers/AUTO_MODERATION_RULE_CREATE.js +++ b/packages/discord.js/src/client/websocket/handlers/AUTO_MODERATION_RULE_CREATE.js @@ -1,5 +1,14 @@ '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) => { client.actions.AutoModerationRuleCreate.handle(packet.d); }; diff --git a/packages/discord.js/src/client/websocket/handlers/AUTO_MODERATION_RULE_DELETE.js b/packages/discord.js/src/client/websocket/handlers/AUTO_MODERATION_RULE_DELETE.js index 56ec504a9..537ba435b 100644 --- a/packages/discord.js/src/client/websocket/handlers/AUTO_MODERATION_RULE_DELETE.js +++ b/packages/discord.js/src/client/websocket/handlers/AUTO_MODERATION_RULE_DELETE.js @@ -1,5 +1,14 @@ '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) => { client.actions.AutoModerationRuleDelete.handle(packet.d); }; diff --git a/packages/discord.js/src/client/websocket/handlers/AUTO_MODERATION_RULE_UPDATE.js b/packages/discord.js/src/client/websocket/handlers/AUTO_MODERATION_RULE_UPDATE.js index 3caf6ba55..8ca2b787e 100644 --- a/packages/discord.js/src/client/websocket/handlers/AUTO_MODERATION_RULE_UPDATE.js +++ b/packages/discord.js/src/client/websocket/handlers/AUTO_MODERATION_RULE_UPDATE.js @@ -1,5 +1,14 @@ '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) => { client.actions.AutoModerationRuleUpdate.handle(packet.d); }; diff --git a/packages/discord.js/src/client/websocket/handlers/CHANNEL_CREATE.js b/packages/discord.js/src/client/websocket/handlers/CHANNEL_CREATE.js index d6d560d8e..544855bc1 100644 --- a/packages/discord.js/src/client/websocket/handlers/CHANNEL_CREATE.js +++ b/packages/discord.js/src/client/websocket/handlers/CHANNEL_CREATE.js @@ -1,5 +1,14 @@ '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) => { client.actions.ChannelCreate.handle(packet.d); }; diff --git a/packages/discord.js/src/client/websocket/handlers/CHANNEL_DELETE.js b/packages/discord.js/src/client/websocket/handlers/CHANNEL_DELETE.js index cb9f3d8c1..d4cd79865 100644 --- a/packages/discord.js/src/client/websocket/handlers/CHANNEL_DELETE.js +++ b/packages/discord.js/src/client/websocket/handlers/CHANNEL_DELETE.js @@ -1,5 +1,14 @@ '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) => { client.actions.ChannelDelete.handle(packet.d); }; diff --git a/packages/discord.js/src/client/websocket/handlers/CHANNEL_PINS_UPDATE.js b/packages/discord.js/src/client/websocket/handlers/CHANNEL_PINS_UPDATE.js index c46e52727..b0b4b6145 100644 --- a/packages/discord.js/src/client/websocket/handlers/CHANNEL_PINS_UPDATE.js +++ b/packages/discord.js/src/client/websocket/handlers/CHANNEL_PINS_UPDATE.js @@ -1,7 +1,16 @@ 'use strict'; +/** + * @import Client from '../../Client'; + * @import { GatewayChannelPinsUpdateDispatch } from 'discord-api-types/v10'; + */ + const Events = require('../../../util/Events'); +/** + * @param {Client} client The client + * @param {GatewayChannelPinsUpdateDispatch} packet The received packet + */ module.exports = (client, { d: data }) => { const channel = client.channels.cache.get(data.channel_id); const time = data.last_pin_timestamp ? Date.parse(data.last_pin_timestamp) : null; diff --git a/packages/discord.js/src/client/websocket/handlers/CHANNEL_UPDATE.js b/packages/discord.js/src/client/websocket/handlers/CHANNEL_UPDATE.js index 8f35121b0..9fb715cf4 100644 --- a/packages/discord.js/src/client/websocket/handlers/CHANNEL_UPDATE.js +++ b/packages/discord.js/src/client/websocket/handlers/CHANNEL_UPDATE.js @@ -1,9 +1,19 @@ 'use strict'; +/** + * @import Client from '../../Client'; + * @import { GatewayChannelUpdateDispatch } from 'discord-api-types/v10'; + */ + const Events = require('../../../util/Events'); +/** + * @param {Client} client The client + * @param {GatewayChannelUpdateDispatch} packet The received packet + */ module.exports = (client, packet) => { const { old, updated } = client.actions.ChannelUpdate.handle(packet.d); + if (old && updated) { /** * Emitted whenever a channel is updated - e.g. name change, topic change, channel type change. diff --git a/packages/discord.js/src/client/websocket/handlers/ENTITLEMENT_CREATE.js b/packages/discord.js/src/client/websocket/handlers/ENTITLEMENT_CREATE.js index 08e37b819..bf2ecd084 100644 --- a/packages/discord.js/src/client/websocket/handlers/ENTITLEMENT_CREATE.js +++ b/packages/discord.js/src/client/websocket/handlers/ENTITLEMENT_CREATE.js @@ -1,5 +1,14 @@ '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) => { client.actions.EntitlementCreate.handle(packet.d); }; diff --git a/packages/discord.js/src/client/websocket/handlers/ENTITLEMENT_DELETE.js b/packages/discord.js/src/client/websocket/handlers/ENTITLEMENT_DELETE.js index d731d1bb5..901777828 100644 --- a/packages/discord.js/src/client/websocket/handlers/ENTITLEMENT_DELETE.js +++ b/packages/discord.js/src/client/websocket/handlers/ENTITLEMENT_DELETE.js @@ -1,5 +1,14 @@ '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) => { client.actions.EntitlementDelete.handle(packet.d); }; diff --git a/packages/discord.js/src/client/websocket/handlers/ENTITLEMENT_UPDATE.js b/packages/discord.js/src/client/websocket/handlers/ENTITLEMENT_UPDATE.js index 51534bbe4..4f0e98b04 100644 --- a/packages/discord.js/src/client/websocket/handlers/ENTITLEMENT_UPDATE.js +++ b/packages/discord.js/src/client/websocket/handlers/ENTITLEMENT_UPDATE.js @@ -1,5 +1,14 @@ '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) => { client.actions.EntitlementUpdate.handle(packet.d); }; diff --git a/packages/discord.js/src/client/websocket/handlers/GUILD_AUDIT_LOG_ENTRY_CREATE.js b/packages/discord.js/src/client/websocket/handlers/GUILD_AUDIT_LOG_ENTRY_CREATE.js index 862314166..8adf8e44a 100644 --- a/packages/discord.js/src/client/websocket/handlers/GUILD_AUDIT_LOG_ENTRY_CREATE.js +++ b/packages/discord.js/src/client/websocket/handlers/GUILD_AUDIT_LOG_ENTRY_CREATE.js @@ -1,5 +1,14 @@ '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) => { client.actions.GuildAuditLogEntryCreate.handle(packet.d); }; diff --git a/packages/discord.js/src/client/websocket/handlers/GUILD_BAN_ADD.js b/packages/discord.js/src/client/websocket/handlers/GUILD_BAN_ADD.js index d8dc0f9da..3c2146326 100644 --- a/packages/discord.js/src/client/websocket/handlers/GUILD_BAN_ADD.js +++ b/packages/discord.js/src/client/websocket/handlers/GUILD_BAN_ADD.js @@ -1,5 +1,14 @@ '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) => { client.actions.GuildBanAdd.handle(packet.d); }; diff --git a/packages/discord.js/src/client/websocket/handlers/GUILD_BAN_REMOVE.js b/packages/discord.js/src/client/websocket/handlers/GUILD_BAN_REMOVE.js index 8389e46e8..f5b36db3c 100644 --- a/packages/discord.js/src/client/websocket/handlers/GUILD_BAN_REMOVE.js +++ b/packages/discord.js/src/client/websocket/handlers/GUILD_BAN_REMOVE.js @@ -1,5 +1,14 @@ '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) => { client.actions.GuildBanRemove.handle(packet.d); }; diff --git a/packages/discord.js/src/client/websocket/handlers/GUILD_CREATE.js b/packages/discord.js/src/client/websocket/handlers/GUILD_CREATE.js index 141f0abe9..aff55b3c4 100644 --- a/packages/discord.js/src/client/websocket/handlers/GUILD_CREATE.js +++ b/packages/discord.js/src/client/websocket/handlers/GUILD_CREATE.js @@ -3,6 +3,17 @@ const Events = require('../../../util/Events'); 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) => { let guild = client.guilds.cache.get(data.id); if (guild) { diff --git a/packages/discord.js/src/client/websocket/handlers/GUILD_DELETE.js b/packages/discord.js/src/client/websocket/handlers/GUILD_DELETE.js index 27a325623..a239994fa 100644 --- a/packages/discord.js/src/client/websocket/handlers/GUILD_DELETE.js +++ b/packages/discord.js/src/client/websocket/handlers/GUILD_DELETE.js @@ -1,5 +1,14 @@ '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) => { client.actions.GuildDelete.handle(packet.d); }; diff --git a/packages/discord.js/src/client/websocket/handlers/GUILD_EMOJIS_UPDATE.js b/packages/discord.js/src/client/websocket/handlers/GUILD_EMOJIS_UPDATE.js index e23b6713f..1fec702d3 100644 --- a/packages/discord.js/src/client/websocket/handlers/GUILD_EMOJIS_UPDATE.js +++ b/packages/discord.js/src/client/websocket/handlers/GUILD_EMOJIS_UPDATE.js @@ -1,5 +1,14 @@ '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) => { client.actions.GuildEmojisUpdate.handle(packet.d); }; diff --git a/packages/discord.js/src/client/websocket/handlers/GUILD_INTEGRATIONS_UPDATE.js b/packages/discord.js/src/client/websocket/handlers/GUILD_INTEGRATIONS_UPDATE.js index e90a72c25..12bdc170c 100644 --- a/packages/discord.js/src/client/websocket/handlers/GUILD_INTEGRATIONS_UPDATE.js +++ b/packages/discord.js/src/client/websocket/handlers/GUILD_INTEGRATIONS_UPDATE.js @@ -1,5 +1,14 @@ '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) => { client.actions.GuildIntegrationsUpdate.handle(packet.d); }; diff --git a/packages/discord.js/src/client/websocket/handlers/GUILD_MEMBERS_CHUNK.js b/packages/discord.js/src/client/websocket/handlers/GUILD_MEMBERS_CHUNK.js index 2f61a1ea2..c461d3c45 100644 --- a/packages/discord.js/src/client/websocket/handlers/GUILD_MEMBERS_CHUNK.js +++ b/packages/discord.js/src/client/websocket/handlers/GUILD_MEMBERS_CHUNK.js @@ -3,6 +3,15 @@ const { Collection } = require('@discordjs/collection'); 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 }) => { const guild = client.guilds.cache.get(data.guild_id); if (!guild) return; diff --git a/packages/discord.js/src/client/websocket/handlers/GUILD_MEMBER_ADD.js b/packages/discord.js/src/client/websocket/handlers/GUILD_MEMBER_ADD.js index fece5d76f..10e2b96ed 100644 --- a/packages/discord.js/src/client/websocket/handlers/GUILD_MEMBER_ADD.js +++ b/packages/discord.js/src/client/websocket/handlers/GUILD_MEMBER_ADD.js @@ -3,6 +3,17 @@ const Events = require('../../../util/Events'); 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) => { const guild = client.guilds.cache.get(data.guild_id); if (guild) { diff --git a/packages/discord.js/src/client/websocket/handlers/GUILD_MEMBER_REMOVE.js b/packages/discord.js/src/client/websocket/handlers/GUILD_MEMBER_REMOVE.js index 72432af11..d21e78b06 100644 --- a/packages/discord.js/src/client/websocket/handlers/GUILD_MEMBER_REMOVE.js +++ b/packages/discord.js/src/client/websocket/handlers/GUILD_MEMBER_REMOVE.js @@ -1,5 +1,16 @@ '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) => { client.actions.GuildMemberRemove.handle(packet.d, shard); }; diff --git a/packages/discord.js/src/client/websocket/handlers/GUILD_MEMBER_UPDATE.js b/packages/discord.js/src/client/websocket/handlers/GUILD_MEMBER_UPDATE.js index cafc6bd59..fae7fd56a 100644 --- a/packages/discord.js/src/client/websocket/handlers/GUILD_MEMBER_UPDATE.js +++ b/packages/discord.js/src/client/websocket/handlers/GUILD_MEMBER_UPDATE.js @@ -1,5 +1,16 @@ '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) => { client.actions.GuildMemberUpdate.handle(packet.d, shard); }; diff --git a/packages/discord.js/src/client/websocket/handlers/GUILD_ROLE_CREATE.js b/packages/discord.js/src/client/websocket/handlers/GUILD_ROLE_CREATE.js index da9e7bc4b..7c6b276f9 100644 --- a/packages/discord.js/src/client/websocket/handlers/GUILD_ROLE_CREATE.js +++ b/packages/discord.js/src/client/websocket/handlers/GUILD_ROLE_CREATE.js @@ -1,5 +1,14 @@ '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) => { client.actions.GuildRoleCreate.handle(packet.d); }; diff --git a/packages/discord.js/src/client/websocket/handlers/GUILD_ROLE_DELETE.js b/packages/discord.js/src/client/websocket/handlers/GUILD_ROLE_DELETE.js index cdc635316..63d858d9c 100644 --- a/packages/discord.js/src/client/websocket/handlers/GUILD_ROLE_DELETE.js +++ b/packages/discord.js/src/client/websocket/handlers/GUILD_ROLE_DELETE.js @@ -1,5 +1,14 @@ '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) => { client.actions.GuildRoleDelete.handle(packet.d); }; diff --git a/packages/discord.js/src/client/websocket/handlers/GUILD_ROLE_UPDATE.js b/packages/discord.js/src/client/websocket/handlers/GUILD_ROLE_UPDATE.js index 3a9b62e80..2466c4f02 100644 --- a/packages/discord.js/src/client/websocket/handlers/GUILD_ROLE_UPDATE.js +++ b/packages/discord.js/src/client/websocket/handlers/GUILD_ROLE_UPDATE.js @@ -1,5 +1,14 @@ '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) => { client.actions.GuildRoleUpdate.handle(packet.d); }; diff --git a/packages/discord.js/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_CREATE.js b/packages/discord.js/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_CREATE.js index 04ff2df82..3cf5847c7 100644 --- a/packages/discord.js/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_CREATE.js +++ b/packages/discord.js/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_CREATE.js @@ -1,5 +1,14 @@ '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) => { client.actions.GuildScheduledEventCreate.handle(packet.d); }; diff --git a/packages/discord.js/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_DELETE.js b/packages/discord.js/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_DELETE.js index b660c0966..5e73f76ef 100644 --- a/packages/discord.js/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_DELETE.js +++ b/packages/discord.js/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_DELETE.js @@ -1,5 +1,14 @@ '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) => { client.actions.GuildScheduledEventDelete.handle(packet.d); }; diff --git a/packages/discord.js/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_UPDATE.js b/packages/discord.js/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_UPDATE.js index 006470831..494a3fa02 100644 --- a/packages/discord.js/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_UPDATE.js +++ b/packages/discord.js/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_UPDATE.js @@ -1,5 +1,14 @@ '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) => { client.actions.GuildScheduledEventUpdate.handle(packet.d); }; diff --git a/packages/discord.js/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_USER_ADD.js b/packages/discord.js/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_USER_ADD.js index d5adca2cd..8cc0e071a 100644 --- a/packages/discord.js/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_USER_ADD.js +++ b/packages/discord.js/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_USER_ADD.js @@ -1,5 +1,14 @@ '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) => { client.actions.GuildScheduledEventUserAdd.handle(packet.d); }; diff --git a/packages/discord.js/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_USER_REMOVE.js b/packages/discord.js/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_USER_REMOVE.js index 114df6823..b7bf21659 100644 --- a/packages/discord.js/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_USER_REMOVE.js +++ b/packages/discord.js/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_USER_REMOVE.js @@ -1,5 +1,14 @@ '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) => { client.actions.GuildScheduledEventUserRemove.handle(packet.d); }; diff --git a/packages/discord.js/src/client/websocket/handlers/GUILD_STICKERS_UPDATE.js b/packages/discord.js/src/client/websocket/handlers/GUILD_STICKERS_UPDATE.js index e3aba61e5..8ce18ba1e 100644 --- a/packages/discord.js/src/client/websocket/handlers/GUILD_STICKERS_UPDATE.js +++ b/packages/discord.js/src/client/websocket/handlers/GUILD_STICKERS_UPDATE.js @@ -1,5 +1,14 @@ '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) => { client.actions.GuildStickersUpdate.handle(packet.d); }; diff --git a/packages/discord.js/src/client/websocket/handlers/GUILD_UPDATE.js b/packages/discord.js/src/client/websocket/handlers/GUILD_UPDATE.js index fd0012ad9..5bb296c9a 100644 --- a/packages/discord.js/src/client/websocket/handlers/GUILD_UPDATE.js +++ b/packages/discord.js/src/client/websocket/handlers/GUILD_UPDATE.js @@ -1,5 +1,14 @@ '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) => { client.actions.GuildUpdate.handle(packet.d); }; diff --git a/packages/discord.js/src/client/websocket/handlers/INTERACTION_CREATE.js b/packages/discord.js/src/client/websocket/handlers/INTERACTION_CREATE.js index 5bf30fcc7..69fbd03a3 100644 --- a/packages/discord.js/src/client/websocket/handlers/INTERACTION_CREATE.js +++ b/packages/discord.js/src/client/websocket/handlers/INTERACTION_CREATE.js @@ -1,5 +1,14 @@ '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) => { client.actions.InteractionCreate.handle(packet.d); }; diff --git a/packages/discord.js/src/client/websocket/handlers/INVITE_CREATE.js b/packages/discord.js/src/client/websocket/handlers/INVITE_CREATE.js index 50a2e72dd..0d5833110 100644 --- a/packages/discord.js/src/client/websocket/handlers/INVITE_CREATE.js +++ b/packages/discord.js/src/client/websocket/handlers/INVITE_CREATE.js @@ -1,5 +1,14 @@ '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) => { client.actions.InviteCreate.handle(packet.d); }; diff --git a/packages/discord.js/src/client/websocket/handlers/INVITE_DELETE.js b/packages/discord.js/src/client/websocket/handlers/INVITE_DELETE.js index 597185234..235217b20 100644 --- a/packages/discord.js/src/client/websocket/handlers/INVITE_DELETE.js +++ b/packages/discord.js/src/client/websocket/handlers/INVITE_DELETE.js @@ -1,5 +1,14 @@ '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) => { client.actions.InviteDelete.handle(packet.d); }; diff --git a/packages/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js b/packages/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js index c9b79a8fa..9035a8cae 100644 --- a/packages/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js +++ b/packages/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js @@ -1,5 +1,14 @@ '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) => { client.actions.MessageCreate.handle(packet.d); }; diff --git a/packages/discord.js/src/client/websocket/handlers/MESSAGE_DELETE.js b/packages/discord.js/src/client/websocket/handlers/MESSAGE_DELETE.js index 85ae2bc75..99c9a9b1f 100644 --- a/packages/discord.js/src/client/websocket/handlers/MESSAGE_DELETE.js +++ b/packages/discord.js/src/client/websocket/handlers/MESSAGE_DELETE.js @@ -1,5 +1,14 @@ '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) => { client.actions.MessageDelete.handle(packet.d); }; diff --git a/packages/discord.js/src/client/websocket/handlers/MESSAGE_DELETE_BULK.js b/packages/discord.js/src/client/websocket/handlers/MESSAGE_DELETE_BULK.js index fbcf80fd3..b48a124f5 100644 --- a/packages/discord.js/src/client/websocket/handlers/MESSAGE_DELETE_BULK.js +++ b/packages/discord.js/src/client/websocket/handlers/MESSAGE_DELETE_BULK.js @@ -1,5 +1,14 @@ '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) => { client.actions.MessageDeleteBulk.handle(packet.d); }; diff --git a/packages/discord.js/src/client/websocket/handlers/MESSAGE_POLL_VOTE_ADD.js b/packages/discord.js/src/client/websocket/handlers/MESSAGE_POLL_VOTE_ADD.js index 807597bbf..05b079ee2 100644 --- a/packages/discord.js/src/client/websocket/handlers/MESSAGE_POLL_VOTE_ADD.js +++ b/packages/discord.js/src/client/websocket/handlers/MESSAGE_POLL_VOTE_ADD.js @@ -1,5 +1,14 @@ '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) => { client.actions.MessagePollVoteAdd.handle(packet.d); }; diff --git a/packages/discord.js/src/client/websocket/handlers/MESSAGE_POLL_VOTE_REMOVE.js b/packages/discord.js/src/client/websocket/handlers/MESSAGE_POLL_VOTE_REMOVE.js index 3dee48432..9c88d96a3 100644 --- a/packages/discord.js/src/client/websocket/handlers/MESSAGE_POLL_VOTE_REMOVE.js +++ b/packages/discord.js/src/client/websocket/handlers/MESSAGE_POLL_VOTE_REMOVE.js @@ -1,5 +1,14 @@ '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) => { client.actions.MessagePollVoteRemove.handle(packet.d); }; diff --git a/packages/discord.js/src/client/websocket/handlers/MESSAGE_REACTION_ADD.js b/packages/discord.js/src/client/websocket/handlers/MESSAGE_REACTION_ADD.js index e219b4a52..e3fc997c3 100644 --- a/packages/discord.js/src/client/websocket/handlers/MESSAGE_REACTION_ADD.js +++ b/packages/discord.js/src/client/websocket/handlers/MESSAGE_REACTION_ADD.js @@ -1,5 +1,14 @@ '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) => { client.actions.MessageReactionAdd.handle(packet.d); }; diff --git a/packages/discord.js/src/client/websocket/handlers/MESSAGE_REACTION_REMOVE.js b/packages/discord.js/src/client/websocket/handlers/MESSAGE_REACTION_REMOVE.js index 2980e6954..a74afdfec 100644 --- a/packages/discord.js/src/client/websocket/handlers/MESSAGE_REACTION_REMOVE.js +++ b/packages/discord.js/src/client/websocket/handlers/MESSAGE_REACTION_REMOVE.js @@ -1,5 +1,14 @@ '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) => { client.actions.MessageReactionRemove.handle(packet.d); }; diff --git a/packages/discord.js/src/client/websocket/handlers/MESSAGE_REACTION_REMOVE_ALL.js b/packages/discord.js/src/client/websocket/handlers/MESSAGE_REACTION_REMOVE_ALL.js index ead80f755..2e268ca8b 100644 --- a/packages/discord.js/src/client/websocket/handlers/MESSAGE_REACTION_REMOVE_ALL.js +++ b/packages/discord.js/src/client/websocket/handlers/MESSAGE_REACTION_REMOVE_ALL.js @@ -1,5 +1,14 @@ '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) => { client.actions.MessageReactionRemoveAll.handle(packet.d); }; diff --git a/packages/discord.js/src/client/websocket/handlers/MESSAGE_REACTION_REMOVE_EMOJI.js b/packages/discord.js/src/client/websocket/handlers/MESSAGE_REACTION_REMOVE_EMOJI.js index 579444c97..5ffed0fd5 100644 --- a/packages/discord.js/src/client/websocket/handlers/MESSAGE_REACTION_REMOVE_EMOJI.js +++ b/packages/discord.js/src/client/websocket/handlers/MESSAGE_REACTION_REMOVE_EMOJI.js @@ -1,5 +1,14 @@ '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) => { client.actions.MessageReactionRemoveEmoji.handle(packet.d); }; diff --git a/packages/discord.js/src/client/websocket/handlers/MESSAGE_UPDATE.js b/packages/discord.js/src/client/websocket/handlers/MESSAGE_UPDATE.js index c2a470bf7..798a24e64 100644 --- a/packages/discord.js/src/client/websocket/handlers/MESSAGE_UPDATE.js +++ b/packages/discord.js/src/client/websocket/handlers/MESSAGE_UPDATE.js @@ -2,6 +2,15 @@ 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) => { const { old, updated } = client.actions.MessageUpdate.handle(packet.d); if (old && updated) { diff --git a/packages/discord.js/src/client/websocket/handlers/PRESENCE_UPDATE.js b/packages/discord.js/src/client/websocket/handlers/PRESENCE_UPDATE.js index bde36297d..05f8f34d7 100644 --- a/packages/discord.js/src/client/websocket/handlers/PRESENCE_UPDATE.js +++ b/packages/discord.js/src/client/websocket/handlers/PRESENCE_UPDATE.js @@ -1,5 +1,14 @@ '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) => { client.actions.PresenceUpdate.handle(packet.d); }; diff --git a/packages/discord.js/src/client/websocket/handlers/READY.js b/packages/discord.js/src/client/websocket/handlers/READY.js index 82da01cf7..cb921f19d 100644 --- a/packages/discord.js/src/client/websocket/handlers/READY.js +++ b/packages/discord.js/src/client/websocket/handlers/READY.js @@ -3,6 +3,17 @@ const ClientApplication = require('../../../structures/ClientApplication'); 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) => { if (client.user) { client.user._patch(data.user); diff --git a/packages/discord.js/src/client/websocket/handlers/RESUMED.js b/packages/discord.js/src/client/websocket/handlers/RESUMED.js index 27ed7ddc5..5ca446706 100644 --- a/packages/discord.js/src/client/websocket/handlers/RESUMED.js +++ b/packages/discord.js/src/client/websocket/handlers/RESUMED.js @@ -2,7 +2,18 @@ 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; /** * Emitted when a shard resumes successfully. diff --git a/packages/discord.js/src/client/websocket/handlers/STAGE_INSTANCE_CREATE.js b/packages/discord.js/src/client/websocket/handlers/STAGE_INSTANCE_CREATE.js index 77ae2ff3c..d9a8c9e12 100644 --- a/packages/discord.js/src/client/websocket/handlers/STAGE_INSTANCE_CREATE.js +++ b/packages/discord.js/src/client/websocket/handlers/STAGE_INSTANCE_CREATE.js @@ -1,5 +1,14 @@ '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) => { client.actions.StageInstanceCreate.handle(packet.d); }; diff --git a/packages/discord.js/src/client/websocket/handlers/STAGE_INSTANCE_DELETE.js b/packages/discord.js/src/client/websocket/handlers/STAGE_INSTANCE_DELETE.js index e2bb62750..f756a6dc4 100644 --- a/packages/discord.js/src/client/websocket/handlers/STAGE_INSTANCE_DELETE.js +++ b/packages/discord.js/src/client/websocket/handlers/STAGE_INSTANCE_DELETE.js @@ -1,5 +1,14 @@ '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) => { client.actions.StageInstanceDelete.handle(packet.d); }; diff --git a/packages/discord.js/src/client/websocket/handlers/STAGE_INSTANCE_UPDATE.js b/packages/discord.js/src/client/websocket/handlers/STAGE_INSTANCE_UPDATE.js index fabc84a63..e5f4c9091 100644 --- a/packages/discord.js/src/client/websocket/handlers/STAGE_INSTANCE_UPDATE.js +++ b/packages/discord.js/src/client/websocket/handlers/STAGE_INSTANCE_UPDATE.js @@ -1,5 +1,14 @@ '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) => { client.actions.StageInstanceUpdate.handle(packet.d); }; diff --git a/packages/discord.js/src/client/websocket/handlers/THREAD_CREATE.js b/packages/discord.js/src/client/websocket/handlers/THREAD_CREATE.js index d92cab057..2b6d9111f 100644 --- a/packages/discord.js/src/client/websocket/handlers/THREAD_CREATE.js +++ b/packages/discord.js/src/client/websocket/handlers/THREAD_CREATE.js @@ -1,5 +1,14 @@ '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) => { client.actions.ThreadCreate.handle(packet.d); }; diff --git a/packages/discord.js/src/client/websocket/handlers/THREAD_DELETE.js b/packages/discord.js/src/client/websocket/handlers/THREAD_DELETE.js index 1140a08e8..e4e2a8513 100644 --- a/packages/discord.js/src/client/websocket/handlers/THREAD_DELETE.js +++ b/packages/discord.js/src/client/websocket/handlers/THREAD_DELETE.js @@ -1,5 +1,14 @@ '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) => { client.actions.ThreadDelete.handle(packet.d); }; diff --git a/packages/discord.js/src/client/websocket/handlers/THREAD_LIST_SYNC.js b/packages/discord.js/src/client/websocket/handlers/THREAD_LIST_SYNC.js index 17b173adf..74c0677bc 100644 --- a/packages/discord.js/src/client/websocket/handlers/THREAD_LIST_SYNC.js +++ b/packages/discord.js/src/client/websocket/handlers/THREAD_LIST_SYNC.js @@ -1,5 +1,14 @@ '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) => { client.actions.ThreadListSync.handle(packet.d); }; diff --git a/packages/discord.js/src/client/websocket/handlers/THREAD_MEMBERS_UPDATE.js b/packages/discord.js/src/client/websocket/handlers/THREAD_MEMBERS_UPDATE.js index f3c7a738c..86fc8171f 100644 --- a/packages/discord.js/src/client/websocket/handlers/THREAD_MEMBERS_UPDATE.js +++ b/packages/discord.js/src/client/websocket/handlers/THREAD_MEMBERS_UPDATE.js @@ -1,5 +1,14 @@ '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) => { client.actions.ThreadMembersUpdate.handle(packet.d); }; diff --git a/packages/discord.js/src/client/websocket/handlers/THREAD_MEMBER_UPDATE.js b/packages/discord.js/src/client/websocket/handlers/THREAD_MEMBER_UPDATE.js index a111b0ac6..ec38d16b0 100644 --- a/packages/discord.js/src/client/websocket/handlers/THREAD_MEMBER_UPDATE.js +++ b/packages/discord.js/src/client/websocket/handlers/THREAD_MEMBER_UPDATE.js @@ -1,5 +1,14 @@ '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) => { client.actions.ThreadMemberUpdate.handle(packet.d); }; diff --git a/packages/discord.js/src/client/websocket/handlers/THREAD_UPDATE.js b/packages/discord.js/src/client/websocket/handlers/THREAD_UPDATE.js index 481dcd476..3d4c27ef5 100644 --- a/packages/discord.js/src/client/websocket/handlers/THREAD_UPDATE.js +++ b/packages/discord.js/src/client/websocket/handlers/THREAD_UPDATE.js @@ -2,6 +2,15 @@ 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) => { const { old, updated } = client.actions.ChannelUpdate.handle(packet.d); if (old && updated) { diff --git a/packages/discord.js/src/client/websocket/handlers/TYPING_START.js b/packages/discord.js/src/client/websocket/handlers/TYPING_START.js index 9a56a5458..20e839dac 100644 --- a/packages/discord.js/src/client/websocket/handlers/TYPING_START.js +++ b/packages/discord.js/src/client/websocket/handlers/TYPING_START.js @@ -1,5 +1,14 @@ '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) => { client.actions.TypingStart.handle(packet.d); }; diff --git a/packages/discord.js/src/client/websocket/handlers/USER_UPDATE.js b/packages/discord.js/src/client/websocket/handlers/USER_UPDATE.js index a02bf5887..ba56f3174 100644 --- a/packages/discord.js/src/client/websocket/handlers/USER_UPDATE.js +++ b/packages/discord.js/src/client/websocket/handlers/USER_UPDATE.js @@ -1,5 +1,14 @@ '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) => { client.actions.UserUpdate.handle(packet.d); }; diff --git a/packages/discord.js/src/client/websocket/handlers/VOICE_SERVER_UPDATE.js b/packages/discord.js/src/client/websocket/handlers/VOICE_SERVER_UPDATE.js index f9cf53433..90b26fe05 100644 --- a/packages/discord.js/src/client/websocket/handlers/VOICE_SERVER_UPDATE.js +++ b/packages/discord.js/src/client/websocket/handlers/VOICE_SERVER_UPDATE.js @@ -1,5 +1,14 @@ '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) => { client.emit('debug', `[VOICE] received voice server: ${JSON.stringify(packet)}`); client.voice.onVoiceServer(packet.d); diff --git a/packages/discord.js/src/client/websocket/handlers/VOICE_STATE_UPDATE.js b/packages/discord.js/src/client/websocket/handlers/VOICE_STATE_UPDATE.js index dbff6ea2d..46cfb5151 100644 --- a/packages/discord.js/src/client/websocket/handlers/VOICE_STATE_UPDATE.js +++ b/packages/discord.js/src/client/websocket/handlers/VOICE_STATE_UPDATE.js @@ -1,5 +1,14 @@ '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) => { client.actions.VoiceStateUpdate.handle(packet.d); }; diff --git a/packages/discord.js/src/client/websocket/handlers/WEBHOOKS_UPDATE.js b/packages/discord.js/src/client/websocket/handlers/WEBHOOKS_UPDATE.js index 46cacee0b..c52a320a8 100644 --- a/packages/discord.js/src/client/websocket/handlers/WEBHOOKS_UPDATE.js +++ b/packages/discord.js/src/client/websocket/handlers/WEBHOOKS_UPDATE.js @@ -1,5 +1,14 @@ '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) => { client.actions.WebhooksUpdate.handle(packet.d); }; diff --git a/packages/discord.js/tsconfig.json b/packages/discord.js/tsconfig.json index cc0e2b3db..a9ca6e58c 100644 --- a/packages/discord.js/tsconfig.json +++ b/packages/discord.js/tsconfig.json @@ -2,6 +2,9 @@ "$schema": "https://json.schemastore.org/tsconfig.json", "extends": "../../tsconfig.json", "compilerOptions": { + // Emit + "noEmit": true, + // Output Formatting "pretty": false, @@ -21,5 +24,7 @@ "undici", "@sapphire/snowflake" ] - } + }, + "include": ["typings", "scripts"], + "exclude": ["src/**/*.d.ts"] } diff --git a/packages/discord.js/tsconfig.typechecking.json b/packages/discord.js/tsconfig.typechecking.json new file mode 100644 index 000000000..e64965462 --- /dev/null +++ b/packages/discord.js/tsconfig.typechecking.json @@ -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"] +}