1.2.3 • Published 11 months ago

mpp-client-net v1.2.3

Weekly downloads
-
License
GPL-3.0-only
Repository
-
Last release
11 months ago

mpp-client-net

This module is a fork of the MPP.net client. This module is only meant for MPP.net, but it will likely work on any MPP site that uses token-based authentication in the same way as MPP.net.

This is not meant to work in the browser. It is for independent runtimes like Bun, Deno, or Node.js.

Usage

It is strongly recommended that you keep your bot tokens in a safe place where nobody else can access them. Personally, I keep mine in a .env file in the root of my project, as that is a typical place for project secrets.

For more information on how to interact with the server, see the MPP.net Protocol Documentation.

# .env
MPPNET_TOKEN=your token here
// index.ts

// Load environment variables into process.env (not required for bun)
import { configDotenv } from "dotenv";
configDotenv();

import { Client } from "mpp-client-net";

// Instantiate a new client
const client = new Client("wss://mppclone.com", process.env.MPPNET_TOKEN);

// Connect to the server
client.start();
client.setChannel('test/awkward');

// Listen for chat messages
client.on('a', msg => {
    if (msg.a == "!ping") {
        // Send a chat message back
        client.sendArray([{
            m: "a",
            message: "Pong!"
        }]);
    }
});
1.2.3

11 months ago

1.2.2

11 months ago

1.2.1

11 months ago

1.2.0

1 year ago

1.1.3

2 years ago