mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 09:33:32 +01:00
feat(CDN): Support emoji size (#9787)
* feat(CDN): support emoji size * refactor: try to warn in all environments * feat: add prefix * refactor: better feedback message --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
@@ -59,3 +59,10 @@ export const OverwrittenMimeTypes = {
|
||||
} as const satisfies Readonly<Record<string, string>>;
|
||||
|
||||
export const BurstHandlerMajorIdKey = 'burst';
|
||||
|
||||
/**
|
||||
* Prefix for deprecation warnings.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
export const DEPRECATION_WARNING_PREFIX = 'DeprecationWarning' as const;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { RESTPatchAPIChannelJSONBody, Snowflake } from 'discord-api-types/v10';
|
||||
import type { REST } from '../REST.js';
|
||||
import { RateLimitError } from '../errors/RateLimitError.js';
|
||||
import { DEPRECATION_WARNING_PREFIX } from './constants.js';
|
||||
import { RequestMethod, type RateLimitData, type ResponseLike } from './types.js';
|
||||
|
||||
function serializeSearchParam(value: unknown): string | null {
|
||||
@@ -140,3 +141,18 @@ export async function sleep(ms: number): Promise<void> {
|
||||
export function isBufferLike(value: unknown): value is ArrayBuffer | Buffer | Uint8Array | Uint8ClampedArray {
|
||||
return value instanceof ArrayBuffer || value instanceof Uint8Array || value instanceof Uint8ClampedArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* Irrespective environment warning.
|
||||
*
|
||||
* @remarks Only the message is needed. The deprecation prefix is handled already.
|
||||
* @param message - A string the warning will emit with
|
||||
* @internal
|
||||
*/
|
||||
export function deprecationWarning(message: string) {
|
||||
if (typeof globalThis.process === 'undefined') {
|
||||
console.warn(`${DEPRECATION_WARNING_PREFIX}: ${message}`);
|
||||
} else {
|
||||
process.emitWarning(message, DEPRECATION_WARNING_PREFIX);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user