Pyrogram bot to automate streaming music in voice chats

Related tags

Audiovcpb
Overview

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 on Telegram.

Requirements

  • A computer (a Debian-based Linux recommmended).
  • An alt Telegram account.
  • Bot token from @BotFather.
  • API ID & hash from my.telegram.org.
  • Python 3.6 or newer & latest version of pip.
  • MPV (and libmpv).
  • A software to forward audio to tdesktop (Linux: pulseaudio, Windows: voicemeeter).

Deploying

The code

Cloning

    git clone https://github.com/rojserbest/vcpb.git vcpb && cd vcpb

Configuring

CLI args (when running bot.py)

Example:

python3 bot.py \
--api-id 1 \
--api-hash abcdef1234 \
--token 1234567890:ABCDEF \
--sudo-users 111111_22222_33333 \
--mongo-db-uri mongodb+srv://user:[email protected]/vcpb \
--group -1001876543112 \
--dur-limit 10 \
--lang en
Config file

Copy config/sample_config.py to config/config.py and make it use your credentials (you can also give those as an arg when running bot.py):

API_ID int: your api id from my.telegram.org

API_HASH str: your api hash from my.telegram.org TOKEN str: your bot token from @BotFather

SUDO_USERS list(int): a list of user ids which can pause, skip and change volume

MONGO_DB_URI str: your MongoDB URI (you can get one for free in their official website, sign up, create a cluster and a database named "vcpb")

GROUP int: the id of the group where your bot plays (not required if both USERS_MUST_JOIN and LOG are false)

USERS_MUST_JOIN bool: if true, only users which are in the group can use the bot

LOG bool: if true, now playing messages will be sent to the group

LANG str: your bot language, choose an available language code in strings/

DUR_LIMIT int: max video duration in minutes for downloads

PIP requirements

pip(3) install -U -r requirements.txt

Running

⚠️ Warning for Linux users: don't run any command as root (except those which require it), else you might face bulky problems. You can create a user with adduser music and add it to sudoers using sudo usermod -aG sudo music.

ℹ️ The volume command isn't working on Windows.

On Linux VPS

These are apt package manager instructions but you can install the required packages with other package managers too.

  1. Update and upgrade apt: sudo apt update && sudo apt upgrade -y

  2. Install requirements: sudo apt install python3-pip xrdp pulseaudio mpv libmpv-dev screen -y

  3. Download tdesktop: cd ~ && wget https://telegram.org/dl/desktop/linux -O tdesktop.tar.xz && tar -xf tdesktop.tar.xz && rm tdesktop.tar.xz

  4. Configure XRDP session to only start Telegram: echo "~/Telegram/Telegram" >~/.xsession

  5. Enable pulseaudio service (you can skip this step if you don't have systemctl): systemctl --user enable pulseaudio

  6. Restart the machine: sudo reboot

  7. Start pulseaudio (you can skip this step if you did step 5): pulseaudio --start

  8. Go back to directory of the clone and load a pulseaudio null sink, by running: bash pa.sh

  9. Make a screen for the bot and attach to it: screen -S vcbot

  10. Run the bot: python(3) bot.py

  11. Detattach from the screen by pressing CTRL+A then CTRL+D.

  12. Open a remote desktop client and login to your user.

  13. You should see the Telegram GUI, just login, join a voice chat and set VoiceChatPyroBot as your microphone.

  14. Done, you can now start sending commands to your bot and it'll stream in the voice chat.

On Linux desktop

These are apt package manager instructions but you can install the required packages with other package managers too.

  1. Update and upgrade apt: sudo apt update && sudo apt upgrade -y

  2. Install requirements: sudo apt install pulseaudio mpv libmpv-dev pavucontrol screen -y

  3. If you have Telegram skip this step, otherwise download it here.

  4. Go to directory of the clone and load a pulseaudio null sink, by running: bash pa.sh

  5. Make a screen for the bot and attach to it: screen -S vcbot

  6. Run the bot: python(3) bot.py

  7. Detattach from the screen by pressing CTRL+A then CTRL+D.

  8. Open Telegram, join a voice chat and set VoiceChatPyroBot as your microphone.

  9. Done, you can now start sending commands to your bot and it'll stream in the voice chat.

On Windows 10 PC

  1. Download Voicemeeter here and install it.

  2. Download virtual audio cable here and install it.

  3. Reboot.

  4. Right click the speaker account in your taskbar, then click playback.

  5. Set Voicemeeter input and Voicemeeter output as default and click OK.

  6. Download MPV.

  7. Start Voicemeeter engine.

  8. Run the bot: python bot.py

  9. Open Telegram, join a voice chat and set Voicemeeter input as your microphone.

  10. Done, you can now start sending commands to your bot and it'll stream in the voice chat.

Usage

Streaming YouTube videos

  1. Open YouTube in your browser, and search for a song.
  2. Copy the complete video URL to clipboard and send it to your bot in private.

Method 2

  1. Enable inline for you bot in @BotFather.
  2. In your bot's private, type @usernameOfYourBot followed by your YouTube search query, and click a result.

Authors & Acknowledgment

Inspiration

Development & contribution

BART aids transcribe tasks by taking a source audio file and creating automatic repeated loops, allowing transcribers to listen to fragments multiple times

BART (Beyond Audio Replay Technology) aids transcribe tasks by taking a source audio file and creating automatic repeated loops, allowing transcribers to listen to fragments multiple times (with poss

2 Feb 04, 2022
Sound-Equalizer- This is a Sound Equalizer GUI App Using Python's PyQt5

Sound-Equalizer- This is a Sound Equalizer GUI App Using Python's PyQt5. It gives you the ability to play, pause, and Equalize any one-channel wav audio file and play 3 different instruments.

Mustafa Megahed 1 Jan 10, 2022
A GUI-based audio player with support for a large variety of formats

Miza-Player A GUI-based audio player with support for a large variety of formats, able to play from web-hosted media platforms such as YouTube, includ

Thomas Xin 3 Dec 14, 2022
Speech Algorithms Collections

Speech Algorithms Collections

Ryuk 498 Jan 06, 2023
Terminal-based audio-to-text converter

att Terminal-based audio-to-text converter Project description A terminal-based audio-to-text converter written in python, enabling you to convert .wa

Sven Eschlbeck 4 Dec 15, 2022
Music bot of # Owner

Pokimane-Music Music bot of # Owner How To Host The easiest way to deploy this Bot Support Channel :- TeamDlt Support Group :- TeamDlt Please fork thi

5 Dec 23, 2022
Python I/O for STEM audio files

stempeg = stems + ffmpeg Python package to read and write STEM audio files. Technically, stems are audio containers that combine multiple audio stream

Fabian-Robert Stöter 72 Dec 23, 2022
Converting UGG files from Rode Wireless Go II transmitters (unsompressed recordings) to WAV format

Rode_WirelessGoII_UGG2wav Converting UGG files from Rode Wireless Go II transmitters (uncompressed recordings) to WAV format Story I backuped the .ugg

Ján Mazanec 31 Dec 22, 2022
Using python to generate a bat script of repetitive lines of code that differ in some way but can sort out a group of audio files according to their common names

Batch Sorting Using python to generate a bat script of repetitive lines of code that differ in some way but can sort out a group of audio files accord

David Mainoo 1 Oct 29, 2021
An app made in Python using the PyTube and Tkinter libraries to download videos and MP3 audio.

yt-dl (GUI Edition) An app made in Python using the PyTube and Tkinter libraries to download videos and MP3 audio. How do I download this? Windows: Fi

1 Oct 23, 2021
Audio augmentations library for PyTorch for audio in the time-domain

Audio augmentations library for PyTorch for audio in the time-domain, with support for stochastic data augmentations as used often in self-supervised / contrastive learning.

Janne 166 Jan 08, 2023
pyo is a Python module written in C to help digital signal processing script creation.

pyo is a Python module written in C to help digital signal processing script creation.

Olivier Bélanger 1.1k Jan 01, 2023
Python Audio Analysis Library: Feature Extraction, Classification, Segmentation and Applications

A Python library for audio feature extraction, classification, segmentation and applications This doc contains general info. Click here for the comple

Theodoros Giannakopoulos 5.1k Jan 02, 2023
A Python wrapper for the high-quality vocoder "World"

PyWORLD - A Python wrapper of WORLD Vocoder Linux Windows WORLD Vocoder is a fast and high-quality vocoder which parameterizes speech into three compo

Jeremy Hsu 583 Dec 15, 2022
A Python port and library-fication of the midicsv tool by John Walker.

A Python port and library-fication of the midicsv tool by John Walker. If you need to convert MIDI files to human-readable text files and back, this is the library for you.

Tim Wedde 52 Dec 29, 2022
AudioDVP:Photorealistic Audio-driven Video Portraits

AudioDVP This is the official implementation of Photorealistic Audio-driven Video Portraits. Major Requirements Ubuntu = 18.04 PyTorch = 1.2 GCC =

232 Jan 03, 2023
NovaMusic is a music sharing robot. Users can get music and music lyrics using inline queries.

A music sharing telegram robot using Redis database and Telebot python library using Redis database.

Hesam Norin 7 Oct 21, 2022
ianZiPu is a way to write notation for Guqin (古琴) music.

PyBetween Wrapper for Between - 비트윈을 위한 파이썬 라이브러리 Legal Disclaimer 오직 교육적 목적으로만 사용할수 있으며, 비트윈은 VCNC의 자산입니다. 악의적 공격에 이용할시 처벌 받을수 있습니다. 사용에 따른 책임은 사용자가

Nancy Yi Liang 8 Nov 25, 2022
This is my voice assistant Patric!

voice-assistant This is my voice assistant Patric! You can add can add commands and even modify his name Indice How to use Installation guide How to u

Norbert Gabos 1 Jun 28, 2022
Official implementation of A cappella: Audio-visual Singing VoiceSeparation, from BMVC21

Y-Net Official implementation of A cappella: Audio-visual Singing VoiceSeparation, British Machine Vision Conference 2021 Project page: ipcv.github.io

Juan F. Montesinos 12 Oct 22, 2022