mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 16:43:31 +01:00
fix(MessagePayload): guard against repliedUser property (#8211)
This commit is contained in:
@@ -7,7 +7,7 @@ const ActionRowBuilder = require('./ActionRowBuilder');
|
||||
const { RangeError, ErrorCodes } = require('../errors');
|
||||
const DataResolver = require('../util/DataResolver');
|
||||
const MessageFlagsBitField = require('../util/MessageFlagsBitField');
|
||||
const { basename, cloneObject, verifyString, lazy } = require('../util/Util');
|
||||
const { basename, verifyString, lazy } = require('../util/Util');
|
||||
|
||||
const getBaseInteraction = lazy(() => require('./BaseInteraction'));
|
||||
|
||||
@@ -165,9 +165,8 @@ class MessagePayload {
|
||||
? this.target.client.options.allowedMentions
|
||||
: this.options.allowedMentions;
|
||||
|
||||
if (allowedMentions) {
|
||||
allowedMentions = cloneObject(allowedMentions);
|
||||
allowedMentions.replied_user = allowedMentions.repliedUser;
|
||||
if (typeof allowedMentions?.repliedUser !== 'undefined') {
|
||||
allowedMentions = { ...allowedMentions, replied_user: allowedMentions.repliedUser };
|
||||
delete allowedMentions.repliedUser;
|
||||
}
|
||||
|
||||
|
||||
@@ -266,16 +266,6 @@ function resolvePartialEmoji(emoji) {
|
||||
return { id, name, animated: Boolean(animated) };
|
||||
}
|
||||
|
||||
/**
|
||||
* Shallow-copies an object with its class/prototype intact.
|
||||
* @param {Object} obj Object to clone
|
||||
* @returns {Object}
|
||||
* @private
|
||||
*/
|
||||
function cloneObject(obj) {
|
||||
return Object.assign(Object.create(obj), obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets default properties on an object that aren't already specified.
|
||||
* @param {Object} def Default properties
|
||||
@@ -568,7 +558,6 @@ module.exports = {
|
||||
fetchRecommendedShards,
|
||||
parseEmoji,
|
||||
resolvePartialEmoji,
|
||||
cloneObject,
|
||||
mergeDefault,
|
||||
makeError,
|
||||
makePlainError,
|
||||
|
||||
1
packages/discord.js/typings/index.d.ts
vendored
1
packages/discord.js/typings/index.d.ts
vendored
@@ -2628,7 +2628,6 @@ export class UserFlagsBitField extends BitField<UserFlagsString> {
|
||||
|
||||
export function basename(path: string, ext?: string): string;
|
||||
export function cleanContent(str: string, channel: TextBasedChannel): string;
|
||||
export function cloneObject(obj: unknown): unknown;
|
||||
export function discordSort<K, V extends { rawPosition: number; id: Snowflake }>(
|
||||
collection: Collection<K, V>,
|
||||
): Collection<K, V>;
|
||||
|
||||
Reference in New Issue
Block a user