0.5.1 • Published 6 years ago

hackmud-chat v0.5.1

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

hackmud-chat

Documentation: https://hackmud-unofficial.github.io/hackmud-chat

As this package is made with typescript, you don't need to install any typings.

You can also use it with javascript.

npm install hackmud-chat --save

Example (in typescript)

import { ChannelMessage, HackmudApi, Message } from "hackmud-chat";

(async () => {

  const client = new HackmudApi(/* if you have a token (>5 chars) put it here */);
  await client.getToken("pass"); // otherwise get the token using the pass
  const account = await client.getAccountData();
  account.poll(async (messages: Message[]) => {
    if (messages && messages.length > 0) {
      for (const msg in messages) {
        if (messages[msg]) {
          const message = messages[msg];
          if (message instanceof ChannelMessage) {
            // tslint:disable-next-line:no-console
            console.log(message.toString());
            // message.channel.send("Hey!");
          }
        }
      }
    }
  });

})();
0.5.1

6 years ago

0.5.0

6 years ago

0.4.1

6 years ago

0.4.0

6 years ago

0.3.2

6 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.2.3

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.1

6 years ago