solara-testing-beta
Version:
A modern, customizable, and lightweight Discord framework.
31 lines • 942 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const discord_js_1 = require("discord.js");
exports.default = {
name: 'addTimestamp',
execute: async (ctx) => {
if (!ctx.embed) {
ctx.embed = new discord_js_1.EmbedBuilder();
}
const timestampArg = ctx.args[0];
let timestamp;
if (timestampArg) {
const parsed = parseInt(timestampArg, 10);
if (!isNaN(parsed)) {
timestamp = parsed;
}
else {
timestamp = new Date(timestampArg);
if (isNaN(timestamp.getTime())) {
throw new Error('Invalid timestamp provided to addTimestamp.');
}
}
}
else {
timestamp = Date.now();
}
ctx.embed.setTimestamp(timestamp);
return '';
},
};
//# sourceMappingURL=addTimestamp.js.map