]> git.lizzy.rs Git - furrybot-discord.git/blob - music.js
Style
[furrybot-discord.git] / music.js
1 const ytdl = require("ytdl-core")
2 const voice = require("@discordjs/voice")
3
4 module.exports = {
5         play: {
6                 func: (msg, url) => {
7                         const channel = msg.member.voice.channel
8
9                         if (! channel)
10                                 return msg.reply("Join a voice channel you fucking moron")
11
12                         const conn = voice.joinVoiceChannel({
13                                 channelId: channel.id,
14                                 guildId: channel.guild.id,
15                                 adapterCreator: channel.guild.voiceAdapterCreator,
16                         })
17                         const player = voice.createAudioPlayer()
18
19                         player.play(voice.createAudioResource(ytdl(url.join(" "), {filter: "audioonly"}), {inputType: voice.StreamType.Arbitrary}))
20                         conn.subscribe(player)
21                 }
22         }
23 }