Skip to content
Snippets Groups Projects
Commit 3124a9e4 authored by Reviath's avatar Reviath
Browse files

Update commands/add-emote.js

parent 97f17963
No related branches found
No related tags found
No related merge requests found
const Discord = require("discord.js");
exports.run = async (client, message, args) => {
exports.run = async (client, message, args) => { let guildid = message.guild.id;
var sql = `SELECT dil FROM guilds WHERE guildid='${guildid}'`;
connection.query(sql, function (err, result) {
if(result == "tr"){
var url = "";
var name = "";
if (!message.member.hasPermission("MANAGE_EMOJIS"))
......@@ -30,6 +33,38 @@ exports.run = async (client, message, args) => {
.catch(e => {
client.channels.cache.get('790640302452375562').send(`Error on add-emote command \n${e}`)
});
} else {
var url = "";
var name = "";
if (!message.member.hasPermission("MANAGE_EMOJIS"))
return [message.channel.send(`To use this command, you must have manage emojis permission`)];
let emoji = args[0];
var emojiid = emoji.match(/\d/g);
emojiid = emojiid.join("");
var emote = Discord.Util.parseEmoji(emoji);
if (emote.animated === true) {
url = `https://cdn.discordapp.com/emojis/${emojiid}.gif`;
}
if (emote.animated === false) {
url = `https://cdn.discordapp.com/emojis/${emojiid}.png`;
}
if (!args[1]) {
name = emote.name;
} else {
name = args[1];
}
message.guild.emojis
.create(url, name)
.then((emoji) =>
message.channel.send(
`\`${emoji.name}\` named emote created (${emoji})`
)
)
.catch(e => {
client.channels.cache.get('790640302452375562').send(`Error on add-emote command \n${e}`)
});
}
)}
};
module.exports.help = {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment