Options
All
  • Public
  • Public/Protected
  • All
Menu

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!");
          }
        }
      }
    }
  });

})();

Index

Variables

Const API_URL

API_URL: "https://www.hackmud.com/mobile/" = "https://www.hackmud.com/mobile/"

Const debug

debug: IDebugger = Debug("hackmud-chat:channel")

Functions

random

  • random(low: number, high: number): number
  • Parameters

    • low: number
    • high: number

    Returns number

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc