This commit is contained in:
Neko Life 2021-06-27 18:54:30 +09:00
parent ffeb0b9a70
commit 81d44def40

View file

@ -11,7 +11,7 @@ module.exports = class embmaker extends commando.Command {
super(client, {
name: "embmaker",
memberName: "embmaker",
aliases: ["embed-maker","creat-emb","creat-embed"],
aliases: ["embed-maker", "creat-emb", "creat-embed", "embed"],
group: "utility",
description: "Embed creator.",
details:
@ -40,7 +40,7 @@ module.exports = class embmaker extends commando.Command {
let embed = new MessageEmbed();
let autName, footertext, autIcon, autUrl, footericon, content, channel, editSrc, newAttach = [], reportMessage = "";
try {
for(const value of args) {
for (const value of args) {
if (value.startsWith("j ")) {
embed = new MessageEmbed(JSON.parse(value.slice("j ".length).trim()));
continue;
@ -98,17 +98,17 @@ module.exports = class embmaker extends commando.Command {
if (quoteThis) {
const author = quoteThis.member;
autName = author ? author.displayName : quoteThis.author.username;
autIcon = quoteThis.author.displayAvatarURL({format: "png", size: 4096, dynamic: true});
autIcon = quoteThis.author.displayAvatarURL({ format: "png", size: 4096, dynamic: true });
autUrl = quoteThis.url;
embed
.setAuthor(author ? author.displayName : quoteThis.author.username,quoteThis.author.displayAvatarURL({format: "png", size: 128, dynamic: true}),quoteThis.url)
.setAuthor(author ? author.displayName : quoteThis.author.username, quoteThis.author.displayAvatarURL({ format: "png", size: 128, dynamic: true }), quoteThis.url)
.setDescription(quoteThis.content)
.setTimestamp(quoteThis.createdAt);
if (author && author.displayColor) {
embed.setColor(author.displayColor);
}
if (quoteThis.attachments) {
for(const attach of quoteThis.attachments) {
for (const attach of quoteThis.attachments) {
attach.map(g => {
newAttach.push(g.proxyURL);
});
@ -125,7 +125,7 @@ module.exports = class embmaker extends commando.Command {
}
if (value.startsWith("r ")) {
const r = value.slice("r ".length).toLowerCase().trim().split(/ +/);
for(const remThis of r) {
for (const remThis of r) {
if (remThis === "f") {
embed.fields = [];
}
@ -144,20 +144,20 @@ module.exports = class embmaker extends commando.Command {
continue;
}
if (value.startsWith("t ")) {
const use = emoteMessage(this.client, value.slice("t ".length).trim().replace(/\\(?!\\)/g,""));
const use = emoteMessage(this.client, value.slice("t ".length).trim().replace(/\\(?!\\)/g, ""));
embed.setTitle(isAdmin ? use : adCheck(use));
continue;
}
if (value.startsWith("d ")) {
const use = emoteMessage(this.client, value.slice("d ".length).trim().replace(/\\(?!\\)/g,""));
const use = emoteMessage(this.client, value.slice("d ".length).trim().replace(/\\(?!\\)/g, ""));
embed.setDescription(isAdmin ? use : adCheck(use));
continue;
}
if (value.startsWith("a ")) {
const autData = parseDash(value);
for(const autVal of autData) {
for (const autVal of autData) {
if (autVal.startsWith("n ")) {
const use = autVal.slice("n ".length).trim().replace(/\\(?!\\)/g,"");
const use = autVal.slice("n ".length).trim().replace(/\\(?!\\)/g, "");
autName = isAdmin ? use : adCheck(use);
continue;
}
@ -227,7 +227,7 @@ module.exports = class embmaker extends commando.Command {
}
if (value.startsWith("at ")) {
const attach = value.slice("at ".length).trim().split(/ +/);
for(const theFile of attach) {
for (const theFile of attach) {
if (reValidURL.test(theFile)) {
newAttach.push(theFile);
} else {
@ -237,7 +237,7 @@ module.exports = class embmaker extends commando.Command {
}
if (theFile === "-c" && editSrc) {
if (editSrc.attachments[0].length > 0) {
for(const attach of editSrc.attachments) {
for (const attach of editSrc.attachments) {
attach.map(g => {
newAttach.push(g.proxyURL);
});
@ -251,7 +251,7 @@ module.exports = class embmaker extends commando.Command {
}
if (value.startsWith("ti ")) {
const use = value.slice("ti ".length).trim();
if(!/\D/.test(use)) {
if (!/\D/.test(use)) {
embed.setTimestamp(parseInt(use, 10));
} else {
if (use === "now") {
@ -271,9 +271,9 @@ module.exports = class embmaker extends commando.Command {
}
if (value.startsWith("fo ")) {
const footerData = parseDash(value);
for(const footval of footerData) {
for (const footval of footerData) {
if (footval.startsWith("t ")) {
const use = emoteMessage(this.client, footval.slice("t ".length).trim().replace(/\\(?!\\)/g,""));
const use = emoteMessage(this.client, footval.slice("t ".length).trim().replace(/\\(?!\\)/g, ""));
footertext = isAdmin ? use : adCheck(use);
}
if (footval.startsWith("i ")) {
@ -289,14 +289,14 @@ module.exports = class embmaker extends commando.Command {
}
if (value.startsWith("f ")) {
const fieldData = parseDash(value);
let fieldName,fieldValue, inline = false;
for(const data of fieldData) {
let fieldName, fieldValue, inline = false;
for (const data of fieldData) {
if (data.startsWith("n ")) {
const use = emoteMessage(this.client, data.slice("n ".length).trim().replace(/\\(?!\\)/g,""));
const use = emoteMessage(this.client, data.slice("n ".length).trim().replace(/\\(?!\\)/g, ""));
fieldName = isAdmin ? use : adCheck(use);
}
if (data.startsWith("d ")) {
const use = emoteMessage(this.client, data.slice("d ".length).trim().replace(/\\(?!\\)/g,""));
const use = emoteMessage(this.client, data.slice("d ".length).trim().replace(/\\(?!\\)/g, ""));
fieldValue = isAdmin ? use : adCheck(use);
}
if (data[0] === "i") {
@ -313,7 +313,7 @@ module.exports = class embmaker extends commando.Command {
continue;
}
if (value.startsWith("co ")) {
const use = emoteMessage(this.client, value.slice("co ".length).trim().replace(/\\(?!\\)/g,""));
const use = emoteMessage(this.client, value.slice("co ".length).trim().replace(/\\(?!\\)/g, ""));
content = isAdmin ? use : adCheck(use);
continue;
}
@ -339,7 +339,7 @@ module.exports = class embmaker extends commando.Command {
continue;
}
}
if(autIcon === false && embed.author.name) delete embed.author.name;
if (autIcon === false && embed.author.name) delete embed.author.name;
if (!autName && autIcon) autName = "";
if (autName || autIcon && embed.author !== null) embed.setAuthor(autName, autIcon, autUrl);
if (!footertext && footericon) footertext = "";
@ -367,7 +367,7 @@ module.exports = class embmaker extends commando.Command {
}
}
}
sent.push(trySend(this.client, channel, {content:content,embed:embed,files:newAttach}));
sent.push(trySend(this.client, channel, { content: content, embed: embed, files: newAttach }));
} else {
if (msg.guild) {
const c = msg.channel.permissionsFor(msg.author).serialize(),
@ -380,13 +380,13 @@ module.exports = class embmaker extends commando.Command {
}
}
if (editSrc.author === this.client.user) {
sent.push(editSrc.edit({content:content,embed:embed,files:newAttach}).catch(e => {
sent.push(editSrc.edit({ content: content, embed: embed, files: newAttach }).catch(e => {
errLog(e, msg, this.client);
sent.push(trySend(this.client, msg, "Something\"s wrong, i can\"t edit that so here <:WhenLife:773061840351657984>"));
sent.push(trySend(this.client, msg, {content:content,embed:embed,files:newAttach}));
sent.push(trySend(this.client, msg, { content: content, embed: embed, files: newAttach }));
}));
} else {
sent.push(trySend(this.client, msg, {content:content,embed:embed,files:newAttach}));
sent.push(trySend(this.client, msg, { content: content, embed: embed, files: newAttach }));
}
}
} else {
@ -400,7 +400,7 @@ module.exports = class embmaker extends commando.Command {
}
}
}
sent.push(trySend(this.client, channel ?? msg.channel, {content:content, embed:embed, files:newAttach}).catch(e => noPerm(msg)));
sent.push(trySend(this.client, channel ?? msg.channel, { content: content, embed: embed, files: newAttach }).catch(e => noPerm(msg)));
}
if (await sent[0]) {
tryReact(msg, "a:yesLife:794788847996370945");