Skip to content

Commit 62e31cb

Browse files
authored
fix(InteractionResponses): check if ephemeral message flag is used (#10021)
1 parent 941642a commit 62e31cb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/discord.js/src/structures/interfaces/InteractionResponses.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
const { isJSONEncodable } = require('@discordjs/util');
44
const { InteractionResponseType, MessageFlags, Routes, InteractionType } = require('discord-api-types/v10');
55
const { DiscordjsError, ErrorCodes } = require('../../errors');
6+
const MessageFlagsBitField = require('../../util/MessageFlagsBitField');
67
const InteractionCollector = require('../InteractionCollector');
78
const InteractionResponse = require('../InteractionResponse');
89
const MessagePayload = require('../MessagePayload');
@@ -100,14 +101,15 @@ class InteractionResponses {
100101
*/
101102
async reply(options) {
102103
if (this.deferred || this.replied) throw new DiscordjsError(ErrorCodes.InteractionAlreadyReplied);
103-
this.ephemeral = options.ephemeral ?? false;
104104

105105
let messagePayload;
106106
if (options instanceof MessagePayload) messagePayload = options;
107107
else messagePayload = MessagePayload.create(this, options);
108108

109109
const { body: data, files } = await messagePayload.resolveBody().resolveFiles();
110110

111+
this.ephemeral = new MessageFlagsBitField(data.flags).has(MessageFlags.Ephemeral);
112+
111113
await this.client.rest.post(Routes.interactionCallback(this.id, this.token), {
112114
body: {
113115
type: InteractionResponseType.ChannelMessageWithSource,

0 commit comments

Comments
 (0)