diff --git a/backend/src/plugins/Logs/util/log.ts b/backend/src/plugins/Logs/util/log.ts index 9092dfa9..c023f92e 100644 --- a/backend/src/plugins/Logs/util/log.ts +++ b/backend/src/plugins/Logs/util/log.ts @@ -110,11 +110,11 @@ export async function log( } } else { const msgEmbeds = msg.embeds; - const lastEntry = chunks[chunks.length - 1]; + const lastEntry = chunks.length > 0 ? chunks[chunks.length - 1] : null; if (!msgEmbeds || msgEmbeds.length === 0) continue; // check if the latest chunk is an embed, if not, make it one - if (typeof lastEntry !== "string" && lastEntry.embeds) { + if (typeof lastEntry !== "string" && lastEntry!.embeds) { (chunks[chunks.length - 1] as MessageOptions).embeds!.push(...msgEmbeds); } else { chunks.push({ embeds: msgEmbeds });