Skip to main content

Hosting your repl based discord.py bot on Heroku to keep it running INDEFINETLY

Join Discord Run on Repl.it

Prerequisites

You must have an account for Discord, GitHub , Heroku, and Repl.it (you probably have an account already).

1. Create a bot and get its token

  • Create an application in the developer portal here
  • Open up your new application and click 'Add Bot' under the Bot settings to create your bot.
  • After creating the bot, click the 'Copy' button under the title Token. Take note of your token as you will need it later.

2. Clone the GitHub repository and set it up to work with Heroku

  • Clone my Github repository into a repl here. This contains all the code you need to host your bot on Heroku. You can also view it here
  • Link your repl to a GitHub repository
  • Create an application for Heroku here.
  • Under 'Deploy', do the following:
    • Deployment Method => Connect your GitHub
    • App connected to GitHub => Search for the forked repository
    • Automatic Deploy => Enable Automatic Deploy (to redeploy after every commit)
  • Under 'Settings', click on 'Reveal Config Vars' and enter the following:
    • KEY => DISCORD_TOKEN
    • VALUE => (Enter the bot token that you copied from the developer portal)
    • Click the 'Add' button after entering all of this information.
  • Under 'Resources', do the following:
    • Click on the 'Pencil' icon.
    • Switch the worker from off to on.
    • Click 'Confirm' to finalize the decision.
    • NOTE: You are given 550 free Dyno hours, which will not last the entire month. However, if you provide a credit card to verify your identity, you are given an additional 450 hours, which will allow your bot to run indefinitely. You will not be charged for this.

What's next?

  • Now you can tweak the main.py file as you please! just don't mess with the first 5 or last 2 lines (you can change the prefix in line 4 though.)

Original code belongs to audieni. I just made it more suitable for repl.it bot creators. Visit his repository here

Release files for discordpy-replit-heroku-1-hi-1 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for discordpy-replit-heroku-1-hi-1 0.0.1
File Size Uploaded
discordpy-replit-heroku-1__hi__1-0.0.1.tar.gz 2.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for discordpy-replit-heroku-1-hi-1 0.0.1
File Interpreter ABI Platform
discordpy_replit_heroku_1_hi_1-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 6.0 kB

Release files / discordpy-replit-heroku-1__hi__1-0.0.1.tar.gz

Download URL discordpy-replit-heroku-1__hi__1-0.0.1.tar.gz
Size 2.6 kB
Tags Source
SHA-256 checksum
How to use checksums
dca5c5df52a3f2ab7f71119540c7ae1b79b9f5725b66cfa62e1bd8053bddd541
BLAKE2b-256 checksum
How to use checksums
8b2f48cb6a7c2e89548eabb845107807ef7ed71543504c707db72bb057945319
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

Release files / discordpy_replit_heroku_1_hi_1-0.0.1-py3-none-any.whl

Download URL discordpy_replit_heroku_1_hi_1-0.0.1-py3-none-any.whl
Size 3.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0e0b2deaed41e285d4ac77f6e9077018c8cba06ed4148f104fbb118a4a1bc60d
BLAKE2b-256 checksum
How to use checksums
33b41b85e2f4b9381ee7f615cd7715d7b0d5899a6e2d620ddc8ba67519e9d76c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page