diff --git a/src/bots/factory/bots/approved/index.ts b/src/bots/factory/bots/approved/index.ts index 777d42a..bddddc2 100644 --- a/src/bots/factory/bots/approved/index.ts +++ b/src/bots/factory/bots/approved/index.ts @@ -186,7 +186,7 @@ export async function createApprovedBot(token: string, state: BotState): Promise if (imageData) await ctx.telegram.sendPhoto(ctx.message.chat.id, {source: imageData}); } - if (!annotation.text) return; + if (annotation.text.length === 0) return; const data = getTextPaginationData(`${CallbackData.BOOK_ANNOTATION_PREFIX}${bookId}`, annotation.text, 0); @@ -249,7 +249,7 @@ export async function createApprovedBot(token: string, state: BotState): Promise if (imageData) await ctx.telegram.sendPhoto(ctx.message.chat.id, {source: imageData}); } - if (!annotation.text) return; + if (annotation.text.length === 0) return; const data = getTextPaginationData(`${CallbackData.AUTHOR_ANNOTATION_PREFIX}${authorId}`, annotation.text, 0); diff --git a/src/bots/factory/bots/approved/keyboard.ts b/src/bots/factory/bots/approved/keyboard.ts index ffa71b6..41621f8 100644 --- a/src/bots/factory/bots/approved/keyboard.ts +++ b/src/bots/factory/bots/approved/keyboard.ts @@ -47,7 +47,7 @@ export function getPaginationKeyboard(prefix: string, query: string | number, pa export function getTextPaginationData(prefix: string, text: string, currentPage: number): {current: string, keyboard: Markup.Markup} { - const chunks = chunkText(text, 512); + const chunks = chunkText(text, 512).filter((chunk) => chunk.length !== 0); const current = chunks[currentPage];