gcentauri / tuvix

A Matrix client in Erlang
GNU General Public License v3.0
0 stars 0 forks source link

Feature: @tuvix commands #8

Closed ghost closed 5 years ago

ghost commented 5 years ago

This PR isn't ready. I haven't run the code yet. Just wanted to push it for an opinion.

After realizing that matrix transaction IDs are just supposed to be unique across a single auth token, I changed the approach away from the one I mentioned in #1.

Now a bot's State map contains a txn_id field. You can look at the message case for the {get_txn_id,Caller} message in tuvix:loop to see how it is meant to work.

The idea is that, if an action handler wants to send an event to a room, it needs to first request a new transaction ID from the bot using a synchronous function tuvix:request_txn_id, and then it proceeds to make whatever request it needs to make.