mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
chore: Emit deprecation messages (#6994)
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
const { RangeError } = require('../errors');
|
||||
const Util = require('../util/Util');
|
||||
|
||||
let deprecationEmittedForSetAuthor = false;
|
||||
|
||||
/**
|
||||
* Represents an embed in a message (image/video preview, rich embed, etc.)
|
||||
*/
|
||||
@@ -372,6 +374,19 @@ class MessageEmbed {
|
||||
}
|
||||
|
||||
if (typeof options === 'string') {
|
||||
if (
|
||||
!deprecationEmittedForSetAuthor &&
|
||||
(typeof deprecatedIconURL !== 'undefined' || typeof deprecatedURL !== 'undefined')
|
||||
) {
|
||||
process.emitWarning(
|
||||
// eslint-disable-next-line max-len
|
||||
"Passing strings for the URL or the icon's URL for MessageEmbed#setAuthor is deprecated. Pass a sole object instead.",
|
||||
'DeprecationWarning',
|
||||
);
|
||||
|
||||
deprecationEmittedForSetAuthor = true;
|
||||
}
|
||||
|
||||
options = { name: options, url: deprecatedURL, iconURL: deprecatedIconURL };
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user