Slider

How To Host Telegram Bot on Scaleway

telegram telegram bot , infotel , . Lets create a Scaleway Account first! https://console.scaleway.com/register Enter required details and signup wi
0

1. Lets create a Scaleway Account first!

Link: https://console.scaleway.com/register

Enter required details and signup with Scaleway !

Card verification is required for signup! You'll be charged some amount for verification and the same will be refunded within few hours. So don't worry. 

2. Making an instance in Scaleway

Choose appropriate plan!

Creating a SSH key
Download PuTTY: https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html

*Create a new SSH Public key and copy paste it in Instance config page.
*Save it as our Private key.
*Create instance.

3. Connecting to the instance!

- Connecting to instance with our SSH key

        hostname : root@ipaddress

- You'll be logged in as a root user!

- Create a new user with sudo privileges ( cause it's better that way)

        sudo adduser  <newusername>

        sudo usermod -aG  sudo  <newusername>

        su - <newusername>

- Now whenever you login to your instance, change to your user by;

        su - <newusername>

Some required commands,

         sudo apt update && sudo apt upgrade


NOTE : Use Enter key to run your commands. Use right click to paste your copied command into terminal.

4. Setting up your repository

Configure Marie Bot Repo;

Clone the source code of Marie

Source code : https://github.com/prgofficial/Marie-2.0-English

Create config.py file from sample_config.py

#Bot Token: from Bot Father
#Owner ID: from Rose ( /id )
#Owner username: Any name
#Database URL: Install Postgres server in our Instance and get

5. Install and setup a Postgres Server

Connect to your instance, then run;
         sudo apt-get update
         sudo apt-get install postgresql postgresql-contrib

Give sudo permission to user
         sudo usermod -aG sudo postgres

Set a new password
         sudo passwd postgres
Password will be invisible, don't worry!

Login to Postgres
         su - postgres

Create new user for psql
         createuser --interactive --pwprompt

# enter a name for user
# enter a password for user
# give superuser power


You can give any name and password!!

Create a database and assign user
        createdb -O <username> <newdbname>
;

Allow remote access
         nano /etc/postgresql/12/main/postgresql.conf

Uncomment, and change the value;

#listen_addresses = 'localhost'
to
listen_addresses = '*'


This will allow Postgres connections from anyone.
USE ctrl + o and press enter to save the file and ctrl + x to exit the editor


Allow Connections from everyone 
         nano /etc/postgresql/12/main/pg_hba.conf

Modify this section;

# IPv4 local connections:

host all all 127.0.0.1/32 md5

to;

# IPv4 local connections:

host all all 0.0.0.0/0 md5

this will allow anyone to connect to your db using the username and password!
USE ctrl + o and press enter to save the file and ctrl + x to exit the editor

Allow port 5432
         sudo ufw allow 5432/tcp

Restart postgres to apply changes
         sudo systemctl restart postgresql

Now, your DB Uri will be;
        postgres://username:pw@hostname:port/dbname

6. Hosting Marie repo

Connect to your instance using putty

connect again using putty or;

press ctrl + a + d to go back to your user from our current screen

Using screens is a better way to run your programs.
        screen -S marie

This will open a new screen inside our main terminal.

Clone your source code to your instance

        git clone <your_repo_url>

Enter your Github username and password and hit enter!

Change your current directory

        cd <reponame>

Install required dependencies.
        sudo apt install python3-pip
        pip3 install -r requirements.txt

Start your BOT !
        python3 -m tg_bot

Your BOT is ready to use :)
now your bot is ready with nearly unlimited filters....
:) thank you

Some Usefull commands;

> To detach from current screen
Ctrl + a + d ( hold Ctrl and press a and d sequentially )

> To see all active screens
screen -ls

> To attach to a screen
screen -r number

>To detach from a screen
screen -d number

>To logout from terminal with BOT running in screen
Ctrl + a + d

Credit: @PrGofficial
Documented by: @PrGofficial
0

No comments

Post a Comment

Disqus for infotelbot

disqus, infotelbot

DON'T MISS

beta, news, bot, features, bot, tutorial, Userbot, telegram
© All Rights Reserved
Made With By InFoTel