Skip to content

Commit

Permalink
bugfix: catch error when answering query
Browse files Browse the repository at this point in the history
  • Loading branch information
Rogério Munhoz committed Jul 3, 2023
1 parent 356010b commit d8bf937
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ export async function getBot(config: AppConfig, development = false) {

if (development) {
bot.use(async (ctx, next) => {
console.time("update");
console.log(ctx.update);
await next();
console.timeEnd("update");
});
}

Expand Down
7 changes: 6 additions & 1 deletion src/handlers/registered.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ export function install(bot: Bot<AppContext>) {

const formattedAmount = BRL(finalValue);

await new Promise((resolve) => {
setTimeout(resolve, 15000);
});

return ctx.answerInlineQuery([
{
id: query,
Expand Down Expand Up @@ -82,6 +86,7 @@ export function install(bot: Bot<AppContext>) {
finalValue.toFixed(2),
),
},
], { cache_time: 0 });
], { cache_time: 0 })
.catch(console.error);
});
}

0 comments on commit d8bf937

Please sign in to comment.