Skip to content

Commit

Permalink
fix(logs): handle messages over 1024 chars properly
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperchupuDev committed Dec 20, 2021
1 parent bcff72c commit 586059c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion detector/logger.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module.exports = async ({ client, message, member, reaction, type }) => {
const logs = client.db.prepare('SELECT logs FROM guilds WHERE id = ?').get(member.guild.id)?.logs;
const channel = member.guild.channels.cache.get(logs);
const content = message.content.length > 1024 ? `${message.content.substring(0, 1021).trimEnd()}...` : message.content;

const fields = [
{ name: 'Type', value: type },
Expand All @@ -11,7 +12,7 @@ module.exports = async ({ client, message, member, reaction, type }) => {
case 'Messaqe':
case 'Edited Messaqe':
fields.push({ name: 'Channel', value: `${message.channel} (${message.channelId})` });
fields.push({ name: 'Content', value: message.content });
fields.push({ name: 'Content', value: content });
break;

case 'Nickname':
Expand Down

0 comments on commit 586059c

Please sign in to comment.