Deployment

This Userbot can be deployed with four different ways, which are Termux, Heroku, Docker and Legacy way.

Termux - Run the Userbot in Termux (mobile).

Heroku - Run the Userbot in a cloud application. It’s the easy way to use Userge!

Docker - Run the Userbot in an isolated application that doesn’t interfere to the system but uses your same system hardware and internet. You Just have to fill mandatory vars and 2-3 line commands to Run Userge on Docker.

Legacy-Method - Using Python and all those packages which are required to Run this bot. You can also say a Manual way to deploy a userbot.

Deploy to Heroku

Fork the Helper Script Repo then Rename your fork with some random names and deploy . Deploy Link will be in Format given below.

https://heroku.com/deploy?template=https://github.com/username/repo_name

Deploying with Docker 🐳

1. Install Docker

Follow the official Docker Installation Guide

You need to clone Userge repository first by running:

git clone https://github.com/UsergeTeam/Loader.git

Go to the working directory by running:

cd Loader

Open & set all the necessary vars in config.env file. For example, the config.env is in config.env.sample:

mv config.env.sample config.env

Then edit config.env with your favorite text editor and save it!

Build Docker image by running:

docker build . -t userge

Run container by:

docker run -d --restart on-failure --name userge_1 userge

Explanation of the command flags above :

  1. -d: (detach) This will make your Docker running even if you exit your console.

  2. --restart on-failure: Docker container will automatically restart if there is a failure on the running system.

  3. --name userge_1: Custom name for your container, instead of using the container ID, this makes it easier for you to find it.

To stop Docker container, run:

docker container stop userge_1

To get container logs:

docker logs userge_1 

Run userge with Docker-Compose 🐋

1. Install Docker-Compose

The easiest way to install docker-compose is:

sudo pip install docker-compose

OR, also you can check other official methods of installing Docker-Compose here.

2. Run Userge

We don’t need to clone the repo (yeah Docker-Compose does that for us)

Setup configs (Download the sample config file)

mkdir userge && cd userge
wget https://raw.githubusercontent.com/UsergeTeam/Loader/master/config.env.sample -O config.env
vim config.env

Download the yml file for Docker-Compose

wget https://raw.githubusercontent.com/UsergeTeam/Loader/master/docker-compose.yml

Finally, start the bot

docker-compose up -d

The bot should be running now. Check logs with

docker-compose logs -f

Q. How to Stop the Bot?

To stop the running bot in Docker, use this Stop Command

docker-compose stop

This will just stop the containers. Built images won’t be removed. So next time you can start with this command

docker-compose start

It won’t take time for building from scratch.

To delete the built image of Bot, use this Down command

docker-compose down

You can stop and delete the built images also. So next time you have to do this to start the bot.

docker-compose up -d

Q. How to Update the Bot?

docker-compose up -d

Changes will be fetched from git repo. You can change Repo URL from docker-compose.yml file.

Deploying with Legacy Method

Requirements:

1. Install required package

sudo apt install tree wget2 p7zip-full ffmpeg wget git
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo apt install ./google-chrome-stable_current_amd64.deb

Notes: Recommended FFMPEG version is 4.3 or above

2. Clone the Repository

git clone https://github.com/UsergeTeam/Loader.git && cd Loader

3. Install Requirements

bash install_req

4. Create config.env as given config.env.sample and Fill that

cp config.env.sample config.env

5. Get String Session and Add it to config.env

bash genStr

OR you can use this @genStr_bot to get the string.

6. Finally Run the Userge

bash run

Windows

1. Install Chocolatey

Open Powershell as admin and run

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) 

2. Install Other Packages

Only Git is Compulsary

choco install git
choco install wget
choco install ffmpeg

3. Clone the Repository

 git clone https://github.com/UsergeTeam/Loader.git && cd Loader

4. Install Requirements

Open install_req.bat

5. Create config.env as given config.env.sample and Fill that

 copy config.env.sample config.env

6. Get String Session and Add it to config.env

Open genStr.bat OR you can use this @genStr_bot to get the string.

7. Finally Run the Userge

Open run.bat OR run

py -m loader

Config Vars / Setting Up Vars

Config vars are basically the variables which configure or modify userbots to function, which are the basic necessities of plugins or code to work. You have to set the proper mandatory vars to make it functional and to start the basic feature of bot.

You can leave non mandatory vars for now and can add them later.

List of Available Vars in Userge

Click on any var from the list below to get its detailed description and setup guide.

Mandatory Vars:

  1. API_ID and API_HASH

  2. DATABASE_URL

  3. LOG_CHANNEL_ID

  4. Vars Defined for your Mode

Note: These are the minimum required vars need to setup to make userbot functional.

Non-Mandatory Vars:

  1. CMD_TRIGGER

  2. WORKERS

  3. RSS_CHAT_ID

  4. G_DRIVE_CLIENT_ID & G_DRIVE_CLIENT_SECRET

  5. G_DRIVE_IS_TD

  6. G_DRIVE_INDEX_LINK

  7. DOWN_PATH

  8. PREFERRED_LANGUAGE

  9. CURRENCY_API

  10. OCR_SPACE_API_KEY

  11. WEATHER_DEFCITY

  12. USERGE_ANTISPAM_API

  13. SPAM_WATCH_API

  14. OPEN_WEATHER_MAP

  15. REMOVE_BG_API_KEY

  16. G_DRIVE_PARENT_ID

  17. ASSERT_SINGLE_INSTANCE

  18. SUDO_TRIGGER

  19. FINISHED_PROGRESS_STR

  20. UNFINISHED_PROGRESS_STR

  21. CUSTOM_PACK_NAME

  22. ALIVE_MEDIA

  23. HEROKU_API_KEY

  24. HEROKU_APP_NAME

  25. MAX_DURATION

  26. YOUTUBE_DL_PATH

  27. CRYPT

  28. APPDRIVE_EMAIL & APPDRIVE_PASS

 UserGe has many non-mandatory vars which are used for Extra features. 

1. API_ID and API_HASH

  1. Go to my.telegram.org then Enter your Phone Number with your country code.

  2. After, you are logged in click on API Development Tools.

  3. Enter Anything as App name and App short name, Enter my.telegram.org in url section

  4. That’s it, You”ll get your API_ID and API_HASH Var.

2. DATABASE_URL

Clusters

Pricing Plans

Create Cluster page

Tips: Select the Nearest server from your location so it won't take long time to connect

Clusters page

You have to wait for some time at this Page while your Database is being created. 

Whitelist IP Address page

 Wait until the Status changes from Pending to Active. 
Note: Don't use Special character in your password like @#$% etc. 
mongodb+srv://<username>:<password>@mongos0.example.com/myFirstDatabase?retryWrites=true&w=majority

That’s it. You have got your DATABASE_URL Var value.

3. LOG_CHANNEL_ID

Here, You need Log Channel ID to get all logs and Traceback errors of your UserBot.

For more information… Watch this Video

—- [Optional] —-

Instead of making Channel, you can also create a Group to get your logs and this is the very easy way to get. Let’s Do it.

Note: Changing Group Type to Public may give you an issue in Userbot. To Fix this, Put Public group ID in var.

Non-Mandatory Vars

1. CMD_TRIGGER

Command Trigger needed to trigger your userbot in User mode to execute your command. This can be only set as one Symbol (Special Character)

eg. !

2. WORKERS

Set the number of workers count you want, Defaults are currently depends on CPU Cores, Basically, It’s the number of CPU Core.

3. RSS_CHAT_ID

Telegram chat ID for post updates of rss feeds if you have added feed urls.

4. G_DRIVE_CLIENT_ID & G_DRIVE_CLIENT_SECRET

This Vars is used for Google Drive Feature. If you want to download or upload your files and document into Google Drive, you must set this var value.

So, Let’s Start

gdrive client id and secret var

gdrive project name

create credential

oAuth consent screen

User Type

gdrive oauth

publish your app

credentials

oauth client id

Select Desktop App

id created

5. G_DRIVE_IS_TD

If you are using Team Drive (TD) then set this value as True. Otherwise leave as it is default. To know more about TD, You can find it on Web.

If you have created Google Drive Index, You can use it as well to output the Index Link after Uploading the file to Google Drive. Just fill your url into the value.

eg. https://example.example.workers.dev

7. DOWN_PATH

You can rename the directory of your downloads folder. by default all your files will be downloaded in “downloads” folder.

8. PREFERRED_LANGUAGE

Select your preferred language. For example: If English value will be

en

9. CURRENCY_API

This var is used for Currency converter & Exchange Rate in Plugin. If you don’t want this you can leave this var value blank.

Free api

currency api key

That’s It… Check your Email, You have received the API Key there. Confirm your Email Address and Fill the API Key in Value.

10. OCR_SPACE_API_KEY

OCR is used to read text from the images. You can also use OCR to read text from the image on Telegram from your Userbot. It helps you to copy texts from Images.

So, Let’s start getting the value of this var

ocr api

11. WEATHER_DEFCITY

To know Weather detail of your City, State. This value is required with OPEN_WEATHER_MAP var to work, you can also skip it as it is not mandatory.

Add Default city value for weather details,

eg. Delhi, India

12. USERGE_ANTISPAM_API

This is a var for Userge AntiSpam project. If you use this var, it bans banned/muted users in Userge AntiSpam in groups where you’re an Admin or Owner.

Get your personal token from @UsergeAntiSpamBot in Telegram.

13. SPAM_WATCH_API

Basically, It has a list of Spammer and they are listed in SpamWatch. If you use this var, It bans the SpamWatch banned users in the groups wherever you are at Admin or Owner post.

14. OPEN_WEATHER_MAP

As, If you are going to use this userbot also for checking Weather detail on your current City, State. Then, this var value is required to be filled with WEATHER_DEFCITY var to work.

api weather

weather api key

api key of weather

open weather api key

15. REMOVE_BG_API_KEY

This API is used for the Removing the Background from Images (removebg module).

So, Let’s start getting the value of this var

remove bg

remove backgroup api

That’s it… You have got your API Key.

16. G_DRIVE_PARENT_ID

You need to enter the Folder Id of Google Drive. If you want to use Google Drive module to Upload or Download files from your Userge userbot.

For detailed Guide for getting this value can be found here.

17. ASSERT_SINGLE_INSTANCE

This will assert that there is only one running Userge instance to prevent from AUTH_KEY_DUPLICATED error.

18. SUDO_TRIGGER

SUDO Trigger also needed to trigger your userbot to execute command whoever you gave sudo permission to use your userbot or trigger your bot mode. This also can be only set as one Symbol (Special Character) but must be different from CMD_TRIGGER Var value.

eg. $

19. FINISHED_PROGRESS_STR

To change the Progress Bar of Download and Uploads, you must fill Single text of filled bar line of character which can be shown in Finish bar.

You can Select any character from these listed sites:

20. UNFINISHED_PROGRESS_STR

To change the Progress Bar of Download and Uploads. You must fill Single text of Unfinished bar line of character which can be shown in Unfinished bar.

You can Select any character from these listed sites:

21. CUSTOM_PACK_NAME

While you use kang command it will use “@username's kang pack: Vol 1” as Sticker Pack Name. You can set Custom Stick PAck name by filling this var value.

22. ALIVE_MEDIA

You can set your own custom media for alive command.

Only these formats can be accepted for this Var value.

  1. A link to message (Only Message link)

    https://t.me/theuserge/8
    
  2. Chat and Message id separated by |
    -1001454692938|8
    
  3. A telegraph link
    https://telegra.ph/file/e912739114b56059a8cf3.jpg
    

23. HEROKU_API_KEY

To work some Heroku compatible modules, this var value required to Access your account to use die, usage and sleep commands.

You can fill this var using your API key or Authorization token.

You can get this value from:

Heroku Account

24. HEROKU_APP_NAME

You have to Enter the app name which you gave to identify your userbot in Heroku.

25. MAX_DURATION

Custom max audio(music) duration for video chat plugin. set MAX_DURATION in variables with your own time(seconds), Default to 900 seconds.

26. YOUTUBE_DL_PATH

Optional variable to use custom youtube_dl for utube.py, Default to youtube_dl, For more information type #ytdl in Userge OnTopic group.

27. CRYPT

Variable to use GDTOT for parser, get this by reading Help

28. APPDRIVE_EMAIL & APPDRIVE_PASS

Variables to use appdrive commands, get them from their site .

UserGe Modes

A mode defines the client, whether you want to use Userge on user account or as an Assistant bot.

This both also can be possible, Userge as a userbot and as an Assistant bot. You need to fill all vars for User Mode and Bot Mode. check Dual Mode

1. USER MODE

UserGe as a userbot with a user account requires this var.

SESSION_STRING

You can get this Var value using two ways.

The First Way:

The Second Way:

For more details, check this video: on 11:04 then 19:40 to 23:00

2. BOT MODE

UserGe as an Assistant bot to execute your commands only from the Bot.

BOT_TOKEN & OWNER_ID

Make sure you’ve set up these settings while making bot via BotFather.

  1. Group privacy - Turn this OFF
  2. Allow groups - Turn this ON
  3. Inline mode - Turn this ON
  4. Add bot to your Log Channel

3. DUAL MODE

Use UserGe with both Userbot and Assistant bot.