O
O
OkLadnoHorosho2021-08-17 10:31:54
Python
OkLadnoHorosho, 2021-08-17 10:31:54

Where to run the code?

Good afternoon! I am new to programming and the question arose, where to run the codes? Let's say there is a discord bot code. When I run it through the command line, does it not eat up the resources of my device? And if I need to make the bot active 24/7, but when the device is turned off, the code stops. Through what then it is necessary to start the codes? Hosting or something else? Can you recommend :0

Answer the question

In order to leave comments, you need to log in

5 answer(s)
L
Loshara Tupoi, 2021-08-17
@OkLadnoHorosho

First of all, register an account on Heroku
Then you should install Heroku CLI and Git
After that, follow the instructions:
Create a runtime.txt file in the root directory of your bot, where you specify the version of python
Example:
python-3.9.0
Create a requirements.txt file, and through Enter you specify all the modules that needed for the bot to work
Example:

discord
config
requests
youtube_dl
asyncio
PyNaCl
ffmpeg
colorama

Create a Procfile ( IMPORTANT! The file starts with a capital letter and has no extension!) enter the
following:
worker: python main.py\
where mai.py is the file that starts the bot
Open cmd
heroku login (откроется страничка для авторизации)

cd path/to/your/directory/with/your/bot

git init

git add .

git commit -m "First release"

heroku create <любое слово, в будующем это будет название бота>

git remote -v

git push heroku master

heroku ps:scale worker=1

Everything! The bot is deployed . In the future, in order to update it:
cd your/bot/folder
git add .
git commit -am "your comment"
git push heroku master

M
Maxim Siomin, 2021-08-17
@MaxSiominDev

Hosting must be purchased (free ones are also available)

S
Sergey Karbivnichy, 2021-08-17
@hottabxp

Raspberry Pi

I am new to programming and the question arose, where to run the codes? Let's say there is a discord bot code.
You will go far!
PS: That was sarcasm.

Z
Zagir Majidov, 2021-08-17
@Zagir-vip

Hello, you can buy hosting
Free hostings:
1.Heroku
2.GitHub

A
Alexander Nesterov, 2021-08-17
@AlexNest

Heroku .
There is a free shooting range for which x hours per month are available (560, like, 23 days in total), but if you add card data (I entered data from kiwi virualka), the number will increase to 1000.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question