BridgeBot
Use third-party bots to finish some tasks.
Preliminary
cid: chat_id
mid: message_id
Scenario
A user sends us a message containing a task to be completed, referred to as MSG-A.
We first reply to MSG-A with a progress updating message, named MSG-UPDATE. (Like “Processing your request…”)
Then we save necessary info into cache.
- log the
cidandmidof MSG-A - log the
cidandmidof MSG-UPDATE
More info can also be logged like
url, …- log the
Send a message that can trigger the task of the third-party bot (bridgebot).
After the task is finished, the bridgebot will send us a new message containing the task results, named MSG-RES.
We retrieve the logged info from cache and forward MSG-RES to MSG-A.
Finally, we delete MSG-UPDATE.
Example
For example, a user send us “/price AAPL @15m” to get tradingview chart. (MSG-A)
We want to use @chartImgBot to finish this task:
(Optional) We reply to MSG-A with a progress updating message. (MSG-UPDATE)
We save the info into cache:
- log the
cidandmidof MSG-A - log the
cidandmidof MSG-UPDATE - log the
symbolandinterval
- log the
Send a message that can trigger the function of @chartImgBot:
/chart NASDAQ:AAPL 15m
After the task is finished, @chartImgBot will send us the chart image, named MSG-RES
We retrieve the logged info from cache and check if this photo is the symbol and interval we want. If so, forward MSG-RES to MSG-A.
Finally, we delete MSG-UPDATE.