@impulsedev/chameleon 1.6.0 → 1.7.0
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/dist/index.js +29 -17
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1215,7 +1215,7 @@ var ChameleonGateway = class {
|
|
|
1215
1215
|
// package.json
|
|
1216
1216
|
var package_default = {
|
|
1217
1217
|
name: "@impulsedev/chameleon",
|
|
1218
|
-
version: "1.
|
|
1218
|
+
version: "1.7.0",
|
|
1219
1219
|
description: "highly optimized, memory-efficient, and fully type-safe Discord API library",
|
|
1220
1220
|
main: "dist/index.js",
|
|
1221
1221
|
types: "dist/index.d.ts",
|
|
@@ -1369,27 +1369,39 @@ var EmbedBuilder = class {
|
|
|
1369
1369
|
toJSON() {
|
|
1370
1370
|
const e = this.data;
|
|
1371
1371
|
const payload = {};
|
|
1372
|
-
if (e.title) payload.title = e.title;
|
|
1373
|
-
if (e.description) payload.description = e.description;
|
|
1374
|
-
if (e.color) payload.color = e.color;
|
|
1375
|
-
if (e.url) payload.url = e.url;
|
|
1376
|
-
if (e.timestamp) {
|
|
1372
|
+
if (typeof e.title === "string") payload.title = e.title;
|
|
1373
|
+
if (typeof e.description === "string") payload.description = e.description;
|
|
1374
|
+
if (typeof e.color === "number") payload.color = e.color;
|
|
1375
|
+
if (typeof e.url === "string") payload.url = e.url;
|
|
1376
|
+
if (typeof e.timestamp === "number" && !Number.isNaN(e.timestamp)) {
|
|
1377
1377
|
payload.timestamp = new Date(e.timestamp).toISOString();
|
|
1378
1378
|
}
|
|
1379
1379
|
if (e.author) {
|
|
1380
|
-
|
|
1381
|
-
name: e.author.name
|
|
1382
|
-
...e.author.url ? { url: e.author.url } : {},
|
|
1383
|
-
...e.author.iconUrl ? { icon_url: e.author.iconUrl } : {},
|
|
1384
|
-
...e.author.proxyIconUrl ? { proxy_icon_url: e.author.proxyIconUrl } : {}
|
|
1380
|
+
const author = {
|
|
1381
|
+
name: e.author.name
|
|
1385
1382
|
};
|
|
1383
|
+
if (typeof e.author.url === "string") {
|
|
1384
|
+
author.url = e.author.url;
|
|
1385
|
+
}
|
|
1386
|
+
if (typeof e.author.iconUrl === "string") {
|
|
1387
|
+
author.icon_url = e.author.iconUrl;
|
|
1388
|
+
}
|
|
1389
|
+
if (typeof e.author.proxyIconUrl === "string") {
|
|
1390
|
+
author.proxy_icon_url = e.author.proxyIconUrl;
|
|
1391
|
+
}
|
|
1392
|
+
payload.author = author;
|
|
1386
1393
|
}
|
|
1387
1394
|
if (e.footer) {
|
|
1388
|
-
|
|
1389
|
-
text: e.footer.text
|
|
1390
|
-
...e.footer.iconUrl ? { icon_url: e.footer.iconUrl } : {},
|
|
1391
|
-
...e.footer.proxyIconUrl ? { proxy_icon_url: e.footer.proxyIconUrl } : {}
|
|
1395
|
+
const footer = {
|
|
1396
|
+
text: e.footer.text
|
|
1392
1397
|
};
|
|
1398
|
+
if (typeof e.footer.iconUrl === "string") {
|
|
1399
|
+
footer.icon_url = e.footer.iconUrl;
|
|
1400
|
+
}
|
|
1401
|
+
if (typeof e.footer.proxyIconUrl === "string") {
|
|
1402
|
+
footer.proxy_icon_url = e.footer.proxyIconUrl;
|
|
1403
|
+
}
|
|
1404
|
+
payload.footer = footer;
|
|
1393
1405
|
}
|
|
1394
1406
|
if (e.image?.url) {
|
|
1395
1407
|
payload.image = {
|
|
@@ -1401,11 +1413,11 @@ var EmbedBuilder = class {
|
|
|
1401
1413
|
url: e.thumbnail.url
|
|
1402
1414
|
};
|
|
1403
1415
|
}
|
|
1404
|
-
if (e.fields
|
|
1416
|
+
if (Array.isArray(e.fields) && e.fields.length > 0) {
|
|
1405
1417
|
payload.fields = e.fields.map((f) => ({
|
|
1406
1418
|
name: f.name,
|
|
1407
1419
|
value: f.value,
|
|
1408
|
-
inline: f.inline
|
|
1420
|
+
inline: !!f.inline
|
|
1409
1421
|
}));
|
|
1410
1422
|
}
|
|
1411
1423
|
return payload;
|