Fix image downloading

This commit is contained in:
2022-02-04 12:14:34 +03:00
parent 9fa6d425ed
commit 8350f897ee
3 changed files with 10 additions and 8 deletions

View File

@@ -24,6 +24,7 @@ export async function download(source_id: number, remote_id: number, file_type:
export async function downloadImage(path: string) { export async function downloadImage(path: string) {
try {
const response = await got(path); const response = await got(path);
if (response.statusCode === 200) { if (response.statusCode === 200) {
@@ -31,4 +32,7 @@ export async function downloadImage(path: string) {
} else { } else {
return null; return null;
} }
} catch {
return null;
}
} }

View File

@@ -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)) {

View File

@@ -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;
} }