Fix annotations sending

This commit is contained in:
2022-03-12 15:31:54 +03:00
parent ac3302ba04
commit 924a57c09f
2 changed files with 3 additions and 3 deletions

View File

@@ -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 (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); 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 (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); const data = getTextPaginationData(`${CallbackData.AUTHOR_ANNOTATION_PREFIX}${authorId}`, annotation.text, 0);

View File

@@ -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<InlineKeyboardMarkup>} { export function getTextPaginationData(prefix: string, text: string, currentPage: number): {current: string, keyboard: Markup.Markup<InlineKeyboardMarkup>} {
const chunks = chunkText(text, 512); const chunks = chunkText(text, 512).filter((chunk) => chunk.length !== 0);
const current = chunks[currentPage]; const current = chunks[currentPage];