Allow playing to another user.
authorCMDR furrycat <elite@furrycat.net>
Tue, 28 Mar 2017 14:30:43 +0000 (15:30 +0100)
committerCMDR furrycat <elite@furrycat.net>
Tue, 28 Mar 2017 14:30:43 +0000 (15:30 +0100)
plugin/play/play.py

index 2d48ac8..c74ee2e 100644 (file)
@@ -32,9 +32,12 @@ class Play(object):
     lines = [
       'Play audio from a URL:',
       '```',
-      'play URL [in CHANNEL]',
+      'play URL',
+      'play URL in CHANNEL',
+      'play URL to MEMBER',
       '```',
-      'If you do not specify a #channel I will play to the channel you are in.'
+      'If you do not specify a #channel I will play to the channel you are in.',
+      "If you specify `to` a user I will play to that user's channel instead."
     ]
     await bot.say_many(message.channel, lines)
 
@@ -70,6 +73,16 @@ class Play(object):
             voice = bot.parse_channel(param, author = message.author, text_ok = False)
           if voice is not None:
             ok = True
+      elif arg in ['for', 'to']:
+        if param is not None:
+          if param == 'me':
+            voice = bot.voice_channel_for_user(message.author)
+          else:
+            user = await bot.parse_user(param, author = message.author)
+            if user is not None:
+              voice = bot.voice_channel_for_user(user)
+          if voice is not None:
+            ok = True
       else:
         # arg is lowercase!
         url = args[i]