mirror of
https://github.com/danbulant/Shasha
synced 2026-07-08 12:31:15 +00:00
emb
This commit is contained in:
parent
ffeb0b9a70
commit
81d44def40
1 changed files with 60 additions and 60 deletions
|
|
@ -11,7 +11,7 @@ module.exports = class embmaker extends commando.Command {
|
||||||
super(client, {
|
super(client, {
|
||||||
name: "embmaker",
|
name: "embmaker",
|
||||||
memberName: "embmaker",
|
memberName: "embmaker",
|
||||||
aliases: ["embed-maker","creat-emb","creat-embed"],
|
aliases: ["embed-maker", "creat-emb", "creat-embed", "embed"],
|
||||||
group: "utility",
|
group: "utility",
|
||||||
description: "Embed creator.",
|
description: "Embed creator.",
|
||||||
details:
|
details:
|
||||||
|
|
@ -40,7 +40,7 @@ module.exports = class embmaker extends commando.Command {
|
||||||
let embed = new MessageEmbed();
|
let embed = new MessageEmbed();
|
||||||
let autName, footertext, autIcon, autUrl, footericon, content, channel, editSrc, newAttach = [], reportMessage = "";
|
let autName, footertext, autIcon, autUrl, footericon, content, channel, editSrc, newAttach = [], reportMessage = "";
|
||||||
try {
|
try {
|
||||||
for(const value of args) {
|
for (const value of args) {
|
||||||
if (value.startsWith("j ")) {
|
if (value.startsWith("j ")) {
|
||||||
embed = new MessageEmbed(JSON.parse(value.slice("j ".length).trim()));
|
embed = new MessageEmbed(JSON.parse(value.slice("j ".length).trim()));
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -98,17 +98,17 @@ module.exports = class embmaker extends commando.Command {
|
||||||
if (quoteThis) {
|
if (quoteThis) {
|
||||||
const author = quoteThis.member;
|
const author = quoteThis.member;
|
||||||
autName = author ? author.displayName : quoteThis.author.username;
|
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;
|
autUrl = quoteThis.url;
|
||||||
embed
|
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)
|
.setDescription(quoteThis.content)
|
||||||
.setTimestamp(quoteThis.createdAt);
|
.setTimestamp(quoteThis.createdAt);
|
||||||
if (author && author.displayColor) {
|
if (author && author.displayColor) {
|
||||||
embed.setColor(author.displayColor);
|
embed.setColor(author.displayColor);
|
||||||
}
|
}
|
||||||
if (quoteThis.attachments) {
|
if (quoteThis.attachments) {
|
||||||
for(const attach of quoteThis.attachments) {
|
for (const attach of quoteThis.attachments) {
|
||||||
attach.map(g => {
|
attach.map(g => {
|
||||||
newAttach.push(g.proxyURL);
|
newAttach.push(g.proxyURL);
|
||||||
});
|
});
|
||||||
|
|
@ -125,7 +125,7 @@ module.exports = class embmaker extends commando.Command {
|
||||||
}
|
}
|
||||||
if (value.startsWith("r ")) {
|
if (value.startsWith("r ")) {
|
||||||
const r = value.slice("r ".length).toLowerCase().trim().split(/ +/);
|
const r = value.slice("r ".length).toLowerCase().trim().split(/ +/);
|
||||||
for(const remThis of r) {
|
for (const remThis of r) {
|
||||||
if (remThis === "f") {
|
if (remThis === "f") {
|
||||||
embed.fields = [];
|
embed.fields = [];
|
||||||
}
|
}
|
||||||
|
|
@ -144,20 +144,20 @@ module.exports = class embmaker extends commando.Command {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (value.startsWith("t ")) {
|
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));
|
embed.setTitle(isAdmin ? use : adCheck(use));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (value.startsWith("d ")) {
|
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));
|
embed.setDescription(isAdmin ? use : adCheck(use));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (value.startsWith("a ")) {
|
if (value.startsWith("a ")) {
|
||||||
const autData = parseDash(value);
|
const autData = parseDash(value);
|
||||||
for(const autVal of autData) {
|
for (const autVal of autData) {
|
||||||
if (autVal.startsWith("n ")) {
|
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);
|
autName = isAdmin ? use : adCheck(use);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -227,7 +227,7 @@ module.exports = class embmaker extends commando.Command {
|
||||||
}
|
}
|
||||||
if (value.startsWith("at ")) {
|
if (value.startsWith("at ")) {
|
||||||
const attach = value.slice("at ".length).trim().split(/ +/);
|
const attach = value.slice("at ".length).trim().split(/ +/);
|
||||||
for(const theFile of attach) {
|
for (const theFile of attach) {
|
||||||
if (reValidURL.test(theFile)) {
|
if (reValidURL.test(theFile)) {
|
||||||
newAttach.push(theFile);
|
newAttach.push(theFile);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -237,7 +237,7 @@ module.exports = class embmaker extends commando.Command {
|
||||||
}
|
}
|
||||||
if (theFile === "-c" && editSrc) {
|
if (theFile === "-c" && editSrc) {
|
||||||
if (editSrc.attachments[0].length > 0) {
|
if (editSrc.attachments[0].length > 0) {
|
||||||
for(const attach of editSrc.attachments) {
|
for (const attach of editSrc.attachments) {
|
||||||
attach.map(g => {
|
attach.map(g => {
|
||||||
newAttach.push(g.proxyURL);
|
newAttach.push(g.proxyURL);
|
||||||
});
|
});
|
||||||
|
|
@ -251,7 +251,7 @@ module.exports = class embmaker extends commando.Command {
|
||||||
}
|
}
|
||||||
if (value.startsWith("ti ")) {
|
if (value.startsWith("ti ")) {
|
||||||
const use = value.slice("ti ".length).trim();
|
const use = value.slice("ti ".length).trim();
|
||||||
if(!/\D/.test(use)) {
|
if (!/\D/.test(use)) {
|
||||||
embed.setTimestamp(parseInt(use, 10));
|
embed.setTimestamp(parseInt(use, 10));
|
||||||
} else {
|
} else {
|
||||||
if (use === "now") {
|
if (use === "now") {
|
||||||
|
|
@ -271,9 +271,9 @@ module.exports = class embmaker extends commando.Command {
|
||||||
}
|
}
|
||||||
if (value.startsWith("fo ")) {
|
if (value.startsWith("fo ")) {
|
||||||
const footerData = parseDash(value);
|
const footerData = parseDash(value);
|
||||||
for(const footval of footerData) {
|
for (const footval of footerData) {
|
||||||
if (footval.startsWith("t ")) {
|
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);
|
footertext = isAdmin ? use : adCheck(use);
|
||||||
}
|
}
|
||||||
if (footval.startsWith("i ")) {
|
if (footval.startsWith("i ")) {
|
||||||
|
|
@ -289,14 +289,14 @@ module.exports = class embmaker extends commando.Command {
|
||||||
}
|
}
|
||||||
if (value.startsWith("f ")) {
|
if (value.startsWith("f ")) {
|
||||||
const fieldData = parseDash(value);
|
const fieldData = parseDash(value);
|
||||||
let fieldName,fieldValue, inline = false;
|
let fieldName, fieldValue, inline = false;
|
||||||
for(const data of fieldData) {
|
for (const data of fieldData) {
|
||||||
if (data.startsWith("n ")) {
|
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);
|
fieldName = isAdmin ? use : adCheck(use);
|
||||||
}
|
}
|
||||||
if (data.startsWith("d ")) {
|
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);
|
fieldValue = isAdmin ? use : adCheck(use);
|
||||||
}
|
}
|
||||||
if (data[0] === "i") {
|
if (data[0] === "i") {
|
||||||
|
|
@ -313,7 +313,7 @@ module.exports = class embmaker extends commando.Command {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (value.startsWith("co ")) {
|
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);
|
content = isAdmin ? use : adCheck(use);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -339,7 +339,7 @@ module.exports = class embmaker extends commando.Command {
|
||||||
continue;
|
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) autName = "";
|
||||||
if (autName || autIcon && embed.author !== null) embed.setAuthor(autName, autIcon, autUrl);
|
if (autName || autIcon && embed.author !== null) embed.setAuthor(autName, autIcon, autUrl);
|
||||||
if (!footertext && footericon) footertext = "";
|
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 {
|
} else {
|
||||||
if (msg.guild) {
|
if (msg.guild) {
|
||||||
const c = msg.channel.permissionsFor(msg.author).serialize(),
|
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) {
|
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);
|
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, "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 {
|
} 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 {
|
} 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]) {
|
if (await sent[0]) {
|
||||||
tryReact(msg, "a:yesLife:794788847996370945");
|
tryReact(msg, "a:yesLife:794788847996370945");
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue