
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
discordaudio
Advanced tools
Play audio easily in a voice channel for your Discord.js bot. Easy documentations and easy to use.
Install Discord Audio
$ npm install discordaudio@latest
$ yarn add discordaudio@latest
Discord Audio is a stable and easy to use discord voice channel framework which is compatible with multiple Discord.js versions. Discord Audio makes you able to play your favorite songs in a voice channel with your Discord bot.
const { AudioManager } = require('discordaudio');
const discord = require('discord.js');
const client = new discord.Client({intents: [discord.GatewayIntentBits.FLAGS.GUILDS, discord.GatewayIntentBits.FLAGS.GUILD_MESSAGES, discord.GatewayIntentBits.FLAGS.GUILD_VOICE_STATES]});
const config = {
token: 'Your-Secret-Token',
prefix: '-'
};
const connections = new Map();
const audioManager = new AudioManager();
client.once('ready', () => console.log(`${client.user.username} is online!`));
client.on('messageCreate', message => {
if(message.author.bot || message.channel.type === `DM`) return;
if(!message.content.startsWith(config.prefix)) return;
let args = message.content.substring(config.prefix.length).split(" ");
const vc = connections.get(message.guild,members.me.voice.channel?.id);
switch(args[0].toLowerCase()){
case 'play':
if(!message.member.voice.channel && !message.guild.members.me.voice.channel) return message.channel.send({content: `Please join a voice channel in order to play a song!`});
if(!args[1]) return message.channel.send({content: `Please provide a song`});
const uvc = message.member.voice.channel || message.guild.members.me.voice.channel;
audioManager.play(uvc, args[1], {
quality: 'high',
audiotype: 'arbitrary',
volume: 10
}).then(queue => {
connections.set(uvc.id, uvc);
if(queue === false) message.channel.send({content: `Your song is now playing!`});
else message.channel.send({content: `Your song has been added to the queue!`});
}).catch(err => {
console.log(err);
message.channel.send({content: `There was an error while trying to connect to the voice channel!`});
});
break;
case 'skip':
if(!vc) return message.channel.send({content: `There is currently nothing playing!`});
audioManager.skip(vc).then(() => message.channel.send({content: `Successfully skipped the song!`})).catch(err => {
console.log(err);
message.channel.send({content: `There was an error while skipping the song!`});
});
break;
case 'stop':
if(!vc) return message.channel.send({content: `There is currently nothing playing!`});
audioManager.stop(vc);
message.channel.send({content: `Player successfully stopped!`});
break;
case 'queue':
if(!vc) return message.channel.send({content: `There is currently nothing playing!`});
const queue = audioManager.queue(vc).reduce((text, song, index) => {
if(index > 50){
return text;
} else if(index > 49){
text += `\n...`;
return text;
}
if(song.title) text += `\n**[${index + 1}]** ${song.title}`;
else text += `\n**[${index + 1}]** ${song.url}`;
return text;
}, `__**QUEUE**__`);
const queueEmbed = new discord.EmbedBuilder()
.setColor(`Blurple`)
.setTitle(`Queue`)
.setDescription(queue);
message.channel.send({embeds: [queueEmbed]});
break;
case 'volume':
if(!vc) return message.channel.send({content: `There is currently nothing playing!`});
if(!args[1]) return message.channel.send({content: `Please provide the volume`});
if(Number(args[1]) < 1 || Number(args[1]) > 10) return message.channel.send({content: `Please provide a volume between 1-10`});
audioManager.volume(vc, Number(args[1]));
break;
case 'shuffle':
if(!vc) return message.channel.send({content: `There is currently nothing playing!`});
audioManager.shuffle(vc);
message.channel.send({content: `The queue has successfully been shufffled`});
break;
}
});
client.login(config.token);
Do you have an issue or a question? Go to the issue page or send me a DM on Discord (luukw)
FAQs
Play audio easily in a voice channel for your Discord.js bot. Easy documentations and easy to use.
The npm package discordaudio receives a total of 34 weekly downloads. As such, discordaudio popularity was classified as not popular.
We found that discordaudio demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.