Telegram Private Message Chat Bot
This project has entered the state of update at will. If you have no objection to using .NET , you can consider using pmcenter as a solution for PM robots.
Warning: This bot is no longer under maintenance. You are better off with other solutions.
Create a Telegram robot and get a token
An external server, install Python and pip, and use pip to install python-telegram-bot==11.1.0
Create a bot and get its token
Install Python and pip, then use pip to install python-telegram-bot==11.1.0
Open config.json and configure
{
"Admin" : 0 ,
"//1" : "管理员用户ID(数字ID)(可以先不设) " ,
"Token" : " " ,
"//2" : "机器人Token " ,
"Lang" : " zh " ,
"//3" : "语言包名称"
} If the administrator user ID is not set in the previous step, the first user who sends /setadmin to the robot will become the administrator. After that, the administrator can be modified by modifying config.json
Open config.json and configure
{
"Admin" : 0 ,
"//1" : " Admin ID (A digital ID) " ,
"Token" : " " ,
"//2" : " Bot Token " ,
"Lang" : " en " ,
"//3" : " Language Pack Name (Be careful! It's 'en'!) "
} If you didn't set admin's ID previously, the user who sends /setadmin to the bot first will become the admin. You can edit config.json to change admin later.
Replace main.py and lang folders and run them again
Replace main.py and folder lang , then run main.py
python main.py
Reply directly to the message forwarded by the robot, and support text, stickers, pictures, files, audio and videos
Reply directly to the message forwarded by the robot to reply. You can reply text, sticker, photo, file, audio, voice and video.
Some forwarded messages are not convenient to view the sender's identity. You can query by replying to the message /info
You can reply /info to the message which you want to get its sender's info more clearly.
Send commands to the robot /togglenotification can enable/close message sending prompts
Effect:
Send the command /togglenotification to the bot to enable/disable the message sending notification
Effect:
Reply to a message /ban can prevent its sender from sending messages again
Reply to a message /unban or send /unban <数字ID> to unblock this user
Reply /ban to a message to block the sender of the message from sending messages to you
Reply unban to a message or send /unban <User ID> to unban a user
| Command | use |
|---|---|
| /ping | Confirm whether the robot is running |
| /setadmin | Set the current user as administrator |
| /togglenotification | Switch message sending prompt on state |
| /info | Query user identity |
| /ban | Block users |
| /unban <number ID (optional)> | Unblock the user |
| Command | Usage |
|---|---|
| /ping | Check if the bot is running |
| /setadmin | Set the current user as admin |
| /togglenotification | Toggle message sending notification status |
| /info | Inquire sender identity |
| /ban | Ban a user |
| /unban <ID (optional)> | Unban a user |