-
Confirm that the group is a supergroup before exporting, otherwise importing will prompt an error message.
-
Use Telegram Desktop, Click on the top right corner of the group
Export chat history
, choose JSON (text). -
python3 import_history.py
, enter JSON file path (import_history.py).
-
Download .config.json, put it in the previously created configuration folder (
tgbot/
). -
Modify the second line of the file
.config.json
, changefalse
totrue
. -
Add the user's numeric ID in the 'group.admins' field according to JSON syntax.
Note that users still need to be administrators in the relevant group to enable, stop robots, and delete messages.
In this mode, there is no need to pull Bots into the group, but it is necessary to log in to the Telegram account as an intermediary to transmit messages, and the logged in user becomes the command administrator.
-
Login to https://my.telegram.org/auth get Telegram API
ID
andhash
. -
Edit
docker-compose.yml
.
- USER_BOT=1
- USER_BOT_API_ID=1234567
- USER_BOT_API_HASH=xxxxxxxxx
-
docker-compose up -d
to run in background, rundocker exec -it tgbot python userbot.py
, Login after entering username and verification code. -
Chat with your bot,
/start <GroupID>
to enable bot,/stop
、/delete
as the same.
There is not much difference in speed compared to polling mode.
-
DownloadCaddyfile、put it in the previously created configuration folder (
tgbot/
). -
Modify the domain name, path, and other information of the
Caddyfile
, Multipleroute
correspond to multiple bot containers (if needed). -
Edit
docker-compose.yml
, changeBOT_MODE
value towebhook
, changeURL_PATH
andHOOK_URL
. -
If already have an HTTP (s) server, you can reverse it yourself.