Discord Bot Maker

Discord Bot Maker

31 hodnocení
How to upload your bot to the Heroku Cloud Platform
Vytvořil: ♕Zer0Day♕
This is a step-by-step guide to add your Discord bot to the Heroku Cloud Platform to make it run it 24/7. The guide can look like that you have to do a lot of things, but that isn't the case. After you have downloaded the needed applications that are mentioned on the "Pre steps" section, the rest of it should be fairly easy to do. At the end of the Guide, you'll se how to update your bot when you make changes to it. This is also very easy to do, and after you get the hang of it, it truly becomes easy to maintain your bot.

Time: Approximately 30 minutes
2
   
Ocenit
Přidat do oblíbených
Oblíbeno
Odebrat z oblíbených
Pre steps
1. Download "Node.js" [nodejs.org]
2. Download "Heroku CLI" [devcenter.heroku.com]
3. Download "Git"[git-scm.com]
4. Download 5. Create an account on [url] "Heroku" [https//code.visualstudio.comVisual+Studio+Code%5B]

If you already have some of those installed, then make sure that you have the newest version of them.
For the Heroku CLI, this can be done by opening up the command prompt on windows and typing:
npm install -g heroku
And then verify the version by typing
heroku --version
1. Uploading the bot
Now go to your dashboard on Heroku and do the following:
1) Click "new" → "Create an app" → Fill in a name and the region (Don't click on "add to pipeline") → then hit "Create app"
2) Open the command prompt and type:
heroku login
Then press any key on your keyboard to open up the heroku login page on your browser

3) Now go to your bot folder → right click and click on "Git Bash Here"
Now type the following commands one line at a time and hit "enter"

git init heroku git:remote -a {bot_name} git add . git commit -am "TEXT" git push heroku master

The commands explained
  • {bot_name} = name of the app you wrote when you created your new application on heroku. E.g. heroku "git:remote -a waterreminderbot"
  • . = means "add all files"
  • TEXT = You decide what to write here, it's just like giving the changes a name. This could therefore be "First commit" or something like "Updated this command..." etc
  • pushing = sending the changes that is on your computer locally to heroku

All this will create a repository and deploy our application

4) Now go to your application at heroku and click on "Resources". Here you should see "Web npm start"
We are not done yet. So lets add a file to make our first update for our application

5) Open Atom → file → open folder → here you choose your bot folder thats located somewhere in your computer → and then click on "select folder"
6) Right click on your bot name inside Atom and click on "new file" and call it "Procfile"


7) Inside the Procfile you'll have to write the following:
worker: node bot.js
8) Now save the changes (ctrl + s)
9) Go back to the Git Bash window from earlier and write the following commands:
git add . git commit -am "<Message>" git push heroku master
10) When you are done with the commands, go back to your application on heroku and click on "Resources" again. Here you should see the "worker node bot.js"
11) Now click on the edit symbol in "web npm start" → turn it of → hit "confirm". After that, click on the edit symbol for "worker node bot.js" → turn it on → and hit "confirm"

12) Click on "more" at the top and choose "View logs". If you have any errors you should see it here(and how to fix it), and if not,then congratulations, you should now be able to see that your bot is online on Discord!
2. Updating the bot
1. Open discord bot folder
2. Right click and click on "Git Bash here"
3. Write the following commands:

git add . git commit -am "<Message>" git push heroku master
Last words
I will be more than happy to hear if this worked for you, so feel free to leave a comment below!

Likes, awards and feedback are much appreciated! :-)
Počet komentářů: 52
♕Zer0Day♕  [autor] 31. pro. 2022 v 7.36 
No, you can also use another code editor like Visual Studio Code. :)
the Drink 29. pro. 2022 v 4.53 
Do I need atom.io? Because it doesn't exist anymore.
♕Zer0Day♕  [autor] 7. čvn. 2022 v 14.09 
Woops, I see. Thank you! :))
munt 6. čvn. 2022 v 10.53 
awesome guide tho ;)
munt 6. čvn. 2022 v 10.36 
heroku git:remote a {bot_name}
should be
heroku git:remote -a {bot_name}
kAizuhan 1. lis. 2021 v 9.16 
I have a little bit of trouble with number 7 and number 10 on Uploading the bot, I did what it told me to do but it seemed nothing's working for me.
drowsy 31. říj. 2021 v 7.52 
SyntaxError: Unexpected token '??=' how to fix
♕Zer0Day♕  [autor] 27. srp. 2021 v 17.22 
Good!
Baborra 27. srp. 2021 v 16.41 
np still thx i found it out by my self :D
♕Zer0Day♕  [autor] 27. srp. 2021 v 15.50 
I don't think that I have the time to do that :(