Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

justchat-mc

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

justchat-mc

A node.js client and server lib for JustChat.

latest
Source
npmnpm
Version
1.1.3
Version published
Maintainers
1
Created
Source

node-justchat

A node.js client and server lib for JustChat.

Install

Using npm:
npm install --save-dev node-justchat
Using yarn:
yarn add --dev node-justchat

Usage

Server

import { JustChatServer } from 'node-justchat';
const server = new JustChatServer({
    // Server name
    name: 'JustChat Server',
    // Server uuid
    id: '123'
    // Server port
    port: 8080,
    // if the pulse should be enabled
    enableTimeout: true,
    // if the server should be in single mode
    singleMode: false,
});

// Listen for Chat Messages
server.on('chat', (message) => {
    console.log(message);
});

// Listen for Broadcast Messages
server.on('broadcast', (message) => {
    console.log(message);
});

// Listen for List Messages
server.on('list', (message) => {
    console.log(message);
});

// Send Chat Messages
const chatMsg = {
    world: '576493373',
    world_display: 'Bot tests',
    sender: 'Bot tester',
    content: [
        {
            type: 'text',
            content: 'Hello world!',
        }
    ]
}
server.sendChatMessage(chatMsg, {
    name: 'Client',
    id: '321',
});

// Send List Messages
const listMsg = {
    world: '576493373',
    world_display: 'Bot tests',
    sender: 'Bot tester',
}
server.sendListMessage(listMsg, {
    name: 'Client',
    id: '321',
});

Client

import { JustChatClient } from 'node-justchat';

const client = new JustChatClient({
    address: 'localhost',
    port: 8080,
    name: 'Client',
    id: '321',
})

// Listen for Chat Messages
client.on('chat', (message) => {
    console.log(message);
});

// Listen for Broadcast Messages
client.on('broadcast', (message) => {
    console.log(message);
});

// Listen for List Messages
client.on('list', (message) => {
    console.log(message);
});

// Send Chat Messages
const chatMsg = {
    world: '576493373',
    world_display: 'Bot tests',
    sender: 'Bot tester',
    content: [
        {
            type: 'text',
            content: 'Hello world!',
        }
    ]
};
client.sendChat(chatMsg);

// Send List Messages
const listMsg = {
    world: '576493373',
    world_display: 'Bot tests',
    sender: 'Bot tester',
};
client.sendList(listMsg);

Keywords

Minecraft

FAQs

Package last updated on 15 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts