Skip to content

Commit

Permalink
Handle deleted message
Browse files Browse the repository at this point in the history
  • Loading branch information
OperKH committed Mar 27, 2024
1 parent 1ee7cb0 commit 67c7709
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ai_bot",
"version": "1.3.1",
"version": "1.3.2",
"private": true,
"main": "src/app.ts",
"type": "module",
Expand Down
16 changes: 10 additions & 6 deletions src/bot/commands/recognizeSpeech.command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,16 @@ export class RecognizeSpeechCommand extends Command {
duration: number,
fileExt: string,
) {
const replyMessage = await ctx.reply('💬', {
reply_parameters: { message_id: ctx.message.message_id },
disable_notification: true,
});
const text = await this.extractText(fileId, duration, fileExt);
await ctx.telegram.editMessageText(ctx.chat.id, replyMessage.message_id, undefined, text);
try {
const replyMessage = await ctx.reply('💬', {
reply_parameters: { message_id: ctx.message.message_id },
disable_notification: true,
});
const text = await this.extractText(fileId, duration, fileExt);
await ctx.telegram.editMessageText(ctx.chat.id, replyMessage.message_id, undefined, text);
} catch (e) {
console.log(e);
}
}

private async extractText(fileId: string, duration: number, fileExt: string) {
Expand Down

0 comments on commit 67c7709

Please sign in to comment.