tiny-essentials
Version:
Collection of small, essential scripts designed to be used across various projects. These simple utilities are crafted for speed, ease of use, and versatility.
23 lines • 1.16 kB
text/typescript
/**
* Generates a random Discord avatar URL or returns a specified avatar URL based on the provided value.
* If no value is provided, a random avatar from the Discord CDN is selected.
*
* @function
* @param {string|number|null} [value=null] - The avatar number or string. If provided, it will return the avatar associated with that number or string.
* If no value is provided or the value is invalid, a random avatar will be generated.
* @param {string} [url='https://cdn.discordapp.com/embed/avatars/'] - The base URL for the Discord avatars. By default, it uses the CDN URL.
*
* @returns {string} The URL of the avatar image.
*
* @example
* // Returns a random avatar URL
* const avatarURL = randomAvatar();
* console.log(avatarURL); // Example output: https://cdn.discordapp.com/embed/avatars/1234.png
*
* @example
* // Returns a specific avatar URL based on the value
* const avatarURL = randomAvatar(2);
* console.log(avatarURL); // Example output: https://cdn.discordapp.com/embed/avatars/2.png
*/
export default function randomAvatar(value?: string | number | null, url?: string): string;
//# sourceMappingURL=randomAvatar.d.mts.map