Commit 14bf7ae
Changed files (1)
src
bridge
src/bridge/README.md
@@ -5,43 +5,50 @@ Use third-party bots to finish some tasks.
## Preliminary
cid: chat_id
+
mid: message_id
## Scenario
-1. A user sends us a message, named MSG-A
+1. A user sends us a message containing a task to be completed, referred to as MSG-A.
2. We first reply to MSG-A with a progress updating message, named MSG-UPDATE. (Like "Processing your request...")
-3. Then we construct a special message (Named MSG-B) which can trigger the function of the third-party bot (bridgebot).
- We log the chat_id (MSG-A's cid) and message_id (MSG-A's mid) to #ID tag in the MSG-B, format: #ID=(MSG-A's cid, MSG-A's mid)
- And log the MSG-UPDATE tag in this format: #PROGRESS=(MSG-UPDATE's cid, MSG-UPDATE's mid) to MSG-B
- More info can also be logged in MSG-B, like #URL, ...
+3. Then we construct a special message (named MSG-B) which can trigger the task of the third-party bot (bridgebot).
+
+ We log the `cid` and `mid` of MSG-A into MSG-B in this format: #ID=(MSG-A's cid,MSG-A's mid)
+
+ And log the `cid` and `mid` of MSG-UPDATE into MSG-B in this format: #PROGRESS=(MSG-UPDATE's cid,MSG-UPDATE's mid)
+
+ More info can also be logged into MSG-B, like #URL, ...
4. Send MSG-B to bridgebot to finish the task.
5. After the task is finished, the bridgebot will send us a new message containing the task results, named MSG-RES.
-So, we can retrieve the last message sent from us (MSG-B) to get the #ID tag and MSG-UPDATE tag, and then forward MSG-RES to MSG-A.
+
+ So, we can retrieve the last message sent from us (MSG-B) to parse the #ID (MSG-A) and #PROGRESS (MSG-UPDATE) info, and then forward MSG-RES to MSG-A.
6. Finally, we delete MSG-UPDATE.
-For example, a user send us a douyin link which need to previewed. (MSG-A)
+## Example
+
+For example, a user send us a douyin link which need to previewed. MSG-A `cid=-1001234455, mid=2385`
We want to use @ParsehubBot to finish this task.
-First, we reply to MSG-A with a progress updating message. (MSG-UPDATE)
+First, we reply to MSG-A with a progress updating message. MSG-UPDATE `cid=-1001234455, mid=2386`
Then we construct a special message (MSG-B) which can trigger the function of @ParsehubBot:
```txt
#URL=( https://v.douyin.com/helloworld )
-#ID=(-1001234455, 2385)
-#PROGRESS=(-1001234455, 2386)
+#ID=(-1001234455,2385)
+#PROGRESS=(-1001234455,2386)
```
Send MSG-B to @ParsehubBot to finish the task.
After the task is finished, @ParsehubBot will send us the douyin video, named MSG-RES
-We retrieve the chat history of @ParsehubBot to get last message sent from us (MSG-B) and parse it to get cid= -1001234455, mid= 2385, and then forward MSG-RES to MSG-A.
+We retrieve the chat history of @ParsehubBot to get last message sent from us (MSG-B) and parse it to get `cid=-1001234455, mid=2385`, and then forward MSG-RES to MSG-A.
-Finally, we delete MSG-UPDATE (cid= -1001234455, mid= 2386).
+Finally, we delete MSG-UPDATE `cid=-1001234455, mid=2386`.