This bot allows you to repost/upload any custom video and audio files and send it as telegram's voice messages and round videos to specified users or groups in Telegram. The bot supports Russian, English, and Chinese languages.
-
Python 3.10+
-
ffmpeg-python
-
moviepy
-
telethon
-
numpy
-
aiogram 2.24
-
Clone the repository:
git clone https://github.com/chelaxian/TG_Voice-Video_MSG.git cd TG_Voice-Video_MSG
-
Install dependencies:
pip install -r requirements.txt
-
Install ffmpeg:
- For Ubuntu:
sudo apt update sudo apt install ffmpeg
- For Windows: Download the installer from ffmpeg.org and follow the installation instructions.
- For Ubuntu:
-
Edit the config.py file to include your own API ID, API Hash, and allowed user IDs. Also include your botfather token. Replace the placeholders with your actual values.
# Your API ID from my.telegram.org api_id = 'YOUR_API_ID' # Your API Hash from my.telegram.org api_hash = 'YOUR_API_HASH' # BotFather token botfather_token = 'YOUR_BOTFATHER_TOKEN' # Allow all users to interact with the bot #allow_all_users = True allow_all_users = False # Your Telegram user ID and allowed user IDs (provide your ID and delete/ignore others if not needed) allowed_user_id = ['YOUR_USER_ID', 'USER_ID2', 'USER_ID3'] # Language setting: 'RU' for Russian, 'EN' for English, 'CN' for Chinese #language = 'RU' language = 'EN' #language = 'CN' # Maximum file size in megabytes (adjust size as you need) max_file_size_mb = 50 # Supported audio formats (you can limit formats if you want to) audio_formats = [ '.mp3', '.wav', '.ogg', '.oga', '.m4a', '.aac', '.flac', '.alac', '.wma', '.aiff', '.opus', '.amr', '.mka' ] # Supported video formats (you can limit formats if you want to) video_formats = [ '.mp4', '.mkv', '.avi', '.mov', '.wmv', '.flv', '.webm', '.m4v', '.mpg', '.mpeg', '.3gp', '.3g2', '.mxf', '.ogv', '.mts', '.m2ts' ]
-
Run the bot:
python3 bot.py
-
Start the bot: Send
/start_voice_video_bot
to your Telegram bot. -
Send a file: Upload or repost an audio or video file to the bot.
-
Provide chat/user ID: After the file is processed, the bot will send you converted file. To send voice/video from your sender name you can stop the bot and repost converted file with turned on telegram option "hide sender name".
-
Stop the bot: Send
/stop_voice_video_bot
to your Telegram bot.
- Go to my.telegram.org.
- Log in with your phone number and login code.
- Go to the API development tools section.
- Create a new application and obtain the
api_id
andapi_hash
. - For BotFather bot and token use telegram bot - @BotFather
- You need API ID and API HASH because only telethon/pyrogram can inject waveform into voice messages bigger than 1 mb ( see #1 ). API ID and API HASH are requirements for telethon.
- Ensure the API ID / Hash and BotFather token and your user ID are correctly set in the config.py file.
- The bot only responds to commands from the allowed user IDs specified in the config.py file.
- Russian (RU)
- English (EN)
- Chinese (CN)