npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

hackmud-chatapi

v0.11.0

Published

A wrapper for the hackmud chat api written using ES6 classes and promises.

Downloads

15

Readme

Hackmud-ChatAPI

Class: Account

new Account(token, [tick_rate])

Creates a new account associated with the token specified token. For more information about tick_rate, see account.tick_rate

Account.getToken(pass)

Fetches a new chat token from the specified pass.

Event: 'message'
  • user <string> The user on which received this message
  • message <Message> The message itself

Fired whenever a message is received on this account.

account.destroy()

Destroys this account. This calls destroy on the agent and stops the tick mechanism. You must call this function before exiting. Otherwise, the tick mechanism will always keep the event loop busy, and the node process will never exit.

account.fetchUsers()

Fetch the userdata for this account. The data will be stored in account.userData, the usernames in account.users. The Promise resolves to the new value of account.users.

account.getHistory([usernames][, before])

Get the chat history of this account.

account.getUser(username)

Get a specific user. If the user does not exist on this account, this method returns null. Note: This function performs no update checks and works solely off of the value of account.users. It is thus recommended to call account.fetchUsers() before calling this method.

account.request(endpoint[, data])

Send a request on behalf of this account. The account's agent and token will be automatically used/added for/to the request. The Promise returned resolves with the body of the reply.

account.send(sender, channel, message)

Send a message to a channel. Acts like chats.send ingame. The message may be looped back in a [message] event(#eventmessage).

account.tell(sender, to, message)

Send a tell to a user. Acts like chats.tell ingame. The message may be looped back in a message event.

account.tick()

Perform a tick for this account. User code should rarely, if ever, call this function. The new tick is scheduled after this method completes.

account.agent

The agent this account uses for outgoing requests. This agent is created with {keepAlive: true}.

account.last_tick

The last time a tick completed, but before the respective events are fired.

account.tickTimeout

The timeout of the next tick. May be stale (used up) or null if tick_rate is Infinity.

account.tick_rate

The amount of milliseconds delay between ticks. Should be above 800 and never below 700 (unless you enjoy getting errors about polling too fast). Takes effect on the next tick.

account.token

The token for this account.

account.userData

The user data for this account. Filled by account.fetchUsers.

account.users

The usernames for this account. Filled by account.fetchUsers.

Class: User

Event: 'message'

Fired whenever a message is received for this user.

user.getHistory([before])

Get the chat history of this user.

user.send(channel, message)

Send a message to a channel. Acts like chats.send ingame. The message may be looped back in a message event.

user.tell(to, message)

Send a tell to a user. Acts like chats.tell ingame. The message may be looped back in a message event.

user.account

The account this user is associated with.

user.username

The name of this user.

Class: Message

Represents a message received from the server.

message.channel

If this message was received from a channel, the channel name. Otherwise, null.

message.content

The content of this message.

message.from_me

Whether this message was sent from a user associated with this account. This indicates a possible loopback message or you sending messages ingame.

message.sender

The name of the user who sent this message.

message.to

If this is a tell, the name of the user to which this tell was sent. Otherwise, null.

message.type

The "special type" of this message, if any. Currently, there are only two types: "join" for channel join messages and "leave" for channel leave messages.

cfg

An object used for various configuration. Contains the following properties:

cfg.HACKMUD_ADDRESS

The address of the server this wrapper talks to. Only change if you know what you are doing.

cfg.REQUIRE_TLS_SECURE

Whether to require a secure TLS connection while talking to the server. Only set to false if you know what you are doing.