fix: guard against undefined footer before appending closed label

- MessageHandler pagination close handler was doing
  embed.footer.text += ... unconditionally — throws
  TypeError if the embed has no footer or footer.text
  is not a string
- Now checks embed.footer exists and footer.text is a
  string before appending; falls back to initialising
  footer with just the closed label if not
This commit is contained in:
NoLogicAlan committed 2026-05-10 19:29:18 +03:00
1 parent e11c29ed25
commit 0048a33099
1 file changed
+6 -1
+6 -1
View File
@@ -956,7 +956,12 @@ export class QueuePaginator {
const closeSession = async () => {
unobserve();
const embed = buildEmbed(state.page);
embed.footer.text += " • " + this._handler.t(guildId, "pagination.embed.sclosedTitle");
const closedLabel = this._handler.t(guildId, "pagination.embed.sclosedTitle");
if (embed.footer && typeof embed.footer.text === "string") {
embed.footer.text += " • " + closedLabel;
} else {
embed.footer = { text: closedLabel };
}
rawMsg.edit({ embeds: [embed] }).catch(() => {});
await clearReactions();
};