v3.0 #145

Merged
Vylpes merged 44 commits from develop into main 2022-04-24 14:46:37 +01:00
2 changed files with 1 additions and 37 deletions
Showing only changes of commit 45d871fbf7 - Show all commits

View file

@ -1,37 +0,0 @@
// Required components
const { event } = require('vylbot-core');
const { MessageEmbed } = require('discord.js');
// Event variables
const embedColor = "0x3050ba";
const logchannel = "message-logs";
// Event class
class messageupdate extends event {
constructor() {
// Set the event's run method
super("messageupdate");
}
// Run method
messageupdate(oldMessage, newMessage) {
// If the user is a bot or the content didn't change, return
if (newMessage.author.bot) return;
if (oldMessage.content == newMessage.content) return;
// Create an embed with the message's information
const embed = new MessageEmbed()
.setTitle("Message Edited")
.setColor(embedColor)
.addField("User", `${newMessage.author} \`${newMessage.author.tag}\``)
.addField("Channel", newMessage.channel)
.addField("Before", `\`\`\`${oldMessage.content || "*none*"}\`\`\``)
.addField("After", `\`\`\`${newMessage.content || "*none*"}\`\`\``)
.setThumbnail(newMessage.author.displayAvatarURL({ type: 'png', dynamic: true }));
// Send the embed into the log channel
newMessage.guild.channels.cache.find(channel => channel.name == logchannel).send(embed);
}
}
module.exports = messageupdate;

View file

@ -9,6 +9,7 @@ export default class MessageEvents extends Event {
public override messageDelete(message: Message) { public override messageDelete(message: Message) {
if (!message.guild) return; if (!message.guild) return;
if (message.author.bot) return;
const embed = new EventEmbed(message.guild, "Message Deleted"); const embed = new EventEmbed(message.guild, "Message Deleted");
embed.AddUser("User", message.author, true); embed.AddUser("User", message.author, true);