Skip to content

A standard music extension library for forgescript

License

Notifications You must be signed in to change notification settings

tryforge/ForgeMusic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

forge-music

A standard music extension library for forgescript

ForgeMusic forgescript Discord

Usage

You can install from github:

npm install https://github.com/tryforge/ForgeMusic.git

From Node.js Package Manager:

# NPM
npm install forge-music
# YARN
yarn add forge-music

How to use

Add package to your client initialization

const { ForgeMusic } = require('forge-music');
const { ForgeClient } = require('forgescript');

const client = new ForgeClient({
    // "GuildVoiceStates" is important for music
    intents: [
        "Guilds", 
        "GuildMessages", 
        "MessageContent", 
        "GuildVoiceStates"
    ],
    extension: [
        new ForgeMusic({ soundsFolder: `${process.cwd()}/sounds` })
    ]
});

The ForgeMusic instantiated class is exposed in client.music and available as typings.

The ForgeMusic extension registers functions listed below:

  • $vcJoin[voiceChannel] - Connects to a voice channel
    • voiceChannel (Channel) - The voice channel to establish connection
  • $defaultProvider[providerName] - Changes the default provider of current execution
    • providerName (String) - The provider to use for searching tracks
  • $getSoundsFolder - Returns the soundsFolder from specified options in ForgeMusic.options
  • $getTrackInfo[track encoded id;record key] - Returns information about record key from track
    • track encoded id (String) - The encoded id to get track from cache
    • record key (String) - The key from object record to retreive information
  • $loadTracks[query;loadType;providerName?] - Search tracks from specified provider. Returns an array of track encoded id
    • query (String) - The query to search for tracks
    • loadType (Enum: LoadResultType) - The type to filter result. Enum: Search, Track, Playlist.
  • $playTrack[track encoded id] - Sends request to the Audio player to play track
    • track encoded id (String) - The encoded id to get track from cache
  • $playerStop - Sends request to the Audio player to stop playing

API

ForgeMusic

The extension which manages music handlers for forgescript

  • ForgeMusic.options - The options that is provided to constructor
    • soundsFolder - The path to folder for sounds
  • ForgeMusic.manager - The music manager which manages tracks and audio players.
    • .manager is MusicManager - The class manager from NaokoPlayer
  • ForgeMusic.addProvider(Provider) - Adds a provider to collecton
    • Provider is Providers.Provider - The class provider from NaokoPlayer

Providers

The provider which the service that serves tracks and audios.
Provider can be custom created, and it is not limited to any service.

Current providers is added within package:

  • Providers.LocalProvider - A local provider added from NaokoPlayer

Roadmap

The goal for future updates:

  • A track queue system
  • Audio player features for filter, seek, and etc
  • Music Events playing, resumed, paused, stopped, filters, and etc
  • Extensive Provider support.

About

A standard music extension library for forgescript

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published