# master-bot

> TypeScript NPM Module Boilerplate

Latest version **0.1.9** (published 2022-11-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install master-bot
pnpm add master-bot
yarn add master-bot
bun add master-bot
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.9 |
| Published | 2022-11-19 |
| First published | 2022-11-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 19.9 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Eslam Hugair |
| Maintainers | eslamdev |
| Keywords | boilerplate, typescript |

## Links

- npm: https://www.npmjs.com/package/master-bot
- npm.io page: https://npm.io/package/master-bot

## Dependencies (3)

- [got](https://npm.io/package/got.md) ^12.5.3
- [ping](https://npm.io/package/ping.md) ^0.4.2
- [request](https://npm.io/package/request.md) ^2.88.2

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 0.1.9 (latest) — 2022-11-19
- 0.1.8 — 2022-11-19
- 0.1.7 — 2022-11-19

## README

MasterBot
A Node.js Bot to create a network of bots that can communicate with each other.
and share contacts in a peer to peer fashion.
beside executing commands, it can also be used to send messages to other bots.


## Installation
```bash
    npm install master-bot -s
// or
    npm install master-bot -g
```
## Usage
  
```javascript
    const MasterBot = require('master-bot');
    const bot = new MasterBot({
        name: 'bot1',
        port: 3000,
        peers: ['http://localhost:3001']
    });
    bot.start();
```

## API
### MasterBot
#### new MasterBot(options)
Creates a new instance of MasterBot.
##### options
Type: `Object`

###### name
Type: `String`

The name of the bot.

###### port
Type: `Number`

The port on which the bot will listen for incoming connections.

###### peers

Type: `Array`

An array of peers to connect to.


#### bot.start()

Starts the bot.

#### bot.stop()

Stops the bot.

#### bot.send(message, peer)

Sends a message to a peer.

##### message

Type: `String`

The message to send.

##### peer

Type: `String`

The peer to send the message to.

#### bot.on('message', (message, peer) => {})
Emitted when a message is received from a peer.

##### message

Type: `String`

The message received.

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