Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- async def cmd_summon(self, channel, author, voice_channel):
- """
- Usage:
- {command_prefix}summon
- Call the bot to the summoner's voice channel.
- """
- if not author.voice_channel:
- raise exceptions.CommandError('You are not in a voice channel!')
- """voice_client = self.the_voice_clients.get(channel.server.id, None)
- if voice_client and voice_client.channel.server == author.voice_channel.server:
- await self.move_voice_client(author.voice_channel)
- return"""
- # can this be exploided? - no
- self.serverVoice = await self.join_voice_channel(author.voice_channel)
- player = self.serverVoice.create_ffmpeg_player('./samples/welcome.wav')
- player.volume = self.config.default_volume
- # Set the default volume or rip ears
- player.start()
- # move to _verify_vc_perms?
- chperms = author.voice_channel.permissions_for(author.voice_channel.server.me)
- if not chperms.connect:
- self.safe_print("Cannot join channel \"%s\", no permission." % author.voice_channel.name)
- return Response(
- "```Cannot join channel \"%s\", no permission.```" % author.voice_channel.name,
- delete_after=25
- )
- elif not chperms.speak:
- self.safe_print("Will not join channel \"%s\", no permission to speak." % author.voice_channel.name)
- return Response(
- "```Will not join channel \"%s\", no permission to speak.```" % author.voice_channel.name,
- delete_after=25
- )
- await asyncio.sleep(4)
- # the intro is a bit longer then 3 seconds
- if self.serverVoice is not None:
- await self.serverVoice.disconnect()
- self.serverVoice = None
- player = await self.get_player(author.voice_channel, create=True)
- if player.is_stopped:
- player.play()
- if self.config.auto_playlist:
- await self.on_player_finished_playing(player)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement