main

BridgeBot

Use third-party bots to finish some tasks.

Preliminary

cid: chat_id

mid: message_id

Scenario

  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 save necessary info into cache.

    • log the cid and mid of MSG-A
    • log the cid and mid of MSG-UPDATE

    More info can also be logged like url, …

  4. Send a message that can trigger the task of the third-party bot (bridgebot).

  5. After the task is finished, the bridgebot will send us a new message containing the task results, named MSG-RES.

  6. We retrieve the logged info from cache and forward MSG-RES to MSG-A.

  7. 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 cid and mid of MSG-A
    • log the cid and mid of MSG-UPDATE
    • log the symbol and interval
  • 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.