Learn to Code via Tutorials on Repl.it!

← Back to all posts
Hosting Red Discord bot on repl.it!
h
YellowBanana (17)

Hosting Red discord bot on repl.it!

Some of you might be having a discord community! And when it comes to communities, it comes to discord bots, now a days many people want their own modmail or automod bot for discord!

Well there is a really great bot out there but hosting it is a headache. I always tried to host that bot for free in an easy way but at last, you will just give up.

Well, I have a way for you from which you can host red discord bot on repl.it for free!

In order to do this, simply head over to the home page and make a new Python REPL.

After you are done making the python repl, just make a new file called bot.sh and then put these values there:

python3.8 -m venv ~/redenv
source ~/redenv/bin/activate
python -m pip install -U pip setuptools wheel
python -m pip install -U Red-DiscordBot
redbot-setup

After you are done writing this, make another file called .replit and fill these values there:

run = "bash bot.sh"

Done with this, now smash the run button on top! Now go through the Initial setup process:

  • It will ask you for the instance name: Put any name for your bot.
  • Then it will ask for the data path, just say Yes.
  • After that It will ask you two options, one is JSON and another one is PostgreSQL, select JSON by typing 1.

Please note that the order of filling these values can change anytime, so please consider reading what's written and match it will the step provided above

Now when you are done with this simply again open your bot.sh file and remove everything and replace with this:

source ~/redenv/bin/activate
redbot <your instance name>

Please change <your instance name> to the name you entered for the bot in Step 1.

Now smash the run button again, now the bot will ask you about the bot's token. To make this guide shorter and readable, please CLICK HERE for the instructions on how to obtain a discord bot token.

When you are done with the token, paste the token in the repl console, and then it will ask you for the prefix of the bot. Enter the desired prefix you want. Don't worry, we can change this later on!

Now you will see that your bot is starting. IF you haven't invited the bot yet, simply click on the link the console gives you for the bot to invite the bot to your server.

Now we are done with the discord bot, now we only need to work on the bot to make it 24/7. As redbot doesn't store any data in the repl, unfortunately, you can't make the keep-alive server! But hey wait! I am here for you.

Simply type this command to load the bot's modules.
[p]load admin alias audio bank cleanup customcom downloader economy filter general image mod modlog mutes permissions reports streams trivia warnings

This will load all the cogs for the bot. Replace [p] with the prefix you entered for the bot when running it.

After that type this command in the server or dms of the bot:

[p]repo add dualmoon https://github.com/dualmoon/Cogs.v3

After that, it will ask to agree that you are installing a third-party repo. Simply type I agree.

Then type the following commands:

[p]cog install dualmoon webthing
[p]load webthing

Now when you will come to your repl you will see that the bot established a webserver in your repl.

Now it's time to do the uptime robot thing! This is very easy!

Again to make this tutorial short, please CLICK HERE for a detailed guide on how to setup uptimerobot. Thank you for investing your time reading this tutorial, if you need any help, please Join this Server and contact YellowBanana to get the help! Peace Out :)

Comments
hotnewtop
CodeLongAndPros (1624)

Lamo you're overwriting your venv...

xTurbo21 (0)

I guess this doesn't work anymore :')

Zombiebro (0)

After 6-12 hours bot gets crash and it's never get start again any way to fix

iamsami (4)

I did all the steps and my bot went offline at night when I was sleeping (and this happened twice) and when I checked the uptime robot it said 100% uptime, and when I visited my repl web it showed this "exit status 127".

YellowBanana (17)

I know about this error, i even contacted AllAwesome, he said our repls are not reliable to stay 24/7. For some reason idk why is this happening @iamsami

iamsami (4)

So... Hosting red bot on replit is useless because my bot went down after probably 20 hours and was never online again.

sammaslow8 (0)

I get this error

´Repl.it: Updating package configuration

--> python3 -m poetry add tqdm pymongo apsw babel yarl aiohttp appdirs distro aiohttp-json-rpc colorama asyncpg motor fuzzywuzzy uvloop markdown click packaging

[RuntimeError] section not found in pyproject.toml
exit status 1

Repl.it: Package operation failed.´

YellowBanana (17)

@sammaslow8 Hmmmm........Repl.it is auto updating packages. I don't know How do we lock them.

sammaslow8 (0)

@YellowBanana Yep, sometimes with packages I am on the latest version but it changes it up to an older version.
Pretty wierd.

AnshAg2007 (1)

Oh!Hi Banana! Hope You Remember me!