Star Command

This commit is contained in:
Daniel Odendahl Jr
2017-05-23 22:27:03 +00:00
parent 5b8d13c9b9
commit 8e25f7f95f
3 changed files with 49 additions and 13 deletions
+3 -12
View File
@@ -9,7 +9,6 @@ const client = new CommandoClient({
invite: INVITE,
unknownCommandResponse: false
});
const { RichEmbed } = require('discord.js');
const { carbon, dBots } = require('./structures/Stats');
const SequelizeProvider = require('./providers/Sequelize');
@@ -82,23 +81,15 @@ client.on('message', async (msg) => {
client.on('messageReactionAdd', (reaction, user) => {
if (reaction.emoji.name !== '⭐') return;
if (reaction.count > 1) return;
if (user.bot) return;
const msg = reaction.message;
const channel = msg.guild.channels.get(msg.guild.settings.get('starboard'));
const channel = msg.guild.settings.get('starboard');
if (!channel) return;
if (!channel.permissionsFor(client.user).has(['SEND_MESSAGES', 'EMBED_LINKS'])) return;
if (user.id === msg.author.id) {
if (msg.channel.permissionsFor(client.user).has('MANAGE_MESSAGES'))
reaction.remove(user);
return msg.reply('You cannot star your own messages, idiot.');
return msg.reply('You cannot star your own messages, idiot');
}
const embed = new RichEmbed()
.setColor(0xFFFF00)
.setAuthor(msg.author.tag, msg.author.displayAvatarURL)
.setDescription(msg.content)
.setImage(msg.attachments.first() ? msg.attachments.first().url : null)
.setTimestamp();
return channel.send({ embed });
client.registry.resolveCommand('random:starboard').run(msg, { id: msg.id }, true);
});
client.on('guildMemberAdd', (member) => {