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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@tryforge/forge.music

v1.0.0

Published

Extension to add music functionality to your ForgeScript bot.

Readme

ForgeMusic

An standard music library tailored for ForgeScript.


Features

  • Easy to use API.
  • Various amount of events.
  • Support for various filters.
  • Support for most audio providers.

Contents

  1. Installation
  2. Setup
    1. Listening Events
      1. Disallowed Events
    2. Commands
      1. Event Data: Types and Interfaces
        1. Example
  3. Advices
  4. Tips
    1. Adding support for YouTube
  5. Contributors

Installation

In your project, navigate to your terminal and write the following command.

npm install @tryforge/forge.music

If you are using another package manager than npm, Google how to install Node.js dependencies.


Setup

Now, you must require the ForgeMusic class in your main file.

const { ForgeMusic } = require("@tryforge/forge.music");

As it is required, now you are allowed to create an instance of it.

const music = new ForgeMusic({
    events: []
});

Now, extension is defined and ready to be attached to the client.

const client = new ForgeClient({
    extensions: [music],
    // ...client options
});

[!CAUTION] Your ForgeClient instance requires the following intent in order for ForgeMusic to work: GuildVoiceStates.

Listening Events

ForgeMusic provides a simple interface to declare the events to listen to. First, we need to require the GuildQueueEvent enumerator.

const { ForgeMusic, GuildQueueEvent } = require("@tryforge/forge.music");

As it is required, now you must pass an array of values of this enumerator under events property in ForgeMusic constructor.

const music = new ForgeMusic({
    events: [
        GuildQueueEvent.PlayerFinish,
        GuildQueueEvent.PlayerStart,
        GuildQueueEvent.PlayerError,
        GuildQueueEvent.Error
    ]
});

Current setup must look like this.

const { ForgeMusic, GuildQueueEvent } = require("@tryforge/forge.music");
const music = new ForgeMusic({
    events: [
        GuildQueueEvent.PlayerFinish,
        GuildQueueEvent.PlayerStart,
        GuildQueueEvent.PlayerError,
        GuildQueueEvent.Error
    ]
});

const client = new ForgeClient({
    extensions: [music],
    // ...client options
});

Disallowed Events

The following events are not supported by the extension.

  • VoiceStateUpdate
  • WillAutoPlay
  • WillPlayTrack

Commands

To add event commands, ForgeMusic provides an integrated command manager to take care of this. You must define your commands after your ForgeClient definition to prevent errors.

// Adding directly.
music.commands.add({
    name: "commandName",
    type: GuildQueueEvent.PlayerStart,
    code: "$log[A track started playing.]"
});

// Loading from a path tree.
music.commands.load("./path/to/commands");

Event Data: Types and Interfaces

In each music event, you can access to that event data using the JSON Dump ($env). The following, is a list of event with its accessible properties.

Example
{
    name: "myCommand",
    type: GuildQueueEvent.PlayerStart,
    code: "$!sendMessage[$env[queue;metadata;text;id];A track started playing.]"
}

Advices

  • You must add the following events to the extension in order to work properly.
    • GuildQueueEvent.Error
    • GuildQueueEvent.PlayerError

Tips

Default Extractors

The base framework provides some base music sources you can use. You must load them like follows.

const { DefaultExtractors } = require("@tryforge/forge.music");
const music = new ForgeMusic({
    // ...
    includeExtractors: DefaultExtractors
});

Adding Support for YouTube

ForgeMusic by default does not provide support for streaming from YouTube. You must install discord-player-youtubei and then require YoutubeiExtractor from it.

npm install discord-player-youtubei

then, do the following step.

const { DefaultExtractors, ForgeMusic, GuildQueueEvent } = require("@tryforge/forge.music");
const { YoutubeiExtractor } = require("discord-player-youtubei");
const music = new ForgeMusic({
    events: [
        GuildQueueEvent.AudioTrackAdd,
        GuildQueueEvent.Connection,
        GuildQueueEvent.PlayerError,
        GuildQueueEvent.Error
    ],
    includeExtractors: DefaultExtractors
});

With the previous step done, register the YoutubeiExtractor into the extension registry.

music.player.extractors.register(YoutubeiExtractor, {});

And now, you're ready to use YouTube provider as smooth as possible.

Contributors

Many thanks for the contributors for making this extension the best choice out there. tryforge/ForgeMusic