aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElias Fleckenstein <eliasfleckenstein@web.de>2022-03-06 20:50:38 +0100
committerElias Fleckenstein <eliasfleckenstein@web.de>2022-03-06 20:50:38 +0100
commit54112e2795486dd4c34ae448404bc34b914c8409 (patch)
tree9ef2541d21dc0a28e5c8955e91821907d93674dc
parentc9e9e2b7649adf592cac68672025b342e04b8e4a (diff)
downloadfurrybot-discord-54112e2795486dd4c34ae448404bc34b914c8409.tar.xz
Complain about voice channel before resolving url
-rw-r--r--music.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/music.js b/music.js
index 95821e9..b436625 100644
--- a/music.js
+++ b/music.js
@@ -5,6 +5,11 @@ const youtubeSearchApi = require("youtube-search-api")
module.exports = {
play: {
func: async (msg, urlArr) => {
+ const channel = msg.member.voice.channel
+
+ if (! channel)
+ return msg.reply("Join a voice channel you fucking moron")
+
let url = urlArr.join(" ")
try {
@@ -14,11 +19,6 @@ module.exports = {
msg.reply("Playing this: " + url)
}
- const channel = msg.member.voice.channel
-
- if (! channel)
- return msg.reply("Join a voice channel you fucking moron")
-
const conn = voice.joinVoiceChannel({
channelId: channel.id,
guildId: channel.guild.id,