Make "Custom" embed for you and your server with Prefix Command! Try use !embed And it will show you how to edit the embed! If you done all, use !embed done And it will show you last work!
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
let reply = context.params.event.referenced_message;
let expic = `https://cdn.discordapp.com/avatars/859712287395807232/6a0030f875c4e9b158ea8131981f368d.png`;
await lib.discord.channels['@0.1.2'].messages.destroy({
message_id: `${context.params.event.id}`,
channel_id: `${context.params.event.channel_id}`,
});
if (!reply) {
await lib.discord.channels['@0.3.0'].messages.create({
"channel_id": `${context.params.event.channel_id}`,
"content": `<@${context.params.event.author.id}>\nReply this message & Use the command down below to make your embed!\n(if you don't want to use, just dont change it, it will remove itself if you done)\n\n\`!embed color [your color]\` (now is ff0000)\n\`!embed url [url]\` (now is https://google.com)\n\`!embed field add\` add new field\n\`!embed field delete\` delete last field\n\`!embed image [new image url]\` change image\n\`!embed thumbnail [new thumbnail url]\` change thumbnail\n\`!embed footer url [footer url]\`\n\n\`!embed done\` if you done all, use this command and it will ready for you!\n\n\n\n\n\`!embed content [content]\``,
"tts": false,
"embeds": [
{
"type": "rich",
"title": `!embed title [your title]`,
"description": `!embed description [your description]`,
"color": 0xff0000,
"fields": [
{
"name": `!embed field 1 name [name]`,
"value": `!embed field 1 value [value]`
}
],
"image": {
"url": `https://cdn.discordapp.com/avatars/859712287395807232/6a0030f875c4e9b158ea8131981f368d.png`,
"height": 0,
"width": 0
},
"thumbnail": {
"url": `https://cdn.discordapp.com/avatars/859712287395807232/6a0030f875c4e9b158ea8131981f368d.png`,
"height": 0,
"width": 0
},
"author": {
"name": `!embed author name [author name]`
},
"footer": {
"text": `!embed footer [footer]`,
"icon_url": `https://cdn.discordapp.com/avatars/859712287395807232/6a0030f875c4e9b158ea8131981f368d.png`
},
"url": `https://google.com`
}
]
});
} else if (reply.author.bot && reply.content.startsWith(`<@`) && reply.mentions[0].id == context.params.event.author.id) {
try {
let cmd = context.params.event.content
let embed = reply.embeds[0]
let content = reply.content;
if (cmd.split(` `)[1] == `content`) {
content = `<@${context.params.event.author.id}>\nReply this message & Use the command down below to make your embed!\n(if you don't want to use, just dont change it, it will remove itself if you done)\n\n\`!embed color [your color]\` (now is ff0000)\n\`!embed url [url]\` (now is https://google.com)\n\`!embed field add\` add new field\n\`!embed field delete\` delete last field\n\`!embed image [new image url]\` change image\n\`!embed thumbnail [new thumbnail url]\` change thumbnail\n\`!embed footer url [footer url]\`\n\n\`!embed done\` if you done all, use this command and it will ready for you!\n\n\n\n\n${cmd.substring(15)}`
} else if (cmd.split(` `)[1] == `author`) {
embed.author.name = cmd.substring(19)
} else if (cmd.split(` `)[1] == `description`) {
embed.description = cmd.substring(19)
} else if (cmd.split(` `)[1] == `title`) {
embed.title = cmd.substring(13)
} else if (cmd.split(` `)[1] == `url`) {
embed.url = cmd.split(` `)[2]
} else if (cmd.split(` `)[1] == `color`) {
embed.color = parseInt(cmd.split(` `)[2], 16)
} else if (cmd.split(` `)[1] == `field`) {
if (cmd.split(` `)[2] == `add`) {
embed.fields.push({value: `!embed field ${embed.fields.length+1} value [value]`,name: `!embed field ${embed.fields.length+1} name [name]`,inline: false})
} else if (cmd.split(` `)[2] == `delete`) {
embed.fields.pop()
} else {
if (cmd.split(` `)[3] == `name`) {
embed.fields[cmd.split(` `)[2]-1].name = cmd.substring(20)
}
if (cmd.split(` `)[3] == `value`) {
embed.fields[cmd.split(` `)[2]-1].value = cmd.substring(21)
}
}
} else if (cmd.split(` `)[1] == `image`) {
embed.image.url = cmd.split(` `)[2]
} else if (cmd.split(` `)[1] == `thumbnail`) {
embed.thumbnail.url = cmd.split(` `)[2]
} else if (cmd.split(` `)[1] == `footer`) {
if (cmd.split(` `)[2] == `url`) {
embed.footer.icon_url = cmd.split(` `)[3]
} else {
embed.footer.text = cmd.substring(14)
}
} else if (cmd.split(` `)[1] == `done`) {
content = content.split(`you!`)[1].substring(5)
if (content == `\`!embed content [content]\``) {
content = ``
}
if (embed.url == `https://google.com`) {
delete embed.url
}
if (embed.title == `!embed title [your title]`) {
delete embed.title
}
if (embed.thumbnail.url == expic) {
delete embed.thumbnail
}
if (embed.image.url == expic) {
delete embed.image
}
if (embed.footer.icon_url == expic) {
delete embed.footer.icon_url
}
if (embed.footer.text == `!embed footer [footer]`) {
delete embed.footer.text
}
if (!embed.footer.icon_url && !embed.footer.text) {
delete embed.footer
}
if (embed.description == `!embed description [your description]`) {
delete embed.description
}
if (embed.author.name == `!embed author name [author name]`) {
delete embed.author.name
}
for (let i = 0; i < embed.fields.length; i++) {
if (embed.fields[i].name == `!embed field ${i+1} name [name]`) {
embed.fields[i].name = ``
}
if (embed.fields[i].value == `!embed field ${i+1} value [value]`) {
embed.fields[i].value = ``
}
if (embed.fields[i].name == `` && embed.fields[i].value == ``) {
embed.fields.splice(i,1)
}
}
return lib.discord.channels['@0.3.0'].messages.update({
message_id: reply.id,
"channel_id": `${context.params.event.channel_id}`,
"content": content,
"tts": false,
"embeds": [embed]
});
} else {
return lib.discord.channels['@0.1.2'].messages.create({
channel_id: `${event.channel_id}`,
content: `Command not found. Please try again`,
});
}
await lib.discord.channels['@0.3.0'].messages.update({
message_id: reply.id,
"channel_id": `${context.params.event.channel_id}`,
"content": content,
"tts": false,
"embeds": [embed]
});
} catch (e) {
return lib.discord.channels['@0.1.2'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: `Something went wrong. Please try again`,
});
}
}