mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
fix(InteractionResponses): check if ephemeral message flag is used (#10021)
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
const { isJSONEncodable } = require('@discordjs/util');
|
||||
const { InteractionResponseType, MessageFlags, Routes, InteractionType } = require('discord-api-types/v10');
|
||||
const { DiscordjsError, ErrorCodes } = require('../../errors');
|
||||
const MessageFlagsBitField = require('../../util/MessageFlagsBitField');
|
||||
const InteractionCollector = require('../InteractionCollector');
|
||||
const InteractionResponse = require('../InteractionResponse');
|
||||
const MessagePayload = require('../MessagePayload');
|
||||
@@ -100,7 +101,6 @@ class InteractionResponses {
|
||||
*/
|
||||
async reply(options) {
|
||||
if (this.deferred || this.replied) throw new DiscordjsError(ErrorCodes.InteractionAlreadyReplied);
|
||||
this.ephemeral = options.ephemeral ?? false;
|
||||
|
||||
let messagePayload;
|
||||
if (options instanceof MessagePayload) messagePayload = options;
|
||||
@@ -108,6 +108,8 @@ class InteractionResponses {
|
||||
|
||||
const { body: data, files } = await messagePayload.resolveBody().resolveFiles();
|
||||
|
||||
this.ephemeral = new MessageFlagsBitField(data.flags).has(MessageFlags.Ephemeral);
|
||||
|
||||
await this.client.rest.post(Routes.interactionCallback(this.id, this.token), {
|
||||
body: {
|
||||
type: InteractionResponseType.ChannelMessageWithSource,
|
||||
|
||||
Reference in New Issue
Block a user