Discord.js v13.7
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];
|
||||
@@ -603,6 +614,17 @@ class Util extends null {
|
||||
filter.isDefault = true;
|
||||
return filter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves the maximum time a guild's thread channels should automatcally archive in case of no recent activity.
|
||||
* @param {Guild} guild The guild to resolve this limit from.
|
||||
* @returns {number}
|
||||
*/
|
||||
static resolveAutoArchiveMaxLimit({ features }) {
|
||||
if (features.includes('SEVEN_DAY_THREAD_ARCHIVE')) return 10080;
|
||||
if (features.includes('THREE_DAY_THREAD_ARCHIVE')) return 4320;
|
||||
return 1440;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Util;
|
||||
|
||||
Reference in New Issue
Block a user