mirror of
https://github.com/flibusta-apps/book_bot.git
synced 2025-12-06 15:35:35 +01:00
Fix image downloading
This commit is contained in:
@@ -24,11 +24,15 @@ export async function download(source_id: number, remote_id: number, file_type:
|
|||||||
|
|
||||||
|
|
||||||
export async function downloadImage(path: string) {
|
export async function downloadImage(path: string) {
|
||||||
const response = await got(path);
|
try {
|
||||||
|
const response = await got(path);
|
||||||
|
|
||||||
if (response.statusCode === 200) {
|
if (response.statusCode === 200) {
|
||||||
return response.rawBody;
|
return response.rawBody;
|
||||||
} else {
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -185,8 +185,6 @@ export function getCallbackArgs(ctx: Context): { query: string, page: number} |
|
|||||||
|
|
||||||
const [ _, query, sPage ] = ctx.callbackQuery.data.split('_');
|
const [ _, query, sPage ] = ctx.callbackQuery.data.split('_');
|
||||||
|
|
||||||
console.log(_, query, sPage);
|
|
||||||
|
|
||||||
const page = parseInt(sPage);
|
const page = parseInt(sPage);
|
||||||
|
|
||||||
if (isNaN(page)) {
|
if (isNaN(page)) {
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ export default class BotsManager {
|
|||||||
await oldBot.telegram.deleteWebhook();
|
await oldBot.telegram.deleteWebhook();
|
||||||
await oldBot.telegram.logOut();
|
await oldBot.telegram.logOut();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Sentry.captureException(e);
|
// Sentry.captureException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
let bot: Telegraf;
|
let bot: Telegraf;
|
||||||
@@ -97,7 +97,7 @@ export default class BotsManager {
|
|||||||
try {
|
try {
|
||||||
bot = await getBot(state.token, state);
|
bot = await getBot(state.token, state);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Sentry.captureException(e);
|
// Sentry.captureException(e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user