discord.js 15.0.0-dev.1740701540-b6fda781c → 15.0.0-dev.1740744303-88bfeaab2

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.1740701540-b6fda781c",
4
+ "version": "15.0.0-dev.1740744303-88bfeaab2",
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",
@@ -61,10 +61,10 @@
61
61
  "tslib": "^2.8.1",
62
62
  "undici": "6.21.1",
63
63
  "@discordjs/collection": "^2.1.1",
64
- "@discordjs/formatters": "^0.5.0",
65
- "@discordjs/rest": "^2.4.0",
66
64
  "@discordjs/util": "^1.1.1",
67
- "@discordjs/ws": "^2.0.0"
65
+ "@discordjs/formatters": "^0.5.0",
66
+ "@discordjs/ws": "^2.0.0",
67
+ "@discordjs/rest": "^2.4.0"
68
68
  },
69
69
  "devDependencies": {
70
70
  "@favware/cliff-jumper": "^4.1.0",
@@ -192,17 +192,19 @@ class MessagePayload {
192
192
 
193
193
  let poll;
194
194
  if (this.options.poll) {
195
- poll = {
196
- question: {
197
- text: this.options.poll.question.text,
198
- },
199
- answers: this.options.poll.answers.map(answer => ({
200
- poll_media: { text: answer.text, emoji: resolvePartialEmoji(answer.emoji) },
201
- })),
202
- duration: this.options.poll.duration,
203
- allow_multiselect: this.options.poll.allowMultiselect,
204
- layout_type: this.options.poll.layoutType,
205
- };
195
+ poll = isJSONEncodable(this.options.poll)
196
+ ? this.options.poll.toJSON()
197
+ : {
198
+ question: {
199
+ text: this.options.poll.question.text,
200
+ },
201
+ answers: this.options.poll.answers.map(answer => ({
202
+ poll_media: { text: answer.text, emoji: resolvePartialEmoji(answer.emoji) },
203
+ })),
204
+ duration: this.options.poll.duration,
205
+ allow_multiselect: this.options.poll.allowMultiselect,
206
+ layout_type: this.options.poll.layoutType,
207
+ };
206
208
  }
207
209
 
208
210
  this.body = {
@@ -176,6 +176,7 @@ import {
176
176
  RESTAPIInteractionCallbackActivityInstanceResource,
177
177
  VoiceChannelEffectSendAnimationType,
178
178
  GatewayVoiceChannelEffectSendDispatchData,
179
+ RESTAPIPoll,
179
180
  } from 'discord-api-types/v10';
180
181
  import { ChildProcess } from 'node:child_process';
181
182
  import { Stream } from 'node:stream';
@@ -6352,7 +6353,7 @@ export interface BaseMessageOptions {
6352
6353
  }
6353
6354
 
6354
6355
  export interface BaseMessageOptionsWithPoll extends BaseMessageOptions {
6355
- poll?: PollData;
6356
+ poll?: JSONEncodable<RESTAPIPoll> | PollData;
6356
6357
  }
6357
6358
 
6358
6359
  export interface MessageCreateOptions extends BaseMessageOptionsWithPoll {
@@ -176,6 +176,7 @@ import {
176
176
  RESTAPIInteractionCallbackActivityInstanceResource,
177
177
  VoiceChannelEffectSendAnimationType,
178
178
  GatewayVoiceChannelEffectSendDispatchData,
179
+ RESTAPIPoll,
179
180
  } from 'discord-api-types/v10';
180
181
  import { ChildProcess } from 'node:child_process';
181
182
  import { Stream } from 'node:stream';
@@ -6352,7 +6353,7 @@ export interface BaseMessageOptions {
6352
6353
  }
6353
6354
 
6354
6355
  export interface BaseMessageOptionsWithPoll extends BaseMessageOptions {
6355
- poll?: PollData;
6356
+ poll?: JSONEncodable<RESTAPIPoll> | PollData;
6356
6357
  }
6357
6358
 
6358
6359
  export interface MessageCreateOptions extends BaseMessageOptionsWithPoll {