mirror of
https://github.com/yuzu-emu/Command-fix.git
synced 2024-11-25 14:55:38 +01:00
minor fixes to logging
This commit is contained in:
parent
5bfcbb3f62
commit
7ad84bd046
@ -35,9 +35,9 @@ function findArray (haystack, arr) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function IsIgnoredChannel (channelName) {
|
function IsIgnoredCategory (categoryName) {
|
||||||
const IgnoredChannels = ['welcome', 'announcements', 'media'];
|
const IgnoredCategory = ['welcome', 'team', 'website-team'];
|
||||||
return IgnoredChannels.includes(channelName);
|
return IgnoredCategory.includes(categoryName);
|
||||||
}
|
}
|
||||||
|
|
||||||
client.on('ready', () => {
|
client.on('ready', () => {
|
||||||
@ -72,7 +72,7 @@ client.on('guildMemberAdd', (member) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
client.on('messageDelete', message => {
|
client.on('messageDelete', message => {
|
||||||
if (IsIgnoredChannel(message.channel.name) == false) {
|
if (IsIgnoredCategory(message.channel.parent.name) == false) {
|
||||||
if (message.content && message.content.startsWith('.') == false && message.author.bot == false) {
|
if (message.content && message.content.startsWith('.') == false && message.author.bot == false) {
|
||||||
const deletionEmbed = new discord.RichEmbed()
|
const deletionEmbed = new discord.RichEmbed()
|
||||||
.setAuthor(message.author.tag, message.author.displayAvatarURL)
|
.setAuthor(message.author.tag, message.author.displayAvatarURL)
|
||||||
@ -88,21 +88,23 @@ client.on('messageDelete', message => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
client.on('messageUpdate', (oldMessage, newMessage) => {
|
client.on('messageUpdate', (oldMessage, newMessage) => {
|
||||||
if (IsIgnoredChannel(oldMessage.channel.name) == false) {
|
const AllowedRoles = ['Administrators', 'Moderators', 'Team', 'VIP'];
|
||||||
const oldM = oldMessage.cleanContent;
|
if (!findArray(oldMessage.member.roles.map(function (x) { return x.name; }), AllowedRoles)) {
|
||||||
const newM = newMessage.cleanContent;
|
if (IsIgnoredCategory(oldMessage.channel.parent.name) == false) {
|
||||||
|
const oldM = oldMessage.cleanContent;
|
||||||
|
const newM = newMessage.cleanContent;
|
||||||
|
if (oldMessage.content != newMessage.content && oldM && newM) {
|
||||||
|
const editedEmbed = new discord.RichEmbed()
|
||||||
|
.setAuthor(oldMessage.author.tag, oldMessage.author.displayAvatarURL)
|
||||||
|
.setDescription(`Message edited in ${oldMessage.channel} [Jump To Message](${newMessage.url})`)
|
||||||
|
.addField('Before', oldM, false)
|
||||||
|
.addField('After', newM, false)
|
||||||
|
.setTimestamp()
|
||||||
|
.setColor('GREEN');
|
||||||
|
|
||||||
if (oldM && newM) {
|
state.msglogChannel.send(editedEmbed);
|
||||||
const editedEmbed = new discord.RichEmbed()
|
logger.info(`${oldMessage.author.username} ${oldMessage.author} edited message from: ${oldM} to: ${newM}.`);
|
||||||
.setAuthor(oldMessage.author.tag, oldMessage.author.displayAvatarURL)
|
}
|
||||||
.setDescription(`Message edited in ${oldMessage.channel} [Jump To Message](${newMessage.url})`)
|
|
||||||
.addField('Before', oldM, false)
|
|
||||||
.addField('After', newM, false)
|
|
||||||
.setTimestamp()
|
|
||||||
.setColor('GREEN');
|
|
||||||
|
|
||||||
state.msglogChannel.send(editedEmbed);
|
|
||||||
logger.info(`${oldMessage.author.username} ${oldMessage.author} edited message from: ${oldM} to: ${newM}.`);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user