npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mpp.js

v3.0.3

Published

Node.js library used to create bots for multiplayerpiano.com

Downloads

27

Readme

mpp.js 2.1

How to install:

  • First create your project folder

  • Run npm init

  • Run npm i mpp.js

  • Require it and your done!

Example:

const MPP = require('mpp.js');

MPP.chat.send('Hello World!');

MPP.client.on('count', (count) => {
  console.log(`${count} people are in the room.`);
});

MPP.client.on('a', (msg) => {
  // Prints the spoken message to the console
  console.log(`${msg.p.name}: ${msg.a}`);
  
  // Checks if the participant said "!hello" then sends a message back
  if (msg.a.split(' ')[0].toLowerCase().startsWith('!hello')) {
    // Sends a message that says: "Hi [Username]!"
    MPP.chat.send(`Hi ${msg.p.name}!`);
  }
});

How to create an MPP bot:

  • First install the library

  • Insert this code into your index.js:

const MPP = require("mpp.js");
  • Use this example code to help
const MPP = require("mpp.js");

MPP.client.on("a", function(msg){
  // Prefix
  var p = "!";
  var args = msg.a.split(" ");
  var cmd = args[0].toLowerCase();
  args = args.slice(1);
  
  // Commands
  if (cmd == p+"test"){
    MPP.chat.send("mpp.js 2.0 is amazing!");
  }
}

The above code will say "mpp.js 2.0 is amazing!" in chat whenever you run the command !test.

Complete Docs:

  • Coming in 2.2...

New Features:

- 2.1


- MPP.client.setName Added

  • Added a new function called setName.Example:

  const MPP = require('mpp.js');

  // Set the name of the bot to "A Very Awesome Bot"
  MPP.client.setName('A Very Awesome Bot');

- Major Bug Fixes

  • Fixed a bug that wouldn't allow you to create a bot. It would print this to the console: "Error: Could not find directory E:\[Directory Name]\midi". I'm so sorry I didn't catch that bug. I'll make sure this doesn't happen again.


- 2.0


- Toggle Functions

  • Ever feel tired of having to use if statements to toggle piano keys, piano sustain, public room setting, etc.? No? I get it this is so useless and unintuitive. Yeah? Here's an example:

    const MPP = require('mpp.js');
       
    // This toggles the piano sustain
    MPP.toggle.sustain();
       
    // This toggles the public piano setting
    MPP.toggle.publicPiano();
       
    // This toggles the public room setting
    MPP.toggle.publicRoom();
       
    // This toggles the connection to the current room
    MPP.toggle.connection();
  • NOTE:

These functions are not availible on the website. These are simply just bonus functions that are bundled mpp.js. You don't have to use them though.

- Improved Code

I have improved the code and syntax. A year ago, I was TERRIBLE at Node.js. Now, I have improved the code and syntax a lot so it is easier to read and use.

NOTE:

Some of the features that are availible on the website(like js MPP.clear() ) are not availible on mpp.js 2.0. These features will be implemented in either 2.2 or 3.0. Don't worry, these features will be added soon(1 to 3 months from 2.0's release)