3.6.8 • Published 5 days ago

moonlink.js v3.6.8

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
5 days ago

Imagine a Music...

MoonImage NPM

Made with ♥️ in - Brazil

Codacy Badge Downloads Version install size node Netlify Status

Envision a musical journey where creativity knows no bounds, accompanied by the enchantment of the holiday season. 🌌 Moonlink.js invites you to unlock your complete musical potential, designed exclusively for Lavalink clients. Step into a world of seamless communication and fluid interaction, where Moonlink.js elevates your projects to new heights, sprinkled with holiday charm. With full TypeScript support, it empowers your creativity and productivity. 🎵

Table of Contents

Features

Moonlink.js offers essential features for creating exceptional music bots:

  1. Seamless Communication: Developed for Lavalink clients, it ensures an uninterrupted musical experience. 🎧

  2. Full TypeScript Support: Enjoy complete TypeScript support to enhance your productivity and creativity. 💻

  3. Active Community: Be part of a community of passionate developers and benefit from our active support system. Our project is not just about minimizing package size but maximizing its quality and potential for developers. 🤝

Documentation

For comprehensive documentation and more examples, visit moonlink.js.org. 📖

Installation

npm install moonlink.js
yarn add moonlink.js
pnpm install moonlink.js
bun install moonlink.js

How to Use

// Creating an instance of the Discord.js clien
const client = new Client({
    intents: [
        GatewayIntentBits.Guilds,
        GatewayIntentBits.GuildMessages,
        GatewayIntentBits.GuildVoiceStates
    ]
});

// Configuring the Moonlink.js package
client.moon = new MoonlinkManager(
    [
        {
            host: "localhost",
            port: 2333,
            secure: true,
            password: "password"
        }
    ],
    {
        /* Options */
    },
    (guild, sPayload) => {
        // Sending payload information to the server
        client.guilds.cache.get(guild).shard.send(JSON.parse(sPayload));
    }
);

// Event: Node created
client.moon.on("nodeCreate", node => {
    console.log(`${node.host} was connected, and the magic is in the air`);
});

// Event: Track start
client.moon.on("trackStart", async (player, track) => {
    // Sending a message when the track starts playing
    client.channels.cache
        .get(player.textChannel)
        .send(`${track.title} is playing now, bringing holiday joy`);
});

// Event: Track end
client.moon.on("trackEnd", async (player, track) => {
    // Sending a message when the track finishes playing
    client.channels.cache
        .get(player.textChannel)
        .send(`The track is over, but the magic continues`);
});

// Event: Ready
client.on("ready", () => {
    // Initializing the Moonlink.js package with the client's user ID
    client.moon.init(client.user.id);
});

// Event: Raw data
client.on("raw", data => {
    // Updating the Moonlink.js package with the necessary data
    client.moon.packetUpdate(data);
});

// Event: Interaction created
client.on("interactionCreate", async interaction => {
    if (!interaction.isChatInputCommand()) return;
    let commandName = interaction.commandName;
    if (commandName === "play") {
        if (!interaction.member.voice.channel) {
            // Responding with a message if the user is not in a voice channel
            return interaction.reply({
                content: `You are not in a voice channel`,
                ephemeral: true
            });
        }

        let query = interaction.options.getString("query");
        let player = client.moon.players.create({
            guildId: interaction.guild.id,
            voiceChannel: interaction.member.voice.channel.id,
            textChannel: interaction.channel.id,
            autoPlay: true
        });

        if (!player.connected) {
            // Connecting to the voice channel if not already connected
            player.connect({
                setDeaf: true,
                setMute: false
            });
        }

        let res = await client.moon.search({
            query,
            source: "youtube",
            requester: interaction.user.id
        });

        if (res.loadType === "loadfailed") {
            // Responding with an error message if loading fails
            return interaction.reply({
                content: `:x: Load failed - the system is not cooperating.`
            });
        } else if (res.loadType === "empty") {
            // Responding with a message if the search returns no results
            return interaction.reply({
                content: `:x: No matches found!`
            });
        }

        if (res.loadType === "playlist") {
            interaction.reply({
                content: `${res.playlistInfo.name} This playlist has been added to the waiting list, spreading joy`
            });

            for (const track of res.tracks) {
                // Adding tracks to the queue if it's a playlist
                player.queue.add(track);
            }
        } else {
            player.queue.add(res.tracks[0]);
            interaction.reply({
                content: `${res.tracks[0].title} was added to the waiting list`
            });
        }

        if (!player.playing) {
            // Starting playback if not already playing
            player.play();
        }
});

// Logging in with the Discord token
client.login(process.env["DISCORD_TOKEN"]);

Contributors

We would like to express our gratitude to the amazing individuals who contributed to this project. Their hard work and dedication have been instrumental in making it a success. 🎉

  1. 1Lucas1apk - Lead Developer, responsible for project architecture and key feature implementation. 🚀

  2. MotoG.js - Project Ideator and Designer, contributing to the concept and visual design. 🎨

  3. WilsontheWolf - Contributed to the track position logic in real time, rather than just receiving the payload from lavalink.

  4. PiscesXD - First sponsor and contributed to making the shuffle method reversible, and autoLeave.

  5. Suryansh - Second contributor and helped discover bugs 🌷

Other contributors: Nah, ItzGG, SuperPlayerBot, ddemile, Tasty-Kiwi, rrm, WilsontheWolf, Aertic, 'Forster, Fireball, Ghos't, loulou310 - Xotak

We sincerely thank all the contributors mentioned above and everyone who contributed to this project in any way. Your support is truly appreciated. 🙏

Final Thanks

Thank you to everyone who contributed to the growth of moonlink.js, reporting bugs, installing the package and everyone else's patience, I apologize for any time I wasn't able to help someone

have a great day :)

License

This project is licensed under the Open Software License ("OSL") v. 3.0 - see the LICENSE file for details.

Support

Join our Discord server at Moonlink.js - Imagine a Music Bot to connect with other users, ask questions, and participate in discussions. 🤝

For any inquiries or assistance, we're here to help! 🌟

3.6.8

5 days ago

3.6.6

13 days ago

3.6.5

13 days ago

3.6.4

1 month ago

3.6.0

2 months ago

3.5.5

2 months ago

3.5.4

2 months ago

3.4.52

2 months ago

3.3.76

3 months ago

3.2.88

3 months ago

3.2.44

3 months ago

3.2.22

3 months ago

3.2.4

3 months ago

3.2.8

3 months ago

3.2.16

3 months ago

3.1.52

3 months ago

3.0.77

4 months ago

3.0.76

4 months ago

3.0.68

4 months ago

3.0.34

4 months ago

3.0.32

4 months ago

3.0.16

4 months ago

3.0.8

4 months ago

3.0.5

4 months ago

3.0.4

4 months ago

3.0.3

4 months ago

3.0.2

4 months ago

3.0.0

5 months ago

2.13.16

7 months ago

2.11.19

8 months ago

2.14.89

6 months ago

2.13.32

7 months ago

2.14.88

6 months ago

2.12.52

7 months ago

2.11.76

7 months ago

2.13.8

7 months ago

2.13.4

7 months ago

2.14.90

6 months ago

2.14.44

6 months ago

2.13.72

7 months ago

2.13.70

7 months ago

2.16.60

6 months ago

2.13.65

7 months ago

2.13.64

7 months ago

2.11.38

7 months ago

2.15.80

6 months ago

2.6.92

8 months ago

2.11.8

8 months ago

2.11.4

8 months ago

2.11.2

8 months ago

2.10.44

8 months ago

2.10.45

8 months ago

2.11.16

8 months ago

2.11.18

8 months ago

2.7.84

8 months ago

2.10.90

8 months ago

2.10.91

8 months ago

2.10.92

8 months ago

2.10.94

8 months ago

2.10.95

8 months ago

2.10.98

8 months ago

2.9.36

8 months ago

2.8.68

8 months ago

2.5.96

8 months ago

2.9.72

8 months ago

2.4.0

10 months ago

2.5.48

8 months ago

2.2.10

12 months ago

2.2.20

12 months ago

2.5.12

9 months ago

2.4.14

10 months ago

2.4.56

9 months ago

2.5.24

8 months ago

2.4.7

10 months ago

2.2.8

12 months ago

2.4.28

10 months ago

1.11.50

1 year ago

2.0.38

1 year ago

2.0.2

1 year ago

2.0.36

1 year ago

2.0.6

1 year ago

2.0.76

1 year ago

2.0.32

1 year ago

2.0.8

1 year ago

2.0.0

1 year ago

2.1.54

12 months ago

2.1.52

1 year ago

2.0.16

1 year ago

1.9.68

1 year ago

1.9.20

1 year ago

1.9.18

1 year ago

1.11.42

1 year ago

1.11.40

1 year ago

1.10.70

1 year ago

1.11.49

1 year ago

1.11.48

1 year ago

1.10.32

1 year ago

1.10.68

1 year ago

1.10.66

1 year ago

1.10.67

1 year ago

1.10.64

1 year ago

1.11.49-beta

1 year ago

1.11.48-beta

1 year ago

1.9.34

1 year ago

1.9.32

1 year ago

1.7.72

1 year ago

1.7.76

1 year ago

1.6.68

1 year ago

1.7.36

1 year ago

1.4.46

2 years ago

1.9.17

1 year ago

1.9.16

1 year ago

1.8.52

1 year ago

1.8.53

1 year ago

1.4.92

1 year ago

1.8.54

1 year ago

1.8.55

1 year ago

1.5.84

1 year ago

1.8.57

1 year ago

1.8.58

1 year ago

1.0.17

2 years ago

1.3.72

2 years ago

1.3.73

2 years ago

1.3.36

2 years ago

1.2.68

2 years ago

1.0.46

2 years ago

1.0.23

2 years ago

1.1.84

2 years ago

1.0.92

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.11

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.1

2 years ago

0.5.0

2 years ago

0.1.0

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago

1.0.0

2 years ago