mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-18 20:43:30 +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 { RangeError, ErrorCodes } = require('../errors');
|
||||||
const DataResolver = require('../util/DataResolver');
|
const DataResolver = require('../util/DataResolver');
|
||||||
const MessageFlagsBitField = require('../util/MessageFlagsBitField');
|
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'));
|
const getBaseInteraction = lazy(() => require('./BaseInteraction'));
|
||||||
|
|
||||||
@@ -165,9 +165,8 @@ class MessagePayload {
|
|||||||
? this.target.client.options.allowedMentions
|
? this.target.client.options.allowedMentions
|
||||||
: this.options.allowedMentions;
|
: this.options.allowedMentions;
|
||||||
|
|
||||||
if (allowedMentions) {
|
if (typeof allowedMentions?.repliedUser !== 'undefined') {
|
||||||
allowedMentions = cloneObject(allowedMentions);
|
allowedMentions = { ...allowedMentions, replied_user: allowedMentions.repliedUser };
|
||||||
allowedMentions.replied_user = allowedMentions.repliedUser;
|
|
||||||
delete allowedMentions.repliedUser;
|
delete allowedMentions.repliedUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -266,16 +266,6 @@ function resolvePartialEmoji(emoji) {
|
|||||||
return { id, name, animated: Boolean(animated) };
|
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.
|
* Sets default properties on an object that aren't already specified.
|
||||||
* @param {Object} def Default properties
|
* @param {Object} def Default properties
|
||||||
@@ -568,7 +558,6 @@ module.exports = {
|
|||||||
fetchRecommendedShards,
|
fetchRecommendedShards,
|
||||||
parseEmoji,
|
parseEmoji,
|
||||||
resolvePartialEmoji,
|
resolvePartialEmoji,
|
||||||
cloneObject,
|
|
||||||
mergeDefault,
|
mergeDefault,
|
||||||
makeError,
|
makeError,
|
||||||
makePlainError,
|
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 basename(path: string, ext?: string): string;
|
||||||
export function cleanContent(str: string, channel: TextBasedChannel): 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 }>(
|
export function discordSort<K, V extends { rawPosition: number; id: Snowflake }>(
|
||||||
collection: Collection<K, V>,
|
collection: Collection<K, V>,
|
||||||
): Collection<K, V>;
|
): Collection<K, V>;
|
||||||
|
|||||||
Reference in New Issue
Block a user