discord.js 15.0.0-dev.1746576824-432cdbe88 → 15.0.0-dev.1746663224-f6da9495e

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "discord.js",
4
- "version": "15.0.0-dev.1746576824-432cdbe88",
4
+ "version": "15.0.0-dev.1746663224-f6da9495e",
5
5
  "description": "A powerful library for interacting with the Discord API",
6
6
  "main": "./src/index.js",
7
7
  "types": "./typings/index.d.ts",
@@ -23,7 +23,8 @@
23
23
  },
24
24
  "files": [
25
25
  "src",
26
- "typings"
26
+ "typings/*.d.ts",
27
+ "typings/*.d.mts"
27
28
  ],
28
29
  "contributors": [
29
30
  "Crawl <icrawltogo@gmail.com>",
@@ -60,12 +61,12 @@
60
61
  "magic-bytes.js": "^1.10.0",
61
62
  "tslib": "^2.8.1",
62
63
  "undici": "7.8.0",
64
+ "@discordjs/builders": "^1.11.1",
65
+ "@discordjs/formatters": "^0.6.1",
63
66
  "@discordjs/collection": "^2.1.1",
64
- "@discordjs/rest": "^2.5.0",
65
67
  "@discordjs/util": "^1.1.1",
66
- "@discordjs/formatters": "^0.6.1",
67
- "@discordjs/ws": "^2.0.2",
68
- "@discordjs/builders": "^1.11.1"
68
+ "@discordjs/rest": "^2.5.0",
69
+ "@discordjs/ws": "^2.0.2"
69
70
  },
70
71
  "devDependencies": {
71
72
  "@favware/cliff-jumper": "^4.1.0",
@@ -85,8 +86,8 @@
85
86
  "tslint": "6.1.3",
86
87
  "turbo": "^2.5.2",
87
88
  "typescript": "~5.8.3",
88
- "@discordjs/docgen": "^0.12.1",
89
89
  "@discordjs/api-extractor": "^7.38.1",
90
+ "@discordjs/docgen": "^0.12.1",
90
91
  "@discordjs/scripts": "^0.1.0"
91
92
  },
92
93
  "engines": {
@@ -27,7 +27,7 @@ class PartialGroupDMChannel extends BaseChannel {
27
27
  * The hash of the channel icon
28
28
  * @type {?string}
29
29
  */
30
- this.icon = data.icon;
30
+ this.icon = data.icon ?? null;
31
31
 
32
32
  /**
33
33
  * Recipient data received in a {@link PartialGroupDMChannel}.
@@ -39,7 +39,7 @@ class PartialGroupDMChannel extends BaseChannel {
39
39
  * The recipients of this Group DM Channel.
40
40
  * @type {PartialRecipient[]}
41
41
  */
42
- this.recipients = data.recipients;
42
+ this.recipients = data.recipients ?? [];
43
43
 
44
44
  /**
45
45
  * A manager of the messages belonging to this channel
@@ -68,30 +68,7 @@ const { ComponentType } = require('discord-api-types/v10');
68
68
  * @ignore
69
69
  */
70
70
  function createComponent(data) {
71
- if (data instanceof Component) {
72
- return data;
73
- }
74
-
75
- switch (data.type) {
76
- case ComponentType.ActionRow:
77
- return new ActionRow(data);
78
- case ComponentType.Button:
79
- return new ButtonComponent(data);
80
- case ComponentType.StringSelect:
81
- return new StringSelectMenuComponent(data);
82
- case ComponentType.TextInput:
83
- return new TextInputComponent(data);
84
- case ComponentType.UserSelect:
85
- return new UserSelectMenuComponent(data);
86
- case ComponentType.RoleSelect:
87
- return new RoleSelectMenuComponent(data);
88
- case ComponentType.MentionableSelect:
89
- return new MentionableSelectMenuComponent(data);
90
- case ComponentType.ChannelSelect:
91
- return new ChannelSelectMenuComponent(data);
92
- default:
93
- return new Component(data);
94
- }
71
+ return data instanceof Component ? data : new (ComponentTypeToClass[data.type] ?? Component)(data);
95
72
  }
96
73
 
97
74
  exports.createComponent = createComponent;
@@ -105,3 +82,14 @@ const { RoleSelectMenuComponent } = require('../structures/RoleSelectMenuCompone
105
82
  const { StringSelectMenuComponent } = require('../structures/StringSelectMenuComponent.js');
106
83
  const { TextInputComponent } = require('../structures/TextInputComponent.js');
107
84
  const { UserSelectMenuComponent } = require('../structures/UserSelectMenuComponent.js');
85
+
86
+ const ComponentTypeToClass = {
87
+ [ComponentType.ActionRow]: ActionRow,
88
+ [ComponentType.Button]: ButtonComponent,
89
+ [ComponentType.StringSelect]: StringSelectMenuComponent,
90
+ [ComponentType.TextInput]: TextInputComponent,
91
+ [ComponentType.UserSelect]: UserSelectMenuComponent,
92
+ [ComponentType.RoleSelect]: RoleSelectMenuComponent,
93
+ [ComponentType.MentionableSelect]: MentionableSelectMenuComponent,
94
+ [ComponentType.ChannelSelect]: ChannelSelectMenuComponent,
95
+ };