Telegram Voice-Chat Bot Written In Python Using Pyrogram.

Overview

Telegram Voice-Chat Bot

Telegram Voice-Chat Bot To Play Music From Various Sources In Your Group

Support

  1. All linux based os.
  2. Windows
  3. Mac

Diagram

Requirements

  • Python 3.6 or higher
  • A Telegram bot token
  • Bot needs to be admin in the chat, atleast give message delete permissions.
  • Install mpv with

pkg install mpv - for Android, sudo apt-get install mpv - for ubuntu, sudo pacman -S mpv - for ArchLinux, I use arch btw

Run

  1. git clone https://github.com/thehamkercat/Telegram_VC_Bot, to download the source code.
  2. cd Telegram_VC_Bot, to enter the directory.
  3. pip3 install -r requirements.txt, to install the requirements.
  4. cp sample_config.py config.py
  5. Edit config.py with your own values.
  6. If you are on linux follow this instruction to set up vnc. If you are using windows you can skip this step.
  7. Download Telegram desktop from https://desktop.telegram.org , Log in using your second account, and connect to the voice chat in your group.
  8. Follow This to route your PC or Server's audio output to audio input. [For Linux]
  9. If you're on windows, Follow This or install Virtual Audio Cable instead.
  10. Run the bot python3 main.py
  11. Open Telegram and start voice chat.
  12. Send commads to bot to play music.

Watch The Video Tutorial if you still can't do this

How to deploy the Telegram Voice Chat Bot on VPS using Ubuntu/Debian

Commands

Command Description
/start To Start The bot.
/help To Show This Message.
/ping To Ping All Datacenters Of Telegram.
/end To Stop Any Playing Music (only works for current user playing and to Admins).
/jiosaavn <song_name> To Play A Song From Jiosaavn.
/youtube <song_name> or <song_link> To Search For A Song And Play The Top-Most Song Or Play With A Link.
/playlist <youtube_playlist_url> To Play A Playlist From Youtube.
/telegram To Play A Song Directly From Telegram File.
/radio To Play Radio Continuosly.
/users To Get A List Of Blacklisted Users.
/deezer To Play A Song From Deezer.
Admin Commands:
/black To Blacklist A User.
/white To Whitelist A User.

Note

  1. More services will be added soon.
  2. Termux is not completely supported yet, might take a week or two.
  3. If you want any help you can ask here

Credits

  1. https://github.com/cyberboysumanjay/JioSaavnAPI [For JioSaavnAPI]
Comments
  • ERROR: Cannot install -r requirements.txt (line 2) because these package versions have conflicting dependencies.

    ERROR: Cannot install -r requirements.txt (line 2) because these package versions have conflicting dependencies.

    The conflict is caused by: pytgcalls 0.0.19 depends on tgcalls==0.0.12 pytgcalls 0.0.18 depends on tgcalls==0.0.12 pytgcalls 0.0.17 depends on tgcalls==0.0.11 pytgcalls 0.0.16 depends on tgcalls==0.0.10 pytgcalls 0.0.15 depends on tgcalls==0.0.10 pytgcalls 0.0.14 depends on tgcalls==0.0.10 pytgcalls 0.0.13 depends on tgcalls==0.0.9 pytgcalls 0.0.12 depends on tgcalls==0.0.8 pytgcalls 0.0.11 depends on tgcalls==0.0.7 pytgcalls 0.0.10 depends on tgcalls==0.0.6 pytgcalls 0.0.9 depends on tgcalls==0.0.5 pytgcalls 0.0.8 depends on tgcalls==0.0.4 pytgcalls 0.0.7 depends on tgcalls==0.0.4 pytgcalls 0.0.6 depends on tgcalls==0.0.4 pytgcalls 0.0.5 depends on tgcalls==0.0.3 pytgcalls 0.0.4 depends on tgcalls==0.0.3 pytgcalls 0.0.3 depends on tgcalls==0.0.3 pytgcalls 0.0.2 depends on tgcalls==0.0.2

    To fix this you could try to:

    1. loosen the range of package versions you've specified
    2. remove package versions to allow pip attempt to solve the dependency conflict Screenshot (3)
    opened by rktiwari00 5
  • Bot doesnt respond to messages

    Bot doesnt respond to messages

    I followed the installation instructions. Launched the bot. The terminal displays the message "Bot started" but the bot does not respond to messages. What should I do?

    opened by mishailovic 3
  • whitelist

    whitelist

    added a whitelist function so only listed users are allowed to use commands

    add the restricted line to each function you want to restrict

    from functools import wraps

    LIST_OF_ADMINS = [12345678, 87654321] # List of user_id of authorized users

    def restricted(func): @wraps(func) def wrapped(update, context, *args, **kwargs): user_id = update.effective_user.id if user_id not in LIST_OF_ADMINS: print("Unauthorized access denied for {}.".format(user_id)) return return func(update, context, *args, **kwargs) return wrapped

    @restricted def my_handler(update, context): pass # only accessible if user_id is in LIST_OF_ADMINS.

    opened by jayjay3108 2
  • showing key error in config file

    showing key error in config file

    2021-04-04T17:57:37.121624+00:00 app[worker.1]: Traceback (most recent call last): 2021-04-04T17:57:37.121670+00:00 app[worker.1]: File "main.py", line 19, in 2021-04-04T17:57:37.121875+00:00 app[worker.1]: from config import ( 2021-04-04T17:57:37.121902+00:00 app[worker.1]: File "/app/config.py", line 7, in 2021-04-04T17:57:37.122050+00:00 app[worker.1]: API_ID = int(environ["1389947"]) 2021-04-04T17:57:37.130217+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.6/os.py", line 669, in getitem 2021-04-04T17:57:37.130945+00:00 app[worker.1]: raise KeyError(key) from None 2021-04-04T17:57:37.131000+00:00 app[worker.1]: KeyError: '1389947'

    opened by Lucifer7535 2
  • issue

    issue

    Item could not be created: We couldn't deploy your app because the source code violates the Salesforce Acceptable Use and External-Facing Services Policy.

    opened by axuenno223 1
  • Update README.md

    Update README.md

    Telegram Voice-Chat Bot [ Pytgcalls ]

    Telegram Voice-Chat Bot To Play Music With Pytgcalls From Various Sources In Your Group.

    Requirements

    Account requirements

    • A Telegram account to use as the music bot. You cannot use regular bot accounts, as they cannot join voice chats. It must be a user account.
    • API_ID and API_HASH for that account.
    • The account must be an admin of the chat, with Manage Voice Chats and Delete Messages permissions.

    Environment requirements

    • Linux-based OS. You cannot run this on Windows natively.
    • Python 3.9 or later.
    • Install ffmpeg.

    Run

    $ git clone https://github.com/thehamkercat/Telegram_VC_Bot
    $ cd Telegram_VC_Bot
    $ sudo apt-get install ffmpeg
    $ pip3 install -U pip
    $ pip3 install -U -r requirements.txt
    $ cp sample_config.py config.py
    

    Edit config.py with your own values.

    $ python3 main.py
    

    Heroku

    Generate String session [IMPORTANT]

    Download this file generate_string_session.py

    $ pip3 install pyrogram TgCrypto
    $ python3 generate_string_session.py
    

    Fork this repository and change name of sample_config.py to config.py Then you will need get a session string, copy it, then press heroku deploy button.

    Deploy

    Send commands to bot to play music.

    Docker

    $ git clone https://github.com/thehamkercat/Telegram_VC_Bot && cd Telegram_VC_Bot
    $ cp sample.env .env
    

    Edit .env with your own values.

    $ sudo docker build . -t tgvc-bot
    $ sudo docker run tgvc-bot
    

    To stop use CTRL+C

    Commands

    Command | Description :--- | :--- /help | Show Help Message. /skip | Skip Any Playing Music. /play [SONG_NAME] | To Play A Song Using YouTube.
    Service used can be changed in config (DEFAULT_SERVICE). /play youtube/saavn/deezer [SONG_NAME] | To Play A Song Using Specific Service. /play [with reply to an audio file] | To Play A Song With TG Audio File. /telegram | Play A Song Directly From Telegram File. /queue | Check Queue Status. /delqueue | Deletes Queue List and Playlist. /playlist [songs name separated by line] | Start Playing Playlist. /joinvc | Join Voice Chat. /leavevc | Leave Voice Chat. /listvc | List Active Voice Chats. /volume [1-200] | Adjust Volume. /pause | Pause Music. /resume | Resume Music. /stop | Stop Music. /start | Start Music. [From beginning, unlike "/resume"] /theme [Theme Name] | Change 'Currently Playing' Theme. /update | Update & Restart.

    Note

    1. If you want any help you can ask here

    Credits

    1. @MarshalX [For TgCalls]
    2. Thanks to everyone who contributed to the project.
    opened by Arseno25 1
  • unable to deploy on heroku using deploy button

    unable to deploy on heroku using deploy button

    Item could not be created:

    We couldn't deploy your app because the source code violates the Salesforce Acceptable Use and External-Facing Services Policy.

    heroku is showing this, what if i used heroku cli will it still show this error or get deployed?

    opened by Lucifer7535 1
  • Can't deploy in heroku

    Can't deploy in heroku "We couldn't deploy your app because the source code violates the Salesforce Acceptable Use and External-Facing Services Policy"

    I was trying to deploy in heroku but I got error "We couldn't deploy your app because the source code violates the Salesforce Acceptable Use and External-Facing Services Policy"

    opened by Nisarga-Developer 1
  • Not working sometimes

    Not working sometimes

    Sometimes I have to rerun it many times or using /leavevc and /joinvc several times to make it work. whenever the bot is in voicechat and doesn't singing, it will leave the voicechat automatically after 10-120s.

    opened by mojtabaasg 1
  • Default /play service

    Default /play service

    Thoughts about using a default service when people use /play [song-name] (without specifying a service)?

    It's a bit inconvenient to have to type in a service every time, especially if you always use the same one.

    Willing to submit a PR myself if you think this is a good idea.

    opened by Remls 1
  • Make Heroku worker dyno autostart after deploy

    Make Heroku worker dyno autostart after deploy

    Problem

    App doesnt autostart after deploying to heroku.

    Changes made to fix this

    Edited app.json file and added formation worker in it to enable and start worker dyno automatically after the build succeeds and app deploys.

    Reference

    https://devcenter.heroku.com/articles/app-json-schema#formation

    opened by AJAYK-01 1
  • Termux debian

    Termux debian

    Traceback (most recent call last): File "/root/Telegram_VC_Bot/main.py", line 21, in from functions import (CHAT_ID, app, get_default_service, play_song, File "/root/Telegram_VC_Bot/functions.py", line 6, in import aiofiles ModuleNotFoundError: No module named 'aiofiles'


    Traceback (most recent call last): File "/root/Telegram_VC_Bot/main.py", line 21, in from functions import (CHAT_ID, app, get_default_service, play_song, File "/root/Telegram_VC_Bot/functions.py", line 9, in from aiohttp import ClientSession ModuleNotFoundError: No module named 'aiohttp'


    Traceback (most recent call last): File "/root/Telegram_VC_Bot/main.py", line 21, in from functions import (CHAT_ID, app, get_default_service, play_song, File "/root/Telegram_VC_Bot/functions.py", line 10, in from PIL import Image, ImageDraw, ImageFont ModuleNotFoundError: No module named 'PIL'


    Traceback (most recent call last): File "/root/Telegram_VC_Bot/main.py", line 21, in from functions import (CHAT_ID, app, get_default_service, play_song, File "/root/Telegram_VC_Bot/functions.py", line 15, in from Python_ARQ import ARQ ModuleNotFoundError: No module named 'Python_ARQ'

    opened by molafir 1
Owner
TheHamkerCat
17 | Arch btw
TheHamkerCat
Okaeri-Music is a telegram music bot project, allow you to play music on voice chat group telegram.

??️ PROJECT MUSIC,THIS IS MAINTAINED Okaeri-Music is a telegram bot project that's allow you to play music on telegram voice chat group Features ?? Th

Okaeri-Project 2 Dec 23, 2021
Mina - A Telegram Music Bot 5 mandatory Assistant written in Python using Pyrogram and Py-Tgcalls

Mina - A Telegram Music Bot 5 mandatory Assistant written in Python using Pyrogram and Py-Tgcalls

null 3 Feb 7, 2022
Open-Source bot to play songs in your Telegram's Group Voice Chat. Powered by @Akki_ThePro

VcPlayer Telegram Voice-Chat Bot [PyTGCalls] ⇝ Requirements ⇜ Account requirements A Telegram account to use as the music bot, You cannot use regular

Akki ThePro 2 Dec 25, 2021
Xbot-Music - Bot Play Music and Video in Voice Chat Group Telegram

XBOT-MUSIC A Telegram Music+video Bot written in Python using Pyrogram and Py-Tg

Fariz 2 Jan 20, 2022
Pyrogram bot to automate streaming music in voice chats

Pyrogram bot to automate streaming music in voice chats Help If you face an error, want to discuss this project or get support for it, join it's group

Roj 124 Oct 21, 2022
SU Music Player — The first open-source PyTgCalls based Pyrogram bot to play music in voice chats

SU Music Player — The first open-source PyTgCalls based Pyrogram bot to play music in voice chats Note Neither this, or PyTgCalls are fully

SU Projects 58 Jan 2, 2023
Stevan KZ 1 Oct 27, 2021
Noinoi music is smoothly playing music on voice chat of telegram.

NOINOI MUSIC BOT ✨ Features Music & Video stream support MultiChat support Playlist & Queue support Skip, Pause, Resume, Stop feature Music & Video do

null 2 Feb 13, 2022
Play any song directly into your group voice chat.

Telegram VCPlayer Bot Play any song directly into your group voice chat. Official Bot : VCPlayerBot | Discussion Group : VoiceChat Music Player Suppor

Shubham Kumar 50 Nov 21, 2022
A bot that can play music on Telegram Group and Channel Voice Chats

DaisyXmusic ❤ is the best and only Telegram VC player with playlists, Multi Playback, Channel play and more

TeamOfDaisyX 20 Jun 11, 2021
DaisyXmusic ❤ A bot that can play music on Telegram Group and Channel Voice Chats

DaisyXmusic ❤ is the best and only Telegram VC player with playlists, Multi Playback, Channel play and more

TeamOfDaisyX 34 Oct 22, 2022
This bot can stream audio or video files and urls in telegram voice chats

Voice Chat Streamer This bot can stream audio or video files and urls in telegram voice chats :) ?? Follow me and star this repo for more telegram bot

WiskeyWorm 4 Oct 9, 2022
Voice to Text using Raspberry Pi

This module will help to convert your voice (speech) into text using Speech Recognition Library. You can control the devices or you can perform the desired tasks by the word recognition

Raspberry_Pi Pakistan 2 Dec 15, 2021
A voice based calculator by using termux api in Android

termux_voice_calculator This is. A voice based calculator by using termux api in Android Instagram account ?? ?? Requirements and installation Downloa

ʕ´•ᴥ•`ʔ╠ŞĦỮβĦa̷m̷╣ʕ´•ᴥ•`ʔ 2 Apr 29, 2022
❤️ Hi There Im Cozmo Music Bot A next gen powerful telegram group Music bot for get your Songs and music @Venuja_Sadew

?? Cozmo MUSIC ?? Cozmo Music is a Music powerfull bot for playing music on telegram voice chat groups. Requirements FFmpeg NodeJS nodesource.com Pyth

Venuja Sadew 3 Jan 8, 2022
Python interface to the WebRTC Voice Activity Detector

py-webrtcvad This is a python interface to the WebRTC Voice Activity Detector (VAD). It is compatible with Python 2 and Python 3. A VAD classifies a p

John Wiseman 1.5k Dec 22, 2022
voice assistant made with python that search for covid19 data(like total cases, deaths and etc) in a specific country

covid19-voice-assistant voice assistant made with python that search for covid19 data(like total cases, deaths and etc) in a specific country installi

Miguel 2 Dec 5, 2021
Jarvis From Basic to Advance - make a voice assistant similar to JARVIS (in iron man movie)

JARVIS (Basic to Advance) This was my attempt to make a voice assistant similar to JARVIS (in iron man movie) Let's be honest, it's not as intelligent

codesempai 17 Dec 25, 2022
A simple voice detection system which can be applied practically for designing a device with capability to detect a baby’s cry and automatically turning on music

Auto-Baby-Cry-Detection-with-Music-Player A simple voice detection system which can be applied practically for designing a device with capability to d

null 2 Dec 15, 2021