Skip to content

Commit

Permalink
throw away old messages in case the bot has been offline for some time
Browse files Browse the repository at this point in the history
  • Loading branch information
graynk committed Feb 26, 2021
1 parent 1cca213 commit 81bed21
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from google.cloud import speech
from google.cloud import storage
from pymediainfo import MediaInfo
from datetime import datetime, timezone
import os
import io

Expand All @@ -25,10 +26,14 @@


def start(update: Update, context: CallbackContext) -> None:
if (datetime.now(timezone.utc) - update.effective_message.date).days > 3:
return
update.effective_message.reply_text("Say stuff, I'll transcribe")


def voice_to_text(update: Update, context: CallbackContext) -> None:
if (datetime.now(timezone.utc) - update.effective_message.date).days > 3:
return
chat_id = update.message.chat.id
file_name = '%s_%s%s.ogg' % (chat_id, update.message.from_user.id, update.message.message_id)

Expand Down

0 comments on commit 81bed21

Please sign in to comment.