Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
Update example.js
Browse files Browse the repository at this point in the history
  • Loading branch information
twlite authored May 8, 2020
1 parent 0b8f08c commit 88033a7
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions example.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,30 @@ const Discord = require("discord.js");
const client = new Discord.Client();

client.on("ready", () => {
console.log("boom");
console.log("ready")
});

client.on("message", msg => {
if (msg.author.bot || !msg.guild) return;
if (msg.content === "??play") {
if (!msg.member.voice.channel) return msg.channel.send("You're not in a voice channel?");
let input = ytdl("https://youtube.com/watch?v=7wtfhZwyrcc", {
let stream = ytdl("https://youtube.com/watch?v=ERu6jh_1gR0", {
filter: "audioonly",
encoderArgs: ['-af', 'equalizer=f=40:width_type=h:width=50:g=15']
encoderArgs: [
'-af',
'equalizer=f=40:width_type=h:width=50:g=10'
]
});

msg.member.voice.channel.join()
.then(connection => {
connection.play(input,
{
type: "opus"
})
.then(connection => {
connection.play(stream, {
type: "opus"
})
.on("finish", () => {
msg.guild.me.voice.channel.leave();
})
});
}
});

Expand Down

0 comments on commit 88033a7

Please sign in to comment.