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

multiplayerpianojs

v3.0.0

Published

An easy to use NodeJS library for Multiplayerpiano.com & mppclone.com otherwise known as MPP to create chat bots.

Downloads

29

Readme

Logo

Foreword

Wrote this to help developers create bots for https://multiplayerpiano.com/ / https://mppclone.com/ simple and more streamlined. The current method of all devs manually interacting with the websocket seemed a bit inefficient and non-beginner friendly. Enter MultiplayerPianoJS!

Installation

Written on NodeJS v17.5

npm install multiplayerpianojs

YOU MUST GET A TOKEN FROM MPPCLONE.COM OWNER!

To get one, join the discord https://discord.gg/338D2xMufC . Using this without a token will result in a 24 hour ban so be careful!

Example Usage

Bigger example seen here

Full bot framework seen here

const MPPClient = require('multiplayerpianojs')
const mpp = new MPPClient('Your Token')

// const mpp = new MPPClient(token, SCOCKS/HTTPS PROXY HERE) alternatively
mpp.connect()

// On connect
mpp.on('connected', () => {
  console.log('bot connected')
  mpp.setChannel('test3')
})

mpp.on('userLeave', user => {
  console.log(`User left: ${user.name}`)
})

mpp.on('userJoin', user => {
  console.log(`User joined: ${user.name}`)
})

// Example chat message event
mpp.on('message', msg => {
  const args = msg.content.split(' ')

  if (args[0] === '!setname') {
    mpp.setUser(args[1])
  }

  if (args[0] === '!joinroom') {
    mpp.setChannel(args[1])
  }
})

Methods/Functions

  • connect()

Connects bot to the WS

  • disconnect()

Disconnects bot to the WS

  • setChannel(String name)

Sets the current channel

  • setName(String name, String hexColor)

Sets the current name & tag color

  • moveMouse(Int x, Int y)

Moves client mouse cursor

  • dm(String msg, String id)

Sends a dm to a specific user

  • giveCrown(String id)

If bot has crown (owner of room), give to user id

  • changeChannelSettings(Object settings)

Change the room settings if owner

// Example Object of settings
{
  color: '#0066ff',
  color2: '#ff9900',
  chat: 'false'
}
  • ban(String id, Int ms)

Bans a user from channel for set time, requires owner/crown

  • unBan(String id)

un-Bans a user from channel, requires owner/crown

  • sendMessage(String msg)

Sends a message in chat

  • sendNotes(Array notes, Int time)

Sends notes to be played at specific time, defaults to current time

// Example array of notes
[
  {
    "n":"c3", //note
    "v":0.75 //velocity
  },
  {
    "n":"c3",
    "d":100, //delay from message to trigger note ms
    "s":1 //if the note is a note stop
  }
]

Events

  • connected

Fired on bot connection to websocket

  • message(Object)

Fired when chat message recieved

  • dm(Object)

Fired when direct message is recieved

  • userJoin(Object)

Fired when user joins the channel

  • userLeave(Object)

Fired when user leaves the channel

  • notes(Object)

Fired when user sends notes

Properties

  • proxy

Currently used proxy

  • hasCrown

If the bot has the crown (room ownership)

  • user

Current user object

  • room

Current room object

  • allRooms

All current existing rooms

  • token

Current token

Dependencies

  • https-proxy-agent
  • socks-proxy-agent
  • ws

Planned Features

You can see the planned features here

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

All code must follow standardjs principles & Gitflow branching strategy. Keep documentation thorough as well.

GitHub stars GitHub followers