Skip to content

Instantly share code, notes, and snippets.

@JustaSqu1d
Last active April 30, 2024 14:38
Show Gist options
  • Save JustaSqu1d/992d7d95c44420f5edd5b0741b7915aa to your computer and use it in GitHub Desktop.
Save JustaSqu1d/992d7d95c44420f5edd5b0741b7915aa to your computer and use it in GitHub Desktop.
Installing Pycord with Replit (only use replit as a last resort)

Installing Pycord with Replit

Warning

Why NOT to use Replit as a hosting platform

You should not use Replit to host your bot. It may be a nice option as its free but you should use something else considering the major flaws.

  • The machines are super underpowered.
    • This means your bot will lag a lot as it gets bigger.
  • You'll need a web server alongside your bot to prevent it from being shut off.
    • This isn't a trivial task, and eats more of the machines power.
  • Replit uses an ephemeral file system.
    • This means any file you saved via your bot will be overwritten when you next launch.
  • They use a shared IP for everything running on the service. This one is important - if someone is running a user bot on their service and gets banned, everyone on that IP will be banned. Including you.

Please avoid using Replit to host your bot. It's not worth the trouble.

If you're looking for free options, consider using

  • Amazon Web Services
  • Google Cloud Platform
  • Azure
  • railway.app
  • Oracle Cloud Infrastructure and its respective free tiers or just pay for an actual VPS.

Installation steps

Replit has its own way of installing packages.

To install Pycord, first, you should first go to the package manager and uninstall the replit package:

replit-packages

Similarly, remove any other packages that share the discord namespace in a similar way.

Next, click Show Hidden Files under the dropdown:

replit-hidden-files

You should now see a file named .replit. Open it and find guessImports and set it to false:

replit-guess-imports

Then, click shell and type

pip install requests

and press enter. This will install the requests package, which is required for the replit package manager to work.

replit-shell

Finally, navigate back to the package manager, search for py-cord and install it:

replit-install-pycord

And you are done! You can now start using Pycord in your Replit project.

Common Issues

I don't have a .replit file

If you don't have a .replit file, you are using an old version of Replit. You should create a new project and copy your code over.

I have a .replit file, but it doesn't have guessImports

If you have a .replit file, but it doesn't have guessImports, you are using an old version of Replit. You should create a new project and copy your code over.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment