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

bancho.js

v0.11.6

Published

Interface with Bancho over IRC, made easy and reliable

Downloads

163

Readme

bancho.js

NPM
pipeline status

Current release: 0.11.6

Introduction

bancho.js is designed to be the best library when it comes to interacting with Bancho in real-time. It connects over its IRC interface and enables you to do anything Bancho enables you to do, from chatting to managing multiplayer lobbies!

It is designed to be reliable and easy to use, as demonstrated by the many projects relying on it!

Useful Links

Disclaimer

Before running a bot on your osu! account, please read the Bot account wiki page. It details conditions under which you can run a bot on your account and eventually getting a dedicated account for it.

Please do NOT create an account dedicated to your bot without allowance. This will be considered multi-accounting, which is against the osu! Terms of Use and may lead to sanctions on your account.

The library uses sane rate limits for normal user accounts by default.

Getting Started

First, install the library: npm i bancho.js.

Let's get straight into it with a working example. This will print all your incoming PMs to the console:

const Banchojs = require("bancho.js");
const client = new Banchojs.BanchoClient({ username: "ThePooN", password: "your_irc_password" });
client.connect().then(() => {
	console.log("We're online! Now listening for incoming messages.");
	client.on("PM", (message) => console.log(`${message.user.ircUsername}: ${message.message}`));
}).catch(console.error);

Output:

Ghouru: notice me senpai

All you need to do to run this example is install bancho.js into your project (npm i bancho.js), paste this code into a file and replace my credentials with yours, from https://osu.ppy.sh/p/irc.
This library doesn't limit itself to sending messages though! It also has complete multiplayer support and the ability of firing API requests from BanchoUser objects, and much more! Learn more with the provided examples and documentation!

Caching

A BanchoClient uses unique BanchoUser instances across its lifespan. The cache never gets cleared and objects never destroyed.

Starting with bancho.js v0.10, we support garbage collection of these instances out-of-the-box using WeakRef, introduced in Node.js >= v14.6.0.

bancho.js also supports weak-value-map if present, providing garbage collection of BanchoUser objects in Node.js >= v10.0.0. From my own testing, this solution offers better memory usage than Node.js's WeakRef. However, I don't think this can be considered as stable as Node.js's WeakRefs, so I wouldn't recommend using this solution unless necessary.

Contributing

This library is very near completion. Thanks to everyone who supported and are now (directly or not) using the project!
There must still be some improvements to be done though. Feel free to hop on my Discord server so we can figure out issues and improve the code!
You can financially support this project by subscribing to my Twitch channel or donating.

Compatibility

bancho.js supports all currently supported Node.js releases. See Node's LTS schedule.

License

It is licensed as GPL 3.0. The entire license text is available in the LICENSE file, however I recommend you to take a look at this short summary to get a better idea!