This package has been deprecated

Author message:

This package is deprecated. See https://github.com/Half-Shot/matrix-lastactive/blob/master/README.md

matrix-lastactive
TypeScript icon, indicating that this package has built-in type declarations

0.1.5 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i matrix-lastactive

Weekly Downloads

4

Version

0.1.5

License

MIT

Unpacked Size

9.52 kB

Total Files

5

Last publish

Collaborators

  • halfshot