0.1.5 • Published 4 years ago

matrix-lastactive v0.1.5

Weekly downloads
82
License
MIT
Repository
github
Last release
4 years ago

matrix-lastactive

A small utility to determine when a user was last active.

How to use

Install with

npm i matrix-lastactive

To use

import { MatrixActivityTracker } from "matrix-lastactive";

// Create the tracker object.
const tracker = new MatrixActivityTracker({
    homeserverUrl: "https://localhost",
    accessToken: "ABCDE",
    serverName: "localhost",
    defaultOnline: false,
});

tracker.isUserOnline(
    "@Half-Shot:half-shot.uk"
    1000 * 60 * 60 * 24 // 24 hours
).then((isOnline) => {
    if (isOnline) {
        console.log("Half-Shot is online");
    } else {
        console.log("Half-Shot is offline");
    }
});


// You could also plug the library into an event handler..
myfakeemitter.on("event", (event) => {
    // ..and keep track of how long ago you saw a message from a user.
    tracker.bumpLastActiveTime(event.sender);
});

Contact

If you need help with this library, please contact @Half-Shot:half-shot.uk

0.1.5

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago