Don't log empty message edits
This commit is contained in:
parent
a5b8ba6478
commit
631584fa32
1 changed files with 3 additions and 6 deletions
|
@ -22,6 +22,7 @@ client.on('messageUpdate', async (message, oldMessage) => {
|
||||||
let channel = message.channel;
|
let channel = message.channel;
|
||||||
let server = channel?.server;
|
let server = channel?.server;
|
||||||
if (!server || !channel) return logger.warn('Received message update in unknown channel or server');
|
if (!server || !channel) return logger.warn('Received message update in unknown channel or server');
|
||||||
|
if (oldMsg == newMsg) return logger.info('Ignoring message update without edited text');
|
||||||
|
|
||||||
let config = await dbs.SERVERS.findOne({ id: server.id });
|
let config = await dbs.SERVERS.findOne({ id: server.id });
|
||||||
if (config?.logs?.messageUpdate) {
|
if (config?.logs?.messageUpdate) {
|
||||||
|
@ -30,9 +31,7 @@ client.on('messageUpdate', async (message, oldMessage) => {
|
||||||
title: `Message edited in ${server.name}`,
|
title: `Message edited in ${server.name}`,
|
||||||
description:
|
description:
|
||||||
`[#${channel.name}](/server/${server.id}/channel/${channel.id}) | ` +
|
`[#${channel.name}](/server/${server.id}/channel/${channel.id}) | ` +
|
||||||
`@${sanitizeMessageContent(
|
`<@${message.authorId}> | ` +
|
||||||
message.author?.username ?? "Unknown User"
|
|
||||||
)} (${message.authorId}) | ` +
|
|
||||||
`[Jump to message](/server/${server.id}/channel/${channel.id}/${message.id})`,
|
`[Jump to message](/server/${server.id}/channel/${channel.id}/${message.id})`,
|
||||||
fields: [],
|
fields: [],
|
||||||
color: "#829dff",
|
color: "#829dff",
|
||||||
|
@ -75,9 +74,7 @@ client.on('messageDelete', async (message) => {
|
||||||
let embed: LogMessage = {
|
let embed: LogMessage = {
|
||||||
title: `Message deleted in ${channel?.server?.name}`,
|
title: `Message deleted in ${channel?.server?.name}`,
|
||||||
description: `[#${channel.name}](/server/${channel.serverId}/channel/${channel.id}) | `
|
description: `[#${channel.name}](/server/${channel.serverId}/channel/${channel.id}) | `
|
||||||
+ `@${sanitizeMessageContent(
|
+ `<@${message.authorId}> | `
|
||||||
author?.username ?? "Unknown User"
|
|
||||||
)} (${message.authorId}) | `
|
|
||||||
+ `[\\[Jump to context\\]](/server/${channel.serverId}/channel/${channel.id}/${message.id})`,
|
+ `[\\[Jump to context\\]](/server/${channel.serverId}/channel/${channel.id}/${message.id})`,
|
||||||
fields: [],
|
fields: [],
|
||||||
color: '#ff6b6b',
|
color: '#ff6b6b',
|
||||||
|
|
Loading…
Reference in a new issue