master-bot
TypeScript icon, indicating that this package has built-in type declarations

0.1.9 • Public • Published

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

    npm install master-bot -s
// or
    npm install master-bot -g

Usage

    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.

Readme

Keywords

Package Sidebar

Install

npm i master-bot

Weekly Downloads

1

Version

0.1.9

License

MIT

Unpacked Size

20.3 kB

Total Files

13

Last publish

Collaborators

  • eslamdev