mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-13 18:13:29 +01:00
refactor: deprecate v13 properties and methods (#7782)
* refactor: deprecate splitting * refactor: deprecate `IntegrationApplication#summary` https://github.com/discordjs/discord.js/pull/7729 * docs: amend store channel wording * refactor: deprecate fetching of application assets * docs: deprecate vip field in voice regions
This commit is contained in:
@@ -10,6 +10,7 @@ const { Error: DiscordError, RangeError, TypeError } = require('../errors');
|
||||
const has = (o, k) => Object.prototype.hasOwnProperty.call(o, k);
|
||||
const isObject = d => typeof d === 'object' && d !== null;
|
||||
|
||||
let deprecationEmittedForSplitMessage = false;
|
||||
let deprecationEmittedForRemoveMentions = false;
|
||||
|
||||
/**
|
||||
@@ -70,9 +71,19 @@ class Util extends null {
|
||||
* Splits a string into multiple chunks at a designated character that do not exceed a specific length.
|
||||
* @param {string} text Content to split
|
||||
* @param {SplitOptions} [options] Options controlling the behavior of the split
|
||||
* @deprecated This will be removed in the next major version.
|
||||
* @returns {string[]}
|
||||
*/
|
||||
static splitMessage(text, { maxLength = 2_000, char = '\n', prepend = '', append = '' } = {}) {
|
||||
if (!deprecationEmittedForSplitMessage) {
|
||||
process.emitWarning(
|
||||
'The Util.splitMessage method is deprecated and will be removed in the next major version.',
|
||||
'DeprecationWarning',
|
||||
);
|
||||
|
||||
deprecationEmittedForSplitMessage = true;
|
||||
}
|
||||
|
||||
text = Util.verifyString(text);
|
||||
if (text.length <= maxLength) return [text];
|
||||
let splitText = [text];
|
||||
|
||||
Reference in New Issue
Block a user