mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-21 16:55:03 +00:00
check lastEntry exists
This commit is contained in:
parent
098e57c645
commit
807e7c9ce8
1 changed files with 2 additions and 2 deletions
|
@ -110,11 +110,11 @@ export async function log<TLogType extends keyof ILogTypeData>(
|
|||
}
|
||||
} 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 });
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue