0.1.9 • Published 1 year ago

master-bot v0.1.9

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

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.

0.1.9

1 year ago

0.1.8

1 year ago

0.1.7

1 year ago