mirror of
https://github.com/flibusta-apps/book_bot.git
synced 2025-12-06 07:25:36 +01:00
Fix annotations
This commit is contained in:
@@ -142,14 +142,16 @@ export async function createApprovedBot(token: string, state: BotState): Promise
|
|||||||
|
|
||||||
const annotation = await BookLibrary.getBookAnnotation(parseInt(bookId));
|
const annotation = await BookLibrary.getBookAnnotation(parseInt(bookId));
|
||||||
|
|
||||||
const data = getTextPaginationData(`${CallbackData.BOOK_ANNOTATION_PREFIX}${bookId}`, annotation.text, 0);
|
|
||||||
|
|
||||||
if (annotation.file) {
|
if (annotation.file) {
|
||||||
const imageData = await downloadImage(annotation.file);
|
const imageData = await downloadImage(annotation.file);
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
|
const data = getTextPaginationData(`${CallbackData.BOOK_ANNOTATION_PREFIX}${bookId}`, annotation.text, 0);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await ctx.reply(data.current, {
|
await ctx.reply(data.current, {
|
||||||
parse_mode: "HTML",
|
parse_mode: "HTML",
|
||||||
@@ -201,14 +203,16 @@ export async function createApprovedBot(token: string, state: BotState): Promise
|
|||||||
|
|
||||||
const annotation = await BookLibrary.getAuthorAnnotation(parseInt(authorId));
|
const annotation = await BookLibrary.getAuthorAnnotation(parseInt(authorId));
|
||||||
|
|
||||||
const data = getTextPaginationData(`${CallbackData.AUTHOR_ANNOTATION_PREFIX}${authorId}`, annotation.text, 0);
|
|
||||||
|
|
||||||
if (annotation.file) {
|
if (annotation.file) {
|
||||||
const imageData = await downloadImage(annotation.file);
|
const imageData = await downloadImage(annotation.file);
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
|
const data = getTextPaginationData(`${CallbackData.AUTHOR_ANNOTATION_PREFIX}${authorId}`, annotation.text, 0);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await ctx.reply(data.current, {
|
await ctx.reply(data.current, {
|
||||||
parse_mode: "HTML",
|
parse_mode: "HTML",
|
||||||
|
|||||||
Reference in New Issue
Block a user