npm.io
0.4.2 • Published 3 years ago

tsmi

Licence
MIT
Version
0.4.2
Deps
4
Size
41 kB
Vulns
1
Weekly
0

tsmi

Better Misskey API Client for TypeScript/JavaScript

Thanks

  • MiPA and MiPAC have been helpful in many of the tsmi implementations.
    • Thanks also to Discord.py, the source of MiPA(C) implementation.
  • misskey-js

Usage

import Client from "tsmi";

const client = new Client({
  host: "https://<your-misskey-server-url>",
  token: "<YOUR_TOKEN_HERE>",
  channels: ["main", "localTimeline", "homeTimeline"],
});

client.once("ready", async (me) => {
  console.log("Client ready!");
  const user = await me.user.getMe();
  console.log("Logged in with @", user.name);
});

client.on("noteCreate", (note, timeline) => {
  if (timeline === "localTimeline") {
    console.log(note); // Only take local timeline notes
  }
});