Fix annotations

This commit is contained in:
2022-02-04 12:09:28 +03:00
parent cf133f7291
commit 9fa6d425ed

View File

@@ -142,14 +142,16 @@ export async function createApprovedBot(token: string, state: BotState): Promise
const annotation = await BookLibrary.getBookAnnotation(parseInt(bookId));
const data = getTextPaginationData(`${CallbackData.BOOK_ANNOTATION_PREFIX}${bookId}`, annotation.text, 0);
if (annotation.file) {
const imageData = await downloadImage(annotation.file);
if (imageData) await ctx.telegram.sendPhoto(ctx.message.chat.id, {source: imageData});
}
if (!annotation.text) return;
const data = getTextPaginationData(`${CallbackData.BOOK_ANNOTATION_PREFIX}${bookId}`, annotation.text, 0);
try {
await ctx.reply(data.current, {
parse_mode: "HTML",
@@ -201,14 +203,16 @@ export async function createApprovedBot(token: string, state: BotState): Promise
const annotation = await BookLibrary.getAuthorAnnotation(parseInt(authorId));
const data = getTextPaginationData(`${CallbackData.AUTHOR_ANNOTATION_PREFIX}${authorId}`, annotation.text, 0);
if (annotation.file) {
const imageData = await downloadImage(annotation.file);
if (imageData) await ctx.telegram.sendPhoto(ctx.message.chat.id, {source: imageData});
}
if (!annotation.text) return;
const data = getTextPaginationData(`${CallbackData.AUTHOR_ANNOTATION_PREFIX}${authorId}`, annotation.text, 0);
try {
await ctx.reply(data.current, {
parse_mode: "HTML",