Slider

How To Host Telegram Bot on Digital Ocean

Telegram Bot on Digital Ocean - Infotel - Infotel bot - Host Telegram Bot on Digital Ocean telegram marie bot on Digital Ocean with Unlimited Filters
0

How to host telegram Marie bot on Digital Ocean with Unlimited Filters by hosting a Postgres server ourselves

* No Dyno Issus 
* Unlimited Filter 
* Better Speed 
* Less response time 
Your BOT will be up and running as long as you pay for VPS 😋

1. Lets create a Digital Ocean Account first!

Digital Ocean: https://cloud.digitalocean.com/registrations/new

Enter required details and signup with Digital Ocean!

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. 

To avail digital ocean 100$ free credits promo offer, register and sign in through this link : https://m.do.co/c/aa2ff0eeaa5e

2. Making an instance in Digital Ocean

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.

Deploy instance.

3. Connecting to the instance!

- Connecting to instance with our ssh key

        hostname : root@IPV4address

- 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>

Enter a new username and password (typed password will be invisible) and press enter for all other values to leave it to default

        sudo usermod -aG sudo <newusername>

        su - newusername

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

        su - newusername

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 Uri : 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, dont 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 URL 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 dirrectory

        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