This Userbot can be deployed with four different ways. Which are Heroku, Docker, Zeet and Legacy way.
Termux - Run the Userbot in Termux (mobile).
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.
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/Userge.git
Note: You can add -b flag to select branch which you want to be cloned
Example branch master cloning code:
git clone -b master https://github.com/UsergeTeam/Userge.git
Go to the working directory by running:
$ cd Userge
Open & set all the necessary config.env 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 :
-d: (detach) This will make your docker running even if you exit your console
--restart on-failure: Docker container will automatically restart if there is a failure on the running system
--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/Userge/alpha/config.env.sample -O config.env vim config.env
Download the yml file for docker-compose
$ wget https://raw.githubusercontent.com/UsergeTeam/Userge/alpha/resources/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
- Python 3.8 or higher version
- Mandatory Vars
1. Install required package
$ sudo apt install tree wget2 p7zip-full jq 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/Userge.git && cd Userge
3. Install Requirements
$ pip install -r requirements.txt
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
Config Vars / Setting Up Vars
Config vars are basically the variables which configure or modify userbot’s 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.
API_ID and API_HASH
Vars Defined for your Mode
Note: These are the minimum required vars need to setup to make userbot functional.
G_DRIVE_CLIENT_ID & G_DRIVE_CLIENT_SECRET
UserGe has many non-mandatory vars which are used for Extra features.
1. API_ID and API_HASH
Go to my.telegram.org then Enter your Phone Number with your country code.
After, you are logged in click on API Development Tools.
Enter Anything as App name and App short name, Enter my.telegram.org in url section
That’s it, You”ll get your API_ID and API_HASH Var.
First, Go to cloud.mongodb.com then Sign Up there.
Login or Sign Up (Create an Account) there. If you don’t have an Account!
After Login, You’ll be on their Dashboard Page
Choose an option Build a Cluster (as the shown picture below)
Now, You’ll see Pricing Plan section.
Here, We going to use Free Plan for our userbot
After that, You have to select Region and Server. Where your Database server will host.
Tips: Select the Nearest server from your location so it won't take long time to connect
- At last, Click on Create Cluster.
You have to wait for some time at this Page while your Database is being created.
After Created, Click on Network Access (Can see this option under Security section of Above Image)
You will see an option Add IP Adress. Click on that
Now, Allow Access From Anywhere. Then Confirm
Wait until the Status changes from Pending to Active
Go Back to Cluster option and Click on Connect.
Now. Fill any random Username and Password
Note: Don't use Special character in your Password like @#$% etc.
After filled, Click on Create MongoDB User.
There you are, Select Choose a connection method
Choose Connect Your Application
Now, Select DRIVER as
Pythonand VERSION as
3.6 or laterthen Copy the Database link Shown below
- Replace <password> with your given Password and <dbname> with “test” or “cluster0” and remove <> symbols.
That’s it. You have got your DATABASE_URL Var value.
Here, You need Log Channel Id to get all logs and Traceback errors of your UserBot.
Create a Private Channel on your Telegram.
Type and send any Message on your channel.
Now, Forward your Message to @ShowJsonBot.
Bot will send you json formated data of your message.
Find “forward_from_chat” section in the message. you’ll see the “id” starting with
Copy the id with included hyphen (
-) and Paste into LOG_CHANNEL_ID Var.
Note:- Don’t forget to add your Bot as administrator in log channel.
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
You just need to make a new Private Group on Telegram.
Add @MissRose_Bot in your Private Group from Add Member > Search “@MissRose_Bot” and then Add.
After added, Just type “/id” in the chat.
You’ll get the id of your channel or group.
Note: Changing Group Type to Public may give you an issue in Userbot. To Fix this, Put Public group id in var.
Userge has a plugin repository where extra plugins are available. A place collection of all the plugins for Userge UserBot made by awesome people who are not in Userge dev team. We saying this as Unofficial Plugins.
LOAD_UNOFFICIAL_PLUGINS = True
To load these all Plugins you have to set the var value
"True" while deploying userbot. Alphabets case must be or lower case.
Fork this Repo. Now just the add your’s desired Custom plugins you want to install while starting the userge. Copy your repo link and use it as value of above var. This way you haven’t need to fork and edit unofficial plugins repo anymore.
This will assert that there is only one running Userge instance to prevent from AUTH_KEY_DUPLICATED error.
Set the number of workers count you want, Defaults are currently depends on CPU Cores, Basically, It’s the number of CPU Core.
Telegram chat id for post updates of rss feeds if you have added feed urls.
6. 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
- Go to console.developers.google.com and Sign In with your Account.
You’ll see the Dashboard Page.
Now, Search “Drive API” in the top of the Box.
Select Drive API and Enable it.
- Give a Name of your Project and Click on Create.
- At the Right Side, You’ll see Create Credentials option. Click on it.
- Click on OAuth consent screen option.
Select User Type as External and Create
Give a Name of your Application and Save
- You’ll see OAuth consent screen dashboard page.
After that, Now time to Publish your App Click on that.
then Confirm, Now start creating the Api Keys which we use in Userge.
- Now, Click on Credentials
- Then, Create Credentials and Select OAuth client ID
- Choose Desktop App and Click on Create
- That’s it… You have got your both G_DRIVE_CLIENT_ID & G_DRIVE_CLIENT_SECRET Var.
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.
You can rename the directory of your downloads folder. by default all your files will be downloaded in “downloads” folder.
Select your Preferred language. For example: If English value will be
This var is used for Currency converter & Exchange Rate in Plugin. If you don’t want this you can leave this var value blank.
- Click on Get Your Free API Key.
Now, Enter your Email Address, Check the Captcha.
And last, Click on Get Your Free 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.
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
Go to http://eepurl.com/bOLOcf and Fill your details.
After fill, Click on Subscribe.
That’s it, Check your Email Address to get your API Key.
Copy API Key and Fill in the OCR_SPACE_API_KEY value.
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
Get it from @UsergeAntiSpamBot in Telegram.
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.
- Get SpamWatch API from @SpamWatch on Telegram.
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.
- To get Weather API, visit openweathermap.org.
- When you open the url page, you’ll see the API option on top.
- To Get API Key, You must Sign Up to the website.
- After successful SignUp, You’ll see API Keys option, Click there.
- That’s it… You have got your 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
- Go to www.remove.bg/api.
- Click on Get API Key, and Sign Up to the website.
- Click on API Key tab option. Then Click on Show.
That’s it… You have got your API Key.
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.
Command Trigger needed to trigger your userbot to execute your command. This can be only set as one Symbol (Special Character)
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.
To use your Userge Userbot as default with all regular Updates and Patches also without customizing or modifying as your own choice this must be filled with Userge Main Repository URL in value.
For Customized or Modified Repository
If you plan to use this userbot with your own customized or modified code. You must fill your own Forked Userge Repository URL in UPSTREAM_REPO Var value.
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:
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:
While you use
.kang command it will use your @username as Sticker Pack Name. You can set Custom Stick PAck name by filling this var value.
You can set your own custom media for
Only these formats can be accepted for this Var value.
A link to message (Only Message link)
- Chat and Message id separated by
- A telegraph link
To work some Heroku compatible modules this var value required to Access your account to use
You can get this value from:
You have to Enter the app name which you gave to identify your userbot in Heroku.
Custome max audio(music) duration for voice call plugin. set
MAX_DURATION in variables with your own time(seconds), Default to 900 seconds.
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.
You can get this Var value using two ways.
The First Way:
- Get this using @genStr_Bot
The Second Way:
skipin the value while deploying the bot.
- After deployed, You must off the Dyno from Resource tab.
- Then click on More in the top right corner and Run Console.
- In Console, Type
bash genStrand fill the details.
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
BOT_TOKEN - Get it from @Botfather in Telegram.
OWNER_ID - Your user id (not username) Get it by using command
/idon the Group in the reply to your message where Rose Bot was added.
Make Sure, you set up these settings while making bot via Bot Father.
- Group privacy - Turn this OFF
- Allow groups - Turn this ON
- Inline mode - Turn this ON
- Add bot To your Log Channel
3. DUAL MODE
Use UserGe with both Userbot and Assistant bot.