@fluxerjs/core 1.0.9 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +203 -0
- package/dist/{Channel-ICWNKXBR.mjs → Channel-4WVFDOCG.mjs} +4 -1
- package/dist/{ClientUser-WWXUMO5O.mjs → ClientUser-PXAAKR2P.mjs} +1 -1
- package/dist/Guild-FMBCTAV4.mjs +12 -0
- package/dist/{GuildBan-M4PA3HAA.mjs → GuildBan-7CXLTPKY.mjs} +1 -1
- package/dist/GuildMember-43B5E5CH.mjs +9 -0
- package/dist/Message-OFIVTTAZ.mjs +9 -0
- package/dist/{MessageReaction-XRPYZDSC.mjs → MessageReaction-AYSOCOMX.mjs} +2 -1
- package/dist/{Role-SVLWIAMN.mjs → Role-5MWSGL66.mjs} +1 -1
- package/dist/Webhook-RWDDYW2Q.mjs +10 -0
- package/dist/{chunk-GCIJYVRC.mjs → chunk-4F765HVV.mjs} +54 -3
- package/dist/chunk-AH7KYH2Z.mjs +50 -0
- package/dist/{chunk-53Y37KRG.mjs → chunk-CJVQNARM.mjs} +44 -10
- package/dist/chunk-DQ4TNBPG.mjs +63 -0
- package/dist/chunk-DUQAD7F6.mjs +173 -0
- package/dist/chunk-FRVZ7D6D.mjs +293 -0
- package/dist/{chunk-HBF5QEDH.mjs → chunk-K6NLD6SB.mjs} +23 -1
- package/dist/chunk-PM2IUGNR.mjs +29 -0
- package/dist/chunk-RWFKZ3DF.mjs +413 -0
- package/dist/{chunk-RCP27MRC.mjs → chunk-UXIF75BV.mjs} +3 -0
- package/dist/chunk-V6T5VMWD.mjs +26 -0
- package/dist/{chunk-DSPSRPHF.mjs → chunk-V7LPVPGH.mjs} +123 -18
- package/dist/chunk-X6K3ZD62.mjs +53 -0
- package/dist/index.d.mts +603 -113
- package/dist/index.d.ts +603 -113
- package/dist/index.js +1335 -426
- package/dist/index.mjs +189 -125
- package/package.json +8 -8
- package/dist/Guild-TM6YGJWB.mjs +0 -10
- package/dist/GuildMember-RZWZ3OCG.mjs +0 -7
- package/dist/Message-6IYEYSV6.mjs +0 -7
- package/dist/Webhook-32VJD4AL.mjs +0 -7
- package/dist/chunk-FJS5FBXO.mjs +0 -233
- package/dist/chunk-GFUJVQ7L.mjs +0 -64
- package/dist/chunk-SQVCCSNN.mjs +0 -41
- package/dist/chunk-X77DFNE3.mjs +0 -136
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CDN_URL
|
|
3
|
+
} from "./chunk-HQMYRYMY.mjs";
|
|
4
|
+
|
|
5
|
+
// src/util/cdn.ts
|
|
6
|
+
function getExtension(hash, options) {
|
|
7
|
+
const ext = options?.extension ?? "png";
|
|
8
|
+
if (hash?.startsWith("a_")) return "gif";
|
|
9
|
+
return ext;
|
|
10
|
+
}
|
|
11
|
+
function appendSize(options) {
|
|
12
|
+
return options?.size ? `?size=${options.size}` : "";
|
|
13
|
+
}
|
|
14
|
+
function cdnAvatarURL(userId, avatarHash, options) {
|
|
15
|
+
if (!avatarHash) return null;
|
|
16
|
+
const ext = getExtension(avatarHash, options);
|
|
17
|
+
const size = appendSize(options);
|
|
18
|
+
return `${CDN_URL}/avatars/${userId}/${avatarHash}.${ext}${size}`;
|
|
19
|
+
}
|
|
20
|
+
function cdnDisplayAvatarURL(userId, avatarHash, options) {
|
|
21
|
+
return cdnAvatarURL(userId, avatarHash, options) ?? `${CDN_URL}/avatars/0/0.png`;
|
|
22
|
+
}
|
|
23
|
+
function cdnBannerURL(resourceId, bannerHash, options) {
|
|
24
|
+
if (!bannerHash) return null;
|
|
25
|
+
const ext = getExtension(bannerHash, options);
|
|
26
|
+
const size = appendSize(options);
|
|
27
|
+
return `${CDN_URL}/banners/${resourceId}/${bannerHash}.${ext}${size}`;
|
|
28
|
+
}
|
|
29
|
+
function cdnMemberAvatarURL(guildId, userId, avatarHash, options) {
|
|
30
|
+
if (!avatarHash) return null;
|
|
31
|
+
const ext = getExtension(avatarHash, options);
|
|
32
|
+
const size = appendSize(options);
|
|
33
|
+
return `${CDN_URL}/guilds/${guildId}/users/${userId}/avatars/${avatarHash}.${ext}${size}`;
|
|
34
|
+
}
|
|
35
|
+
function cdnMemberBannerURL(guildId, userId, bannerHash, options) {
|
|
36
|
+
if (!bannerHash) return null;
|
|
37
|
+
const ext = getExtension(bannerHash, options);
|
|
38
|
+
const size = appendSize(options);
|
|
39
|
+
return `${CDN_URL}/guilds/${guildId}/users/${userId}/banners/${bannerHash}.${ext}${size}`;
|
|
40
|
+
}
|
|
41
|
+
function cdnDefaultAvatarURL(discriminatorIndex) {
|
|
42
|
+
const index = discriminatorIndex != null ? discriminatorIndex % 5 : 0;
|
|
43
|
+
return `${CDN_URL}/avatars/0/${index}.png`;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export {
|
|
47
|
+
cdnAvatarURL,
|
|
48
|
+
cdnDisplayAvatarURL,
|
|
49
|
+
cdnBannerURL,
|
|
50
|
+
cdnMemberAvatarURL,
|
|
51
|
+
cdnMemberBannerURL,
|
|
52
|
+
cdnDefaultAvatarURL
|
|
53
|
+
};
|