I was fed up with the public bots with annoying features and limitations like volume change only available when you donate some money, so i decided to use a prebuilt java bot by Jagrosh and host it to heroku, sounds awesome isn't it? i mean if its for free who doesn't want their own bot?
This tutorial requires following programs installed on your computer.
So lets start with downloading the latest executable jar file from jagrosh's github.
Download according to your targeted OS or just download the one for generic usage(that works fine on all OSs). Also download the sample config.txt as it is required for bot to be able to function.
Now second step create a folder and move the config.txt and JMusicBot-.jar and now create two files in the folder specifically named "manifest.sh" and "Procfile" case sensitive for Procfile and yeah it doesn't have any extension. Now rename JMusicBot-.jar to application.jar as our buildpack only supports application.jar with git push. Add following code to procfile.
worker: java -Dnogui=true -jar application.jar
Following next step login to heroku and create a new App, open cmd or powershell whichever you want and navigate to the directory with application.jar and other files after that login to heroku
verify the login through your browser and now you are good to start. After successfully login follow the following commands.
git init heroku git:remote -a YOUR_HEROKU_APP_NAME
Don't forget to change YOUR_HEROKU_APP_NAME to your very own heroku app name. after that some more commands.
heroku buildpacks:add https://github.com/energizedwork/heroku-buildpack-runnable-jar.git heroku config:set NO_PRE_DEPLOY=true
these commands are all case sensitive.
Now let's fire up our bot, before pushing all the files please be careful that you have modified the config.txt carefully. Some more commands and we are good to go.
git add . git commit -m "Initialize the bot magic" git push heroku master
Wait until the building process finishes itself, after finishing its build process we only have to use one more command to scale our deployment to a dyno worker.
heroku ps:scale worker=1
Done now your Bot should be online and don't forget to invite your bot to your discord server by a custom link
rename the INSERTHERE to the original client ID from your discord developer APP. and voila! your bot is running fine in your discord server. For the complete list of commands for the bot visit https://github.com/jagrosh/MusicBot/wiki/Full-Command-Reference
Or if you want an easy approach you can clone and use my github repo locally using the same bot as Jargosh(thank you again for the awesome bot) here is my github repo link https://github.com/AgentGeek/MusicBot don't forget to edit the config.txt or your bot might not work at all. Here is the detailed guide how to use the github integration with heroku and deploy your app hosted on github without any hassle although you have to fork the repo and edit the config.txt https://devcenter.heroku.com/articles/github-integration
Need professional installation on your VPS or something? You can always hire me for the work and i will make sure everything works flawless from the installation to the production use. Thank you for reading we will meet again i am sure of it, so good luck with your Discord Bot and happy gaming.