fix: bot sent caption without content from cache
This commit is contained in:
parent
816eca4da5
commit
f48230cbeb
@ -37,22 +37,24 @@ feature.on('message:text', logHandle('download-message'), async (context) => {
|
||||
return context.reply(context.t('err-invalid-url'));
|
||||
}
|
||||
|
||||
// Проверка кеша
|
||||
const cachedFileId = await redis.get(url);
|
||||
let contentMessageId: number | undefined;
|
||||
|
||||
if (cachedFileId) {
|
||||
const cachedMessage = await context.replyWithVideo(cachedFileId);
|
||||
// Проверка кеша
|
||||
const cachedVideoId = await redis.get(url);
|
||||
if (cachedVideoId) {
|
||||
const cachedMessage = await context.replyWithVideo(cachedVideoId);
|
||||
contentMessageId = cachedMessage.message_id;
|
||||
}
|
||||
|
||||
const cachedCaption = await redis.get(`caption:${url}`);
|
||||
if (cachedCaption) {
|
||||
const { entities, text } = formatCaption(cachedCaption);
|
||||
return context.reply(text, {
|
||||
entities,
|
||||
reply_parameters: contentMessageId ? { message_id: contentMessageId } : undefined,
|
||||
});
|
||||
if (contentMessageId) {
|
||||
const cachedCaption = await redis.get(`caption:${url}`);
|
||||
if (cachedCaption) {
|
||||
const { entities, text } = formatCaption(cachedCaption);
|
||||
return context.reply(text, {
|
||||
entities,
|
||||
reply_parameters: contentMessageId ? { message_id: contentMessageId } : undefined,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Загрузка данных с сервисов
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user