Compare commits
2 Commits
477d57d74c
...
98ccb87a14
| Author | SHA1 | Date | |
|---|---|---|---|
| 98ccb87a14 | |||
| 457efbeb4c |
2
discord/lib/util.d.ts
vendored
2
discord/lib/util.d.ts
vendored
@@ -1,5 +1,5 @@
|
|||||||
import { MessageEmbed } from 'discord.js';
|
import { MessageEmbed } from 'discord.js';
|
||||||
import { embedObject, basicObjectString } from '../../src/types';
|
import { basicObjectString, embedObject } from '../..';
|
||||||
/**
|
/**
|
||||||
* converts embedObj to Discord.MessageEmbed
|
* converts embedObj to Discord.MessageEmbed
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.embedObjEmbed = void 0;
|
exports.embedObjEmbed = void 0;
|
||||||
const discord_js_1 = require("discord.js");
|
const discord_js_1 = require("discord.js");
|
||||||
const util_1 = require("../../src/util");
|
const __1 = require("../..");
|
||||||
/**
|
/**
|
||||||
* converts embedObj to Discord.MessageEmbed
|
* converts embedObj to Discord.MessageEmbed
|
||||||
*/
|
*/
|
||||||
@@ -12,17 +12,17 @@ function embedObjEmbed(embedObj, args = {}) {
|
|||||||
let authorFix;
|
let authorFix;
|
||||||
if (typeof author === 'string')
|
if (typeof author === 'string')
|
||||||
authorFix = {
|
authorFix = {
|
||||||
name: (0, util_1.template)(author, args)
|
name: (0, __1.template)(author, args)
|
||||||
};
|
};
|
||||||
else {
|
else {
|
||||||
const { name, iconURL, url } = author;
|
const { name, iconURL, url } = author;
|
||||||
authorFix = {
|
authorFix = {
|
||||||
name: (0, util_1.template)(name, args)
|
name: (0, __1.template)(name, args)
|
||||||
};
|
};
|
||||||
if (iconURL !== undefined)
|
if (iconURL !== undefined)
|
||||||
authorFix.iconURL = (0, util_1.template)(iconURL, args);
|
authorFix.iconURL = (0, __1.template)(iconURL, args);
|
||||||
if (url !== undefined)
|
if (url !== undefined)
|
||||||
authorFix.url = (0, util_1.template)(url, args);
|
authorFix.url = (0, __1.template)(url, args);
|
||||||
}
|
}
|
||||||
embed.setAuthor(authorFix);
|
embed.setAuthor(authorFix);
|
||||||
}
|
}
|
||||||
@@ -30,39 +30,39 @@ function embedObjEmbed(embedObj, args = {}) {
|
|||||||
let footerFix;
|
let footerFix;
|
||||||
if (typeof footer === 'string') {
|
if (typeof footer === 'string') {
|
||||||
footerFix = {
|
footerFix = {
|
||||||
text: (0, util_1.template)(footer, args)
|
text: (0, __1.template)(footer, args)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const { text, iconURL } = footer;
|
const { text, iconURL } = footer;
|
||||||
footerFix = {
|
footerFix = {
|
||||||
text: (0, util_1.template)(text, args)
|
text: (0, __1.template)(text, args)
|
||||||
};
|
};
|
||||||
if (iconURL !== undefined)
|
if (iconURL !== undefined)
|
||||||
footerFix.iconURL = (0, util_1.template)(iconURL, args);
|
footerFix.iconURL = (0, __1.template)(iconURL, args);
|
||||||
}
|
}
|
||||||
embed.setFooter(footerFix);
|
embed.setFooter(footerFix);
|
||||||
}
|
}
|
||||||
if (color !== undefined)
|
if (color !== undefined)
|
||||||
embed.setColor((0, util_1.resolveColor)((0, util_1.template)(color, args)));
|
embed.setColor((0, __1.resolveColor)((0, __1.template)(color, args)));
|
||||||
if (description !== undefined)
|
if (description !== undefined)
|
||||||
embed.setDescription((0, util_1.template)((0, util_1.bigString)(description), args));
|
embed.setDescription((0, __1.template)((0, __1.bigString)(description), args));
|
||||||
if (image !== undefined)
|
if (image !== undefined)
|
||||||
embed.setImage((0, util_1.template)(image, args));
|
embed.setImage((0, __1.template)(image, args));
|
||||||
if (thumbnail !== undefined)
|
if (thumbnail !== undefined)
|
||||||
embed.setThumbnail((0, util_1.template)(thumbnail, args));
|
embed.setThumbnail((0, __1.template)(thumbnail, args));
|
||||||
if (title !== undefined)
|
if (title !== undefined)
|
||||||
embed.setTitle((0, util_1.template)(title, args));
|
embed.setTitle((0, __1.template)(title, args));
|
||||||
if (url !== undefined)
|
if (url !== undefined)
|
||||||
embed.setURL((0, util_1.template)(url, args));
|
embed.setURL((0, __1.template)(url, args));
|
||||||
if (timestamp === true)
|
if (timestamp === true)
|
||||||
embed.setTimestamp();
|
embed.setTimestamp();
|
||||||
else if (typeof timestamp === 'string')
|
else if (typeof timestamp === 'string')
|
||||||
embed.setTimestamp(new Date((0, util_1.template)(timestamp, args)));
|
embed.setTimestamp(new Date((0, __1.template)(timestamp, args)));
|
||||||
else if (timestamp !== false)
|
else if (timestamp !== false)
|
||||||
embed.setTimestamp(timestamp);
|
embed.setTimestamp(timestamp);
|
||||||
fields === null || fields === void 0 ? void 0 : fields.forEach(field => {
|
fields === null || fields === void 0 ? void 0 : fields.forEach(field => {
|
||||||
embed.addField((0, util_1.template)(field.name, args), (0, util_1.template)((0, util_1.bigString)(field.value), args), field.inline);
|
embed.addField((0, __1.template)(field.name, args), (0, __1.template)((0, __1.bigString)(field.value), args), field.inline);
|
||||||
});
|
});
|
||||||
return embed;
|
return embed;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { MessageEmbed } from 'discord.js';
|
import { MessageEmbed } from 'discord.js';
|
||||||
import { template, resolveColor, bigString } from '../../src/util';
|
import { authorData, basicObjectString, bigString, embedObject, footerData, resolveColor, template } from '../..';
|
||||||
import { embedObject, basicObjectString, authorData, footerData } from '../../src/types';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* converts embedObj to Discord.MessageEmbed
|
* converts embedObj to Discord.MessageEmbed
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"outDir": "./lib",
|
"outDir": "./lib",
|
||||||
|
"rootDir": "./src",
|
||||||
"strict": true
|
"strict": true
|
||||||
},
|
},
|
||||||
"include": ["src"],
|
"include": ["src"],
|
||||||
|
|||||||
Reference in New Issue
Block a user