discord-bot
discord-bot copied to clipboard
Embed Field Value Exceeds Limit Causing Crash
Overview
When a message is deleted or updated it triggers one of two handlers, these handlers take the contents of the original message and insert it into a field within an embed. However, the character limit of these fields is smaller than the limit of normal messages.
Expected Behaviour
A message containing more than 1024 characters gets trimmed to 1024 characters within the embed.
Actual Behaviour
A message containing more than 1024 characters causes the bot to crash.
2022-03-04T11:10:05.406066+00:00 app[worker.1]: DiscordAPIError: Invalid Form Body
2022-03-04T11:10:05.406066+00:00 app[worker.1]: embeds[0].fields[0].value: Must be 1024 or fewer in length.
2022-03-04T11:10:05.406067+00:00 app[worker.1]: at RequestHandler.execute (/app/node_modules/discord.js/src/rest/RequestHandler.js:350:13)
2022-03-04T11:10:05.406068+00:00 app[worker.1]: at processTicksAndRejections (node:internal/process/task_queues:96:5)
2022-03-04T11:10:05.406069+00:00 app[worker.1]: at async RequestHandler.push (/app/node_modules/discord.js/src/rest/RequestHandler.js:51:14)
2022-03-04T11:10:05.406070+00:00 app[worker.1]: at async TextChannel.send (/app/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:175:15)
2022-03-04T11:10:05.406070+00:00 app[worker.1]: at async Client.sendLog (/app/build/abstracts/LogMessageDeleteHandler.js:16:13)
2022-03-04T11:10:05.406070+00:00 app[worker.1]: at async Client.handle (/app/build/event/handlers/LogMessageSingleDeleteHandler.js:11:9)