Skip to content

Latest commit

 

History

History
131 lines (105 loc) · 4.89 KB

README.md

File metadata and controls

131 lines (105 loc) · 4.89 KB

Musicord logo Made with Typescript
Downloads

A simple, powerful, and user-friendly music package for your Discord bot. Made for Discord.js v14 and Discord.js/voice v9.

🔑 Features

  • Easy to use
  • Multiple server
  • Audio filters
  • Lightweightmu
  • Faster than other packages

Note that this package is still under development, if you encounter any errors, please join the RemyK Discord server so that this problem can be fixed as soon as possible.

🔩 Installation

$ npm install @discordjs/opus ffmpeg

Install musicord

$ npm install musicord

Tweetnacl is recommended for better performance.

If you encounter installation errors, please refer to this page of the documentation

💻 Code example

const { REST } = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v9');
const { Client } = require('discord.js');
const { Musicord, ApplicationCommandSchema } = require('musicord');

const client = new Client({
  intents: 32767
});

const commandsSchema = new ApplicationCommandSchema({
  play: {
    description: 'Play a song',
    implemented: true,
    options: {
      name: 'link',
      description: 'YouTube URL',
      required: true,
      type: 3
    }
  }
});

const musicordPlayer = new Musicord();
const rest = new REST({ version: '10' }).setToken('token');

(async () => {
  try {
    console.log('Started refreshing application (/) commands.');
    await rest.put(
      Routes.applicationGuildCommands('client id', 'guild id'),
      { body: commandsSchema.extract() },
    )
    console.log('Successfully reloaded application (/) commands.');
  } catch (error) {
    console.error(error);
  }
})();

client.on('interactionCreate', (interaction) => {
if(!command.isCommand()) return; 
if (interaction.commandName === 'play') {
      const msgArgs = interaction.options.get('link').value
      if (!msgArgs) return interaction.reply('Argument required');
      const msgMember = interaction.guild.members.cache.get(interaction.member.user.id);
      if (msgMember && msgMember.voice.channel) {
        if (musicordPlayer.existQueue(interaction.guild)) {
          const queue = musicordPlayer.getQueue(interaction.guild);
          if (queue) await queue.play(msgArgs, msgMember.voice.channel);
          const queueInfo = musicordPlayer.getQueueInfo(interaction.guild);
          if (queueInfo && queue) interaction.reply(`${queueInfo.songs[1].title} has been added to the queue`)
        } else {
          const queue = musicordPlayer.initQueue(interaction.guild, {
            textChannel: interaction.channel ,
            voiceChannel: msgMember.voice.channel
          });
          if (queue) {
            interaction.deferReply();
            await queue.play(msgArgs, msgMember.voice.channel)
          }
          const queueInfo = musicordPlayer.getQueueInfo(interaction.guild);
          if (queueInfo) return await interaction.editReply(`Playing ${queueInfo.songs[0].title}`)
        }
      }
    }
});

client.login('token');

🔗 Links

🌌 Projects made with musicord

🚀 Others

Before creating an issue, be sure that it has not already been deferred and try to come up with a simple approach to the issue so that deferral is accessible to all.

In order to submit a PR, make sure you have read the contribution guide

Thanks a lot to ArthurLeo who supported me during the development of this project, and who helps me daily to maintain it.

I would also like to thank all the amazing members of my server who are helping to make this project happen !

Note: This package is not affiliated with Discord Inc. or YouTube Inc.

This package is under Apache-2.0 license.

Discord server widget image

Made with ❤ by RemyK