simple-easy-music

Cool package which makes discord music bot developing easier and faster ;)

Usage no npm install needed!

<script type="module">
  import simpleEasyMusic from 'https://cdn.skypack.dev/simple-easy-music';
</script>

README

You need ffmpeg installed on your machine to use this!

Please keep in mind that this package is still in development and if you encounter any error(s), kindly report them to claude#2334 on discord. Or you can just email me. I would really appreciate it.

How to install:-

npm install simple-easy-music@latest

Example Usage:-

const discord = require('discord.js');
const client = new discord.Client();

const token = "YOUR TOKEN HERE";
const prefix = "YOUR PREFIX HERE";

const player = require("simple-easy-music");

client.on("ready", () => {
    console.log(`Logged in as ${client.user.tag}!`);
});

client.on("message", async(message) => {

    if (!message.content.startsWith(prefix)) return;
    const args = message.content.slice(prefix.length).trim().split(/ +/g);

    if (message.content === "play"){
        await player.play(message, args.join(" "), message.member.voice.channel, "BLUE");
    } else if (message.content === "stop"){
        player.stop(message);
    } else if (message.content === "skip"){
        player.skip(message);
    } else if (message.content === "queue"){
        player.getQueue(message, "BLUE");
    } else if (message.content === "clear"){
        player.clearQueue(message);
    } else if (message.content === "loop"){
        player.loop(message);
    } else if (message.content === "pause"){
        player.pause(message);
    } else if (message.content === "resume"){
        player.resume(message);
    }
});

client.login(token)

Functions:-

play(message, query, channel, embedColor?)

  • You need to await this function

Join the channel and start playing music.

pause(message)

Pause the playback.

resume(message)

Resume the playback.

loop(message)

Loop the current song.

getQueue(message, embedColor?)

Get the current server queue.

clearQueue(message)

Clear the current server queue.

skip(message)

Skip the current song.

stop(message)

Stop the playback and clear the queue.

Parameters

message Message passed as a parameter in a message event.

embedColor Optional Custom embed color to send embeds in. Defaults to "#36393F"

query The words to search for. The first result gets played. Throws an error if it does'nt find a result.

channel The channel to join and play music.