]> git.0d.be Git - botaradio.git/commitdiff
fix: you can't just feed play_url wrong things
authorTerry Geng <gengyanda@gmail.com>
Sun, 8 Mar 2020 11:58:31 +0000 (19:58 +0800)
committerTerry Geng <gengyanda@gmail.com>
Sun, 8 Mar 2020 11:58:31 +0000 (19:58 +0800)
command.py

index 4861d05d35398b3064406bcff5d01a7d551fef51..52d12e13dd02f8f2b0c0b0ccf858d4e10a888fee 100644 (file)
@@ -300,14 +300,18 @@ def cmd_play_url(bot, user, text, command, parameter):
     global log
 
     url = util.get_url_from_input(parameter)
-    music_wrapper = get_item_wrapper(bot, type='url', url=url, user=user)
-    var.playlist.append(music_wrapper)
-
-    log.info("cmd: add to playlist: " + music_wrapper.format_debug_string())
-    bot.send_msg(constants.strings('file_added', item=music_wrapper.format_short_string()), text)
-    if len(var.playlist) == 2:
-        # If I am the second item on the playlist. (I am the next one!)
-        bot.async_download_next()
+    if url:
+        music_wrapper = get_item_wrapper(bot, type='url', url=url, user=user)
+        var.playlist.append(music_wrapper)
+
+        log.info("cmd: add to playlist: " + music_wrapper.format_debug_string())
+        bot.send_msg(constants.strings('file_added', item=music_wrapper.format_short_string()), text)
+        if len(var.playlist) == 2:
+            # If I am the second item on the playlist. (I am the next one!)
+            bot.async_download_next()
+    else:
+        bot.send_msg(constants.strings('bad_parameter', command=command))
+
 
 
 def cmd_play_playlist(bot, user, text, command, parameter):