Skip to content

Commit

Permalink
Loop correctly
Browse files Browse the repository at this point in the history
Also fix off-by-1 error
  • Loading branch information
Glazelf committed Jan 6, 2025
1 parent 9e0c048 commit 14293cf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion events/debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default async (client, info) => {
// Format strings
let description = info;
if (info.length > maxDescriptionLength) description = info.substring(0, maxDescriptionLength);
let debugInfoIndex = maxDescriptionLength + 1;
let debugInfoIndex = maxDescriptionLength;
// Channel
let debugChannel = client.channels.cache.get(debugChannelID);
if (!debugChannel) debugChannel = await client.channels.fetch(debugChannelID);
Expand All @@ -30,6 +30,7 @@ export default async (client, info) => {
let substringRequiredToFit = debugEmbed.length + fieldName.length + fieldValue.length - maxEmbedLength;
if (substringRequiredToFit > 0) fieldValue = fieldValue.substring(0, fieldValue.length - substringRequiredToFit);
debugEmbed.addFields([{ name: fieldName, value: fieldValue, inline: false }]);
debugInfoIndex += maxFieldValueLength;
};
// Send embed
return debugChannel.send({ embeds: [debugEmbed] });
Expand Down

0 comments on commit 14293cf

Please sign in to comment.