@discord-user-card/core
Version:
The core behind the Discord User Card project.
19 lines • 891 B
JavaScript
export function imageToUrl({ image, scope, animation = true, relatedId, }) {
const animatedPrefix = image.animated ? "a_" : "";
const animated = animation && image.animated;
switch (scope) {
case "avatar-decoration-presets": {
return `https://cdn.discordapp.com/${scope}/${animatedPrefix}${image.id}.png?passthrough=${animated ? "true" : "false"}`;
}
case "badge-icons":
case "embed/avatars":
return `https://cdn.discordapp.com/${scope}/${image.id}.png`;
default: {
if (!relatedId) {
return `https://cdn.discordapp.com/${scope}/${animatedPrefix}${image.id}.${animated ? "gif" : "webp"}`;
}
return `https://cdn.discordapp.com/${scope}/${relatedId}/${animatedPrefix}${image.id}.${animated ? "gif" : "webp"}`;
}
}
}
//# sourceMappingURL=imageToUrl.js.map