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

discordjs.musicbot.fix

v13.9.1

Published

A simple Node.js based music extension/bot for Discord.js projects using YouTube.

Downloads

4

Readme

A Little Notice:

Recently most members of my Discord server have been banned from it. All bans have been removed but we obvouisly can't track you all down and shove invite links at you. So, feel free to re-join the server: https://discordapp.com/invite/JHMtwhG

Discord MusicBot Addon


This module is a simple Node.js based music extension/bot for Discord.js projects using YouTube. This was originally an update of an older addon for newer versions of Discord.js but not serves as it's own module.

The commands available are: (default names)

  • musichelp [command]: Displays help text for commands by this addon, or help for a specific command.
  • play <url>|<search string>: Play audio from YouTube.
  • search <search string>: Search's for up to 10 videos from YT.
  • skip [number]: Skip a song or multi songs with skip [some number].
  • queue [position]: Display the current queue.
  • pause: Pause music playback.
  • resume: Resume music playback.
  • remove [position]: Remove a song from the queue by position.
  • volume: Adjust the playback volume between 1 and 200.
  • leave: Clears the song queue and leaves the channel.
  • clearqueue: Clears the song queue.
  • np: Show the current playing song.

Permissions:

  • If anyoneCanSkip is true, anyone can skip songs in the queue.
  • If anyoneCanAdjust is true, anyone can adjust the volume.
  • If ownerOverMember is true, the set ID of the user (ownerID) will over-ride permissions from the bot.

Installation


Pre-installation:

  1. npm install discord.js
    It is recommended to have the stable branch.

  2. ffmpeg installed correctly for your OS/env.
    Allows the bot to join voice as well as speak.

  3. npm install node-opus or npm install opusscript
    Required for voice. Discord.js prefers node-opus.

Installation:

  • npm install discord.js-musicbot-addon
    If you have troubles installing, see this link or join the discord server. Note that the NPM version will be slightly behind the GitHub version.

Examples


See this page on the repo for examples.

Options & Config.


Most options are optional and thus not needed.
The options you can pass in music.start(client, {options}) and their types is as followed:

Basic Options.

| Option | Type | Description | Default |
| --- | --- | --- | --- | | youtubeKey | String | A YouTube Data API3 key. Required to run. | NaN | | botPrefix | String | The prefix of the bot. Defaults to "!". Can also be a Map of prefix's. | ! | | messageNewSong | Boolean | Whether or not to send a message when a new song starts playing. | true | | bigPicture | Boolean | Whether to use a large (true) image or small (false) for embeds. | false | | maxQueueSize | Number | Max queue size allowed. Defaults 100. Set to 0 for unlimited. | 50 | | defVolume | Number | The default volume of music. 1 - 200. | 50 | | anyoneCanSkip | Boolean | Whether or not anyone can skip. | false | | messageHelp | Boolean | Whether to message the user on help command usage. If it can't, it will send it in the channel like normal. | false | | botAdmins | Object/Array | An array of Discord user ID's to be admins as the bot. They will ignore permissions for the bot. | [ ] | | anyoneCanAdjust | Boolean | Whether anyone can adjust volume. | false | | ownerOverMember | Boolean | Whether the owner over-rides CanAdjust and CanSkip. | false | | anyoneCanLeave | Boolean | Whether anyone can make the bot leave the currently connected channel. | false | | ownerID | String | The ID of the Discord user to be seen as the owner. Required if using ownerOverMember. | NaN | | logging | Boolean | Some extra none needed logging (such as caught errors that didn't crash the bot, etc). | true | | requesterName | Boolean | Whether or not to display the username of the song requester. | true | | inlineEmbeds | Boolean | Whether or not to make embed fields inline (help command and some fields are excluded). | false | | musicPresence | Boolean | Whether or not to make the bot set its presence to currently playing music. | false | | clearPresence | Boolean | Whether or not to clear the presence instead of setting it to "nothing" | false | | insertMusic | Boolean | Whether or not to insert the music bot data into <Client>.music on start. | false | | channelWhitelist | Object/Array | Sets a list of ID's allow when running messages. | [ ] | | channelBlacklist | Object/Array | Sets a list of ID's ignore when running messages. | [ ] | | bitRate | String | Sets the preferred bitRate for the Discord.js stream to use. | "120000" | | nextPresence | PresenceData | PresenceData to set after instead of clearing it (clearPresence). | null |

Multi-Prefix Option Example

<Client>.guilds.forEach
<Music>.start(<Client>, {
  youtubeKey: "Data Key",
  botPrefix: <MapObject>
});

// Exmaple Map Structure
{serverID: { prefix: "!" } }

See examples for more info.

Cooldown

| Option | Type | Description | Default |
| --- | --- | --- | --- | | cooldown | Object | The main cooldown object | | | cooldown.enabled | Boolean | Whether or not cooldowns are enabled. | true | | cooldown.timer | Number | Time in MS that cooldowns last. | 10000 | | cooldown.exclude | Object/Array | Array of command names to exclude. Uses default names, not set names | ["volume","queue","pause","resume","np"] |

Command Options.

Commands pass a bit different. Each command follows the same format as below. Valid entries are play, remove, help, np, queue, volume, pause, resume, skip, clearqueue, loop, leave, shuffle, deletequeue.

music.start(client, {
  <command>: {
    enabled: false,                    // True/False statement.
    alt: ["name1","name2","name3"],    // Array of alt names (aliases).
    help: "Help text.",                // String of help text.
    name: "play"                       // Name of the command.
    usage: "{{prefix}}play bad memes", // Usage text. {{prefix}} will insert the bots prefix.
    exclude: false                     // Excludes the command from the help command.
  }
});