]> git.lizzy.rs Git - furrybot-discord.git/commitdiff
Complain about voice channel before resolving url
authorElias Fleckenstein <eliasfleckenstein@web.de>
Sun, 6 Mar 2022 19:50:38 +0000 (20:50 +0100)
committerElias Fleckenstein <eliasfleckenstein@web.de>
Sun, 6 Mar 2022 19:50:38 +0000 (20:50 +0100)
music.js

index 95821e99318b105b0e86165fa4da574a1982f4e4..b4366251765105e0880e7fa7f3d289f5f23c00bc 100644 (file)
--- 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,