discord.js 15.0.0-dev.1734135151-35ebcc7d5 → 15.0.0-dev.1734567167-f1bce54a2

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.1734135151-35ebcc7d5",
4
+ "version": "15.0.0-dev.1734567167-f1bce54a2",
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",
@@ -60,8 +60,8 @@
60
60
  "lodash.snakecase": "4.1.1",
61
61
  "tslib": "^2.8.1",
62
62
  "undici": "6.21.0",
63
- "@discordjs/formatters": "^0.5.0",
64
63
  "@discordjs/rest": "^2.4.0",
64
+ "@discordjs/formatters": "^0.5.0",
65
65
  "@discordjs/util": "^1.1.1",
66
66
  "@discordjs/ws": "^2.0.0"
67
67
  },
@@ -80,8 +80,8 @@
80
80
  "tslint": "6.1.3",
81
81
  "turbo": "^2.3.0",
82
82
  "typescript": "~5.5.4",
83
- "@discordjs/api-extractor": "^7.38.1",
84
83
  "@discordjs/docgen": "^0.12.1",
84
+ "@discordjs/api-extractor": "^7.38.1",
85
85
  "@discordjs/scripts": "^0.1.0"
86
86
  },
87
87
  "engines": {
@@ -149,15 +149,12 @@ class MessagePayload {
149
149
 
150
150
  let flags;
151
151
  if (
152
- this.options.flags !== undefined ||
152
+ // eslint-disable-next-line eqeqeq
153
+ this.options.flags != null ||
153
154
  (this.isMessage && this.options.reply === undefined) ||
154
155
  this.isMessageManager
155
156
  ) {
156
- flags =
157
- // eslint-disable-next-line eqeqeq
158
- this.options.flags != null
159
- ? new MessageFlagsBitField(this.options.flags).bitfield
160
- : this.target.flags?.bitfield;
157
+ flags = new MessageFlagsBitField(this.options.flags).bitfield;
161
158
  }
162
159
 
163
160
  let allowedMentions =
@@ -4,6 +4,7 @@ const { makeURLSearchParams } = require('@discordjs/rest');
4
4
  const { isJSONEncodable } = require('@discordjs/util');
5
5
  const { InteractionResponseType, MessageFlags, Routes, InteractionType } = require('discord-api-types/v10');
6
6
  const { DiscordjsError, ErrorCodes } = require('../../errors');
7
+ const MessageFlagsBitField = require('../../util/MessageFlagsBitField');
7
8
  const InteractionCallbackResponse = require('../InteractionCallbackResponse');
8
9
  const InteractionCollector = require('../InteractionCollector');
9
10
  const InteractionResponse = require('../InteractionResponse');
@@ -75,11 +76,13 @@ class InteractionResponses {
75
76
  async deferReply(options = {}) {
76
77
  if (this.deferred || this.replied) throw new DiscordjsError(ErrorCodes.InteractionAlreadyReplied);
77
78
 
79
+ const resolvedFlags = new MessageFlagsBitField(options.flags);
80
+
78
81
  const response = await this.client.rest.post(Routes.interactionCallback(this.id, this.token), {
79
82
  body: {
80
83
  type: InteractionResponseType.DeferredChannelMessageWithSource,
81
84
  data: {
82
- flags: options.flags,
85
+ flags: resolvedFlags.bitfield,
83
86
  },
84
87
  },
85
88
  auth: false,
@@ -87,7 +90,7 @@ class InteractionResponses {
87
90
  });
88
91
 
89
92
  this.deferred = true;
90
- this.ephemeral = Boolean(options.flags & MessageFlags.Ephemeral);
93
+ this.ephemeral = resolvedFlags.has(MessageFlags.Ephemeral);
91
94
 
92
95
  return options.withResponse
93
96
  ? new InteractionCallbackResponse(this.client, response)
@@ -131,7 +134,7 @@ class InteractionResponses {
131
134
  query: makeURLSearchParams({ with_response: options.withResponse ?? false }),
132
135
  });
133
136
 
134
- this.ephemeral = Boolean(options.flags & MessageFlags.Ephemeral);
137
+ this.ephemeral = Boolean(data.flags & MessageFlags.Ephemeral);
135
138
  this.replied = true;
136
139
 
137
140
  return options.withResponse