How to Deploy TGVCBot in a Ubuntu VPS

How to Deploy TGVCBot in a Ubuntu VPS

Subscribe to my newsletter and never miss my upcoming articles

I wrote TGVCBot , Telegram bot+userbot to play music from JioSaavn and YouTube in the group voice chats. Here I am gonna explain how to make it work in your own VPS.

Deploy TGVCBot

First SSH into your VPS and upgrade the packages

sudo apt-get update
sudo apt-get upgrade

Install NodeJS Latest

curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt-get install -y nodejs

Install Yarn and PM2

sudo npm i -g yarn pm2

Install FFMPEG & Git

sudo apt-get install git ffmpeg -y

Clone The Repo & Install Dependencies of TGVCBot

git clone https://github.com/ArnabXD/TGVCBot.git
cd TGVCBot
yarn
yarn build

Setup ENV Variables

Knowing the Variables

NameDescriptionRequired
API_IDYour telegram app's API_ID. Get it from my.telegram.org/appsTrue
API_HASHYour telegram app's API_HASH. Get it from my.telegram.org/appsTrue
BOT_TOKENBot Token from @BotFatherTrue
LOG_CHANNELChat ID of Channel/Group to keep logs. (Make sure to add VC User and Bot to the group)True
SESSIONGramJS/Telethon session string of the VC User. Session GenTrue
MAX_DURATIONSet maximum duration of the stream. Default: 36000 secondsFalse
THUMBNAILDirect link for default thumbnail (used if audio has no thumbnails).False

Simply copy the .env.sample to .env

cp .env.sample .env

Now modify the .env with your values. Use your preferred text editor

Run The Bot

Once you followed all the previous, now it's time to run the bot. I will use pm2 to run the bot.

pm2 start npm --name "tgvc" -- run start --exp-backoff-restart-delay=1000

this will auto-restart bot on crashes.

With PM2 we can start the bot automatically on VPS reboot too.

# save the pm2 list
pm2 save

# get startup command
pm2 startup

this will return a command. Execute that to start bot on VPS startup

 
Share this