parent
0019147407
commit
956ee3abe1
@ -0,0 +1,122 @@ |
|||||||
|
const Discord = require('discord.js'); |
||||||
|
|
||||||
|
const {Pagination} = require('../../util/pagination'); |
||||||
|
|
||||||
|
module.exports = { |
||||||
|
name: "emoji", |
||||||
|
aliases: ['emote', 'emojiinfo', 'emoteinfo', 'ei'], |
||||||
|
meta: { |
||||||
|
category: 'Misc', |
||||||
|
description: "Get info on a certain emoji", |
||||||
|
syntax: '`emoji <:emoji:|emojiID>`', |
||||||
|
extra: null |
||||||
|
}, |
||||||
|
help: new Discord.MessageEmbed() |
||||||
|
.setTitle("Help -> Emoji") |
||||||
|
.setDescription("Get info on an emoji, such as its ID, name, and a link to the source image. You can also use this for the `robemoji` command to add an emoji by its ID.") |
||||||
|
.addField("Syntax", "`emoji <:emoji:|emojiID>`"), |
||||||
|
async execute(message, msg, args, cmd, prefix, mention, client) { |
||||||
|
if (!args.length) { |
||||||
|
if (!message.guild.id) {return message.channel.send(`Syntax: \`${prefix}emoji <:emoji:|emojiID>\``);} |
||||||
|
let emotes = []; |
||||||
|
Array.from(message.channel.messages.cache.values()).forEach(m => { |
||||||
|
let margs = m.content.split(/\s+/gm); |
||||||
|
margs.forEach(marg => {if (marg.match(/^<a?:.+:\d+>$/) && !emotes.includes(marg)) {emotes.push(marg);}}); |
||||||
|
if (m.reactions.cache.size) {Array.from(m.reactions.cache.values()).forEach(r => {if (r.emoji.id && !emotes.includes(`<${r.emoji.animated ? 'a' : ''}:${r.emoji.name}:${r.emoji.id}>`)) {emotes.push(`<${r.emoji.animated ? 'a' : ''}:${r.emoji.name}:${r.emoji.id}>`);}});} |
||||||
|
}); |
||||||
|
if (!emotes.length) {return message.channel.send("It doesn't look like anyone has sent any emoji recently. Try using the command again but adding an emoji to the message to get info on it.");} |
||||||
|
emotes.reverse(); |
||||||
|
let emoteEmbeds = []; |
||||||
|
emotes.forEach(emote => { |
||||||
|
let spl = emote.split(':'); |
||||||
|
let finEm = new Discord.MessageEmbed() |
||||||
|
.setTitle("Emoji Info") |
||||||
|
.setDescription(`Name: ${spl[1] ? `\`:${spl[1]}:\`` : "Not Found"}\nID: ${spl[2].slice(0, spl[2].length - 1)}\nURL: [Here](${`https://cdn.discordapp.com/emojis/${spl[2].slice(0, spl[2].length - 1)}${spl[0].includes('a') ? '.gif' : ""}`})\nAnimated: ${spl[0].includes('a') === true}\n\nI have access: ${client.emojis.cache.has(spl[2].slice(0, spl[2].length - 1))}`) |
||||||
|
.setColor('328ba8') |
||||||
|
.setImage(`https://cdn.discordapp.com/emojis/${spl[2].slice(0, spl[2].length - 1)}${spl[0].includes('a') ? '.gif' : ""}`) |
||||||
|
.setFooter("Luno", client.user.avatarURL()) |
||||||
|
.setTimestamp(); |
||||||
|
if (client.emojis.cache.has(spl[2].slice(0, spl[2].length - 1))) {finEm.setThumbnail(client.emojis.cache.get(spl[2].slice(0, spl[2].length - 1)).guild.iconURL({size: 1024}));} |
||||||
|
if (client.emojis.cache.has(spl[2].slice(0, spl[2].length - 1)) && client.emojis.cache.get(spl[2].slice(0, spl[2].length - 1)).guild.members.cache.has(message.author.id) && client.emojis.cache.get(spl[2].slice(0, spl[2].length - 1)).guild.id !== (message.guild ? message.guild.id : 1)) {finEm.addField("Server", `You're in the server this emoji is from: **${client.emojis.cache.get(spl[2].slice(0, spl[2].length - 1)).guild.name}**`);} |
||||||
|
emoteEmbeds.push(finEm); |
||||||
|
}); |
||||||
|
let emojiList = new Pagination(message.channel, emoteEmbeds, message, client, true); |
||||||
|
return emojiList.start({user: message.author.id, endTime: 60000}); |
||||||
|
} |
||||||
|
if (!args[0].match(/^<a?:.+:\d+>$|^\d+$/gm)) { |
||||||
|
if (args[0].length > 25) {return message.channel.send("That doesn't seem to be a valid emoji! (Standard Discord emojis don't count :p )");} |
||||||
|
let lookup = client.emojis.cache.filter(e => (args[0].length > 2 && e.name.toLowerCase().includes(args[0].toLowerCase())) || e.name.toLowerCase() === args[0].toLowerCase()); |
||||||
|
if (!lookup.size) {return message.channel.send("I tried to find some emojis that matched that name, but couldn't find anything. Maybe you didn't give an emoji to begin with?");} |
||||||
|
let emotes = Array.from(lookup.values()); |
||||||
|
if (lookup.size > 20) { |
||||||
|
let pages = []; |
||||||
|
let x = 0; |
||||||
|
while (true) { |
||||||
|
let cond = false; |
||||||
|
let page = ''; |
||||||
|
for (let i = 0; i < 20; i++) { |
||||||
|
if (emotes[(x * 20) + i] === undefined) {cond = true; break;} |
||||||
|
page += `<${emotes[(x * 20) + i].animated ? 'a' : ''}:${emotes[(x * 20) + i].name}:${emotes[(x * 20) + i].id}> \`:${emotes[(x * 20) + i].name}:\` -> ${emotes[(x * 20) + i].id}\n`; |
||||||
|
if ((x * 20) + i >= emotes.length) {cond = true; break;} |
||||||
|
} |
||||||
|
pages.push(new Discord.MessageEmbed() |
||||||
|
.setTitle(`Emoji Lookup Results [${(x * 20) + 1}-${(x * 20) + 20} of ${lookup.size}]`) |
||||||
|
.setDescription(page) |
||||||
|
.setColor('328ba8') |
||||||
|
.setFooter("Luno", client.user.avatarURL()) |
||||||
|
.setTimestamp() |
||||||
|
); |
||||||
|
if (cond) {break;} |
||||||
|
x++; |
||||||
|
} |
||||||
|
let emojiList = new Pagination(message.channel, pages, message, client, true); |
||||||
|
return emojiList.start({user: message.author.id, endTime: 60000}); |
||||||
|
} else { |
||||||
|
let page = ''; |
||||||
|
for (let i = 0; i < lookup.size; i++) {page += `<${emotes[i].animated ? 'a' : ''}:${emotes[i].name}:${emotes[i].id}> \`:${emotes[i].name}:\` -> ${emotes[i].id}\n`;} |
||||||
|
return message.channel.send(new Discord.MessageEmbed() |
||||||
|
.setTitle(`Emoji Lookup Results - ${lookup.size}`) |
||||||
|
.setDescription(page) |
||||||
|
.setColor('328ba8') |
||||||
|
.setFooter("Luno", client.user.avatarURL()) |
||||||
|
.setTimestamp() |
||||||
|
); |
||||||
|
} |
||||||
|
} |
||||||
|
let name; let id; let animated; let url; |
||||||
|
let access = false; |
||||||
|
if (args[0].match(/^<a?:.+:\d+>$/)) { |
||||||
|
let spl = args[0].split(':'); |
||||||
|
name = spl[1]; |
||||||
|
id = spl[2].slice(0, spl[2].length - 1); |
||||||
|
animated = spl[0].includes('a'); |
||||||
|
url = `https://cdn.discordapp.com/emojis/${id}`; |
||||||
|
access = client.emojis.cache.has(id); |
||||||
|
} else { |
||||||
|
id = args[0]; |
||||||
|
url = `https://cdn.discordapp.com/emojis/${id}`; |
||||||
|
access = client.emojis.cache.has(id); |
||||||
|
if (access) { |
||||||
|
name = client.emojis.cache.get(id).name; |
||||||
|
animated = client.emojis.cache.get(id).animated; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
if (animated) {url += '.gif';} |
||||||
|
|
||||||
|
try { |
||||||
|
let finEm = new Discord.MessageEmbed() |
||||||
|
.setTitle("Emoji Info") |
||||||
|
.setDescription(`Name: ${name ? `\`:${name}:\`` : "Not Found"}\nID: ${id}\nURL: [Here](${url})\nAnimated: ${animated === true}\n\nI have access: ${access}`) |
||||||
|
.setColor('328ba8') |
||||||
|
.setImage(url) |
||||||
|
.setFooter("Luno", client.user.avatarURL()) |
||||||
|
.setTimestamp(); |
||||||
|
if (access) {finEm.setThumbnail(client.emojis.cache.get(id).guild.iconURL({size: 1024}));} |
||||||
|
if (access && client.emojis.cache.get(id).guild.members.cache.has(message.author.id) && client.emojis.cache.get(id).guild.id !== (message.guild ? message.guild.id : 1)) {finEm.addField("Server", `You're in the server this emoji is from: **${client.emojis.cache.get(id).guild.name}**`);} |
||||||
|
return message.channel.send(finEm); |
||||||
|
} catch { |
||||||
|
return message.channel.send("There was an error getting info for that emoji. You may not have given a valid emoji, or the ID you gave doesn't lead to a real emoji."); |
||||||
|
} |
||||||
|
} |
||||||
|
}; |
@ -0,0 +1,74 @@ |
|||||||
|
const Discord = require('discord.js'); |
||||||
|
|
||||||
|
module.exports = { |
||||||
|
name: "robemote", |
||||||
|
aliases: ['robemoji', 're', 'stealemoji', 'stealemote', 'addemote', 'createemote', 'createemoji', 'addemoji', 'ae'], |
||||||
|
meta: { |
||||||
|
category: 'Utility', |
||||||
|
description: "Take any emote and instantly add it to your server!", |
||||||
|
syntax: '`robemote [emoji|url] [name]`', |
||||||
|
extra: null, |
||||||
|
guildOnly: true |
||||||
|
}, |
||||||
|
help: new Discord.MessageEmbed() |
||||||
|
.setTitle("Help -> Emoji Robbery") |
||||||
|
.setDescription("Takes an emoji and adds it to this server, if you have the permissions.") |
||||||
|
.addField("Syntax", "`robemote [emoji] [name]`"), |
||||||
|
async execute(message, msg, args, cmd, prefix, mention, client) { |
||||||
|
if (!message.member.permissions.has("MANAGE_EMOJIS")) {return message.channel.send("You must have permissions to manage emoji in this server.");} |
||||||
|
if (!message.guild.me.permissions.has("MANAGE_EMOJIS")) {return message.channel.send("I don't have permissions to manage emoji in this server, so I can't add any emotes.");} |
||||||
|
if (!args.length) { |
||||||
|
return message.channel.send(new Discord.MessageEmbed() |
||||||
|
.setTitle("Add Emoji") |
||||||
|
.setDescription("React to this message with the emoji you want to be added to the server.") |
||||||
|
.setFooter("This will time out in 60 seconds") |
||||||
|
.setColor('c375f0') |
||||||
|
).then(m => { |
||||||
|
const rc = m.createReactionCollector((r, u) => u.id === message.author.id, {time: 60000}); |
||||||
|
rc.on('collect', r => { |
||||||
|
rc.stop(); |
||||||
|
return message.guild.emojis.create(`https://cdn.discordapp.com/emojis/${r.emoji.id}`, r.emoji.name) |
||||||
|
.then(e => message.channel.send(new Discord.MessageEmbed() |
||||||
|
.setAuthor(message.member.displayName, message.author.avatarURL()) |
||||||
|
.setTitle("Emoji Created!") |
||||||
|
.setThumbnail(`https://cdn.discordapp.com/emojis/${e.id}${e.animated ? '.gif': ''}`) |
||||||
|
.setDescription(`Name: \`:${e.name}:\`\nID: ${e.id}\nURL: [Click Me](https://cdn.discordapp.com/emojis/${e.id})`) |
||||||
|
.setFooter("Luno") |
||||||
|
.setColor('328ba8') |
||||||
|
.setTimestamp() |
||||||
|
).then(() => require('../../util/ask')(message, "If you'd like to rename the emoji, send the name now. Otherwise, wait 30 seconds and nothing will happen.", 30000, false, false) |
||||||
|
.then(res => { |
||||||
|
if (res) { |
||||||
|
e.setName(res) |
||||||
|
.then(() => message.channel.send("Emoji successfully renamed!")) |
||||||
|
.catch(() => {return message.channel.send("For some reason, the emoji was not able to be renamed. Please do so manually");}); |
||||||
|
} |
||||||
|
}) |
||||||
|
)).catch(() => message.channel.send("<a:NC_x:717396078294597643> There was an error trying to create that emoji. I might not have permissions to add emoji, or the server may be at its emoji limit.")); |
||||||
|
}); |
||||||
|
rc.on('end', collected => {if (collected.size) {return m.delete().catch(() => {});} else {m.edit(m.embeds[0].setDescription(m.embeds[0].description + '\n\n*Timed out!*')).catch(() => {});}}); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
if (!args[0].match(/^<a?:.+:\d+>$|^https:\/\/.+$|^\d+$/)) {return message.channel.send("It doesn't look like you gave me a valid emoji to steal or a URL to make an emoji from.");} |
||||||
|
if (!args[1] && !args[0].match(/^<a?:.+:\d+>$/)) {return message.channel.send("You specified a URL/ID but didn't give an emoji name. Please try again and give the name you'd like to make the emoji.");} |
||||||
|
|
||||||
|
return message.guild.emojis.create( |
||||||
|
args[0].match(/^<a?:.+:\d+>$/)
|
||||||
|
? `https://cdn.discordapp.com/emojis/${args[0].split(':')[2].slice(0, args[0].split(':')[2].length - 1)}` |
||||||
|
: args[0].match(/^\d+$/) |
||||||
|
? `https://cdn.discordapp.com/emojis/${args[0]}` |
||||||
|
: args[0], |
||||||
|
args[1] || args[0].split(':')[1] |
||||||
|
).then(e => message.channel.send(new Discord.MessageEmbed() |
||||||
|
.setAuthor(message.member.displayName, message.author.avatarURL()) |
||||||
|
.setTitle("Emoji Created!") |
||||||
|
.setThumbnail(`https://cdn.discordapp.com/emojis/${e.id}${e.animated ? '.gif': ''}`) |
||||||
|
.setDescription(`Name: \`:${e.name}:\`\nID: ${e.id}\nURL: [Click Me](https://cdn.discordapp.com/emojis/${e.id}${e.animated ? '.gif': ''})`) |
||||||
|
.setFooter("Luno") |
||||||
|
.setColor('328ba8') |
||||||
|
.setTimestamp() |
||||||
|
)) |
||||||
|
.catch(() => message.channel.send("<a:NC_x:717396078294597643> There was an error trying to create that emoji. I might not have permissions to add emoji, the server may be at its emoji limit, you may have given a bad URL, not specified the emoji properly, or the file type in the URL you gave is invalid.")); |
||||||
|
} |
||||||
|
}; |
Loading…
Reference in new issue