# msgroom-nightly

> A client for msgroom (nightly builds).

Latest version **2.0.0-ac016dabbe99a8cebc58bba6f9a5b9bb153e53c7** (published 2023-08-27) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install msgroom-nightly
pnpm add msgroom-nightly
yarn add msgroom-nightly
bun add msgroom-nightly
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 2.0.0-ac016dabbe99a8cebc58bba6f9a5b9bb153e53c7 |
| Published | 2023-08-27 |
| First published | 2023-06-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 118.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (Unknown) |
| GitHub stars | 4 |
| Author | NanderTGA |
| Maintainers | nandertga |
| Keywords | msgroom, orm, ts, typescript, w96, windows-96 |

## Links

- npm: https://www.npmjs.com/package/msgroom-nightly
- Repository: https://github.com/NanderTGA/msgroom-orm
- Homepage: https://github.com/NanderTGA/msgroom-orm#readme
- Issues: https://github.com/NanderTGA/msgroom-orm/issues
- npm.io page: https://npm.io/package/msgroom-nightly

## Dependencies (6)

- [he](https://npm.io/package/he.md) ^1.2.0
- [tslib](https://npm.io/package/tslib.md) ^2.5.3
- [typed-emitter](https://npm.io/package/typed-emitter.md) ^2.1.0
- [@nodelib/fs.walk](https://npm.io/package/@nodelib/fs.walk.md) ^2.0.0
- [socket.io-client](https://npm.io/package/socket.io-client.md) ^4.7.0
- [array-starts-with](https://npm.io/package/array-starts-with.md) ^1.1.15

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 2.0.0-ac016dabbe99a8cebc58bba6f9a5b9bb153e53c7 (latest) — 2023-08-27
- 2.0.0-1c5b1a66c73f5aa09cc17d1eaf0054e7037ab41a — 2023-08-27
- 2.0.0-5ba2e94392ae366acd90bfd3dc1ef298490fe156 — 2023-08-27
- 2.0.0-86022af6e93fc8dfbe9bd4898e7df6016cfb1fae — 2023-08-27
- 2.0.0-f03d4fc162ef4d8bc0b326d438252f2b2880f1ab — 2023-08-27
- 2.0.0-16d3ed1c07f11925bf9d4a25c80a8c1415bf742c — 2023-08-14
- 2.0.0-32390dc4bf08bf250f35f78d657039ce8b2a4bac — 2023-08-14
- 2.0.0-bd3dafe0b90ffb03821dd034ce3cdea63e208735 — 2023-07-29
- 2.0.0-a7191ad4bb302d7b272805da4b1e117028ff5278 — 2023-07-29
- 2.0.0-97fc90b22d1173c8c805772216ffb3b90b937b96 — 2023-07-29
- 2.0.0-8a575344cafe3a099b0fc5cd649d54e405d57b14 — 2023-07-29
- 2.0.0-59aa40882228a01c63e8199bb6436172fcaf117d — 2023-07-26
- 2.0.0-9a0dcdf14a1452459c4e01b3d20f0b114c8a9ad5 — 2023-07-26
- 2.0.0-831ac9185ef3294c1ed09f11acee28662a474f58 — 2023-07-26
- 2.0.0-1d39c435533dd4a27a09d0c31bafccd24a689121 — 2023-07-26
- … 46 more at https://npm.io/package/msgroom-nightly/versions

## README

# msgroom

## A Msgroom client

[![Wallaby.js](https://img.shields.io/badge/wallaby.js-powered-blue.svg?style=flat&logo=github)](https://wallabyjs.com/oss/)

**NOTE: This is <ins>not</ins> the official msgroom package!**

Available on npm: `npm i msgroom`

There are plans to include a msgroom server in the future.

## How to use

### Getting started

First, create a new client and connect
(the package exports commonJS, so you can use require too)

```js
import Client from "msgroom";

const client = new Client("TestBot", [ "!" ]);
await client.connect();
```

For more information about any functions/variables/properties,
hover over them in your IDE.
This package is fully typed.

You can listen for any events you like using `client.on` (or `client.addListener`).

A map of events can be found in `src/events.ts` or in `dist/events.d.ts`.

### Defining commands

To define a command, define a property on `client.commands`.
The name of the property will be the name of your command.
This property should be a function that is called with

1. A `reply` function, this function will concatenate all arguments passed to it together with spaces in between them and send the resulting string as a message.
2. Any number of arguments, depending on how much the user passed when invoking the command. These arguments are all strings.

Some examples:

```js
client.commands.ping = () => "pong";

client.commands.repeat = (reply, ...args) => {
    return args.join(" ");
};
```

You can, after defining these commands, use them by sending a message like this:

![example command usage](https://github.com/NanderTGA/msgroom-orm/blob/master/example%20command%20usage.png?raw=true)

### Blocking users

To block a user, add their ID or session ID to `client.blockedIDs` or `client.blockedSessionIDs` respectively.
These 2 properties are [Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set)s.

You can then check if a user is blocked using `client.isBlocked()`.
Any events caused by blocked users will be ignored, so you likely won't need this method.
This method accepts either

- An ID, and optionally a session id:

```js
client.isBlocked("user-id-here", "session-id-here")
```

- Or an object containing one or more of the following:

```js
client.isBlocked({
    id: "user-id-here",
    sessionID: "session-id-here",
    session_id: "session-id-here"
})
```

for example:

```js
client.isBlocked("bad-user-id", "some session id") // false
client.blockedIDs.add("bad-user-id")
client.isBlocked("bad-user-id", "some session id") // true
```

### Subcommands

You can now also define subcommands like this:

```js
client.commands.someSubommand = {
    subcommand: () => "You used the subcommand!", // user ran `!someSubcommand subcommand`
    undefined: () => "You didn't use any subcommands!", // user ran `!someSubcommand`
    anotherSubcommand: () => "You used another subcommand!", // user ran `!someSubcommand anotherSubcommand`
}
```

You can also nest subcommands like this:

```js
client.commands.something = {
    someSubcommand: {
        someSubSubcommand: () => "Look at that, a sub-subcommand" // user ran `!something someSubcommand someSubSubcommand`
    }
}
```

It comes down to one thing: you can now put an object with subcommands (like shown above) anywhere you can put a command handler function

---
_Source: https://npm.io/package/msgroom-nightly · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
