Telegram AI Bot

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

A Telegram bot. You can get one using BotFather in Telegram. More info here: How do I create a bot?

The list of Telegram users allowed to use the bot. To avoid large bills from OpenAI! You can get your chat ID by talking to this bot: IDBot

Docker

An OpenAI API Key. You can get yours from the API keys page

Setup

Clone the repository: git clone https://github.com/lardissone/telegram-ai-bot.git

CD into the cloned repository: cd telegram-ai-bot

Copy settings.example.py to settings.py: cp settings.example.py settings.py

Fill the corresponding information in the settings.py file. You’ll need to enter OPENAI_API_KEY, TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_IDS.

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.

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.