0.3.8 • Published 3 years ago

@bitwave/chat-client v0.3.8

Weekly downloads
135
License
LGPL-3.0
Repository
github
Last release
3 years ago

chat-client

Basic API client for bitwave.tv's chat. Provides minimal functionality.

Install with:

npm install @bitwave/chat-client

Usage

import bitwaveChat from '@bitwave/chat-client';

/* NOTE: These are the default implementations */

// 'ms' is an array of message objects delivered by the server
bitwaveChat.rcvMessageBulk = ms => {
  for( const m of ms ) {
    console.log( m.message );
  }
};

// Paid alert callback
bitwaveChat.alert = message => {
  console.warn( message );
};

// Global chat setting
bitwaveChat.global = true;

// Connects to chat, to the specified room, with the token
// Note: the token cannot be changed after init()
bitwaveChat.init( 'myroom', 'chat-token' );

bitwaveChat.sendMessage( 'Hello, world!' );
bitwaveChat.room = 'global';
bitwaveChat.sendMessage( 'Hi, global' );

bitwaveChat.sendMessage({
  message: 'Hello, all',
  channel: 'markpugner',
  global: false,
  showBadge: true
});

// Gets all users connected to the current room
// Note: this function will be called automatically, when requested by the server
await bitwaveChat.updateUsernames();
bitwaveChat.channelViewers.forEach( u => {
  console.log( u );
});

This is all the library can offer. It's very minimal and is, mostly, just a wrapper around the API.

For a more featureful, complete API client, look into the chat-bot.

1.0.0-0

3 years ago

0.3.9

4 years ago

0.3.10

4 years ago

0.3.8

4 years ago

0.3.7

4 years ago

0.3.5

4 years ago

0.3.4

4 years ago

0.3.3

4 years ago

0.3.2

4 years ago

0.3.1

4 years ago

0.3.0

4 years ago

0.2.1

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.1

4 years ago