Telegram AI Bot

May 08, 2023

I think voice messages in instant messengers are a nice feature, but a voice message of 6 minutes is a pain. When you listen to it? Where are the key parts of the messages?

For that reason I've been working on a Telegram chat bot to transcribe these audio messages.

You just need to forward the message to the bot and it automatically sends the audio to OpenAI servers to transcribe and return the message as text to the chat.

Prerequisites

Setup

  1. Clone the repository: git clone https://github.com/lardissone/telegram-ai-bot.git
  2. CD into the cloned repository: cd telegram-ai-bot
  3. Copy settings.example.py to settings.py: cp settings.example.py settings.py
  4. Fill the corresponding information in the settings.py file. You'll need to enter OPENAI_API_KEY, TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_IDS.
  5. Run it by using Docker's compose: docker compose up -d

Usage

You just need to send the bot a voice message and it automatically will transcribe for you.

Response from the bot

Note: I tried with English and Spanish, and both worked perfectly.

Tip

I've also used it for sending a text message when I'm on the car, by just sending a voice message directly to the bot and then forwarding the resulting text to my contact.

It also includes a quick command called /image to generate a image using DALL-E. You just need to send /image prompt where the prompt is what you want the AI create for you.