aboutsummaryrefslogtreecommitdiff
path: root/events/messageUpdate.js
diff options
context:
space:
mode:
authorUnknown <jtsshieh@outlook.com>2018-02-24 14:21:11 -0500
committerUnknown <jtsshieh@outlook.com>2018-02-24 14:21:11 -0500
commitbc32800b67385cb773d65d4d8444f5f7df89e1c8 (patch)
tree7e23140998f32df2f44f52368e1946d6a8f605bb /events/messageUpdate.js
parent0af8a767a247212453a56baa29b51337b0d9b626 (diff)
downloadPokeBot-bc32800b67385cb773d65d4d8444f5f7df89e1c8.tar.gz
PokeBot-bc32800b67385cb773d65d4d8444f5f7df89e1c8.tar.bz2
PokeBot-bc32800b67385cb773d65d4d8444f5f7df89e1c8.zip
Part one of moving events to new file
Diffstat (limited to 'events/messageUpdate.js')
-rw-r--r--events/messageUpdate.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/events/messageUpdate.js b/events/messageUpdate.js
new file mode 100644
index 0000000..8be3f60
--- /dev/null
+++ b/events/messageUpdate.js
@@ -0,0 +1,18 @@
+module.exports = (bot, oldMsg, newMsg) => {
+ const { RichEmbed } = require('discord.js');
+ if (oldMsg.content == newMsg.content) return;
+ try {
+ const embed = new RichEmbed()
+ .setColor(0x00ae86)
+ .setTitle(`:pencil2: **${oldMsg.author.tag}**`)
+ .setDescription(`A message created by *${oldMsg.author.tag}* was edited in *${oldMsg.channel}*.`)
+ .addField('Old Message', oldMsg.content)
+ .addField('New Message', newMsg.content)
+ .setTimestamp()
+ .setFooter(`Edited message originally created by: ${oldMsg.author.tag}`, oldMsg.author.avatarURL);
+ newMsg.guild.channels.find('name', 'logs').send({ embed });
+ }
+ catch (err) {
+ console.error(err.stack);
+ }
+};