This commit is contained in:
Daniel Odendahl Jr
2017-06-17 03:26:31 +00:00
parent 5bb78126a9
commit fd4e35533a
129 changed files with 322 additions and 319 deletions
+13 -13
View File
@@ -9,7 +9,7 @@ module.exports = class StarCommand extends Command {
name: 'star',
group: 'random',
memberName: 'star',
description: 'Stars a message.',
description: 'Stars a message, sending it to the starboard.',
args: [
{
key: 'id',
@@ -25,20 +25,13 @@ module.exports = class StarCommand extends Command {
async run(msg, args, reaction) {
const { id } = args;
const channel = msg.guild.channels.get(msg.guild.settings.get('starboard'));
if (!channel ||
!channel.permissionsFor(this.client.user).has('SEND_MESSAGES') ||
this.starred.includes(id)) return null;
if (!channel || this.starred.includes(id)) return null;
const message = await msg.channel.fetchMessage(id);
if (!reaction && msg.author.id === message.author.id) return msg.reply('You cannot star your own messages, baka.'); // eslint-disable-line max-len
if (!reaction && msg.author.id === message.author.id) return msg.reply('You cannot star your own messages.');
this.starred.push(id);
if (!channel.permissionsFor(this.client.user).has('EMBED_LINKS')) {
return msg.say(stripIndents`
**Author:** ${message.author.tag}
**Content:** ${message.content}
**Date:** ${moment(message.createdTimestamp).format('MMMM Do YYYY h:mm:ss A')}
${message.attachments.first() ? `**Image:** ${message.attachments.first().url}` : ''}
`);
} else {
if (!channel.permissionsFor(this.client.user).has('SEND_MESSAGES')) {
return msg.say('Could not send the message to the starboard.');
} else if (channel.permissionsFor(this.client.user).has('EMBED_LINKS')) {
const embed = new RichEmbed()
.setColor(0xFFFF00)
.setAuthor(message.author.tag, message.author.displayAvatarURL)
@@ -46,6 +39,13 @@ module.exports = class StarCommand extends Command {
.setImage(message.attachments.first() ? message.attachments.first().url : null)
.setFooter(moment(message.createdTimestamp).format('MMMM Do YYYY h:mm:ss A'));
return channel.send({ embed });
} else {
return msg.say(stripIndents`
**Author:** ${message.author.tag}
**Content:** ${message.content}
**Date:** ${moment(message.createdTimestamp).format('MMMM Do YYYY h:mm:ss A')}
${message.attachments.first() ? `**Image:** ${message.attachments.first().url}` : ''}
`);
}
}
};