1.1.5 • Published 2 years ago

hackchat-engine v1.1.5

Weekly downloads
15
License
WTFPL
Repository
github
Last release
2 years ago

hackchat-engine

A NodeJS and browser friendly JavaScript library used to interact with a hackchat server.

Installation

Prerequisites

Install

npm i hackchat-engine

Usage

Minimum Usage

  const { Client } = require('hackchat-engine');
  const hcClient = new Client();

  const testName = 'testBot';
  const testPass = 'testBot';
  const testChannel = 'programming';

  hcClient.on('connected', () => console.log('Connected!'));

  hcClient.on('session', (payload) => {
    console.log(payload);
    hcClient.join(testName, testPass, testChannel);
  });

  hcClient.on('channelJoined', (payload) => {
    console.log(payload);
    hcClient.say(testChannel, 'Bep boop i r bot');
  });

  hcClient.on('message', (payload) => {
    console.log(payload);
    hcClient.say(testChannel, 'No u');
  });

Advanced Usage

Need to update this, still

Changing the connection

By default, this engine will connect to 'wss://hack.chat/chat-ws'. To change this, add a ws.gateway property to the options object, for example:

const hcClient = new Client({
  ws: {
    gateway: 'ws://1.1.1.1:6060/',
  }
});
1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

3 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago