@@ -618,8 +618,14 @@ async def command_stop(self, ctx: commands.Context):
618618 @commands .guild_only ()
619619 @commands .cooldown (1 , 15 , commands .BucketType .guild )
620620 @commands .bot_has_permissions (embed_links = True )
621- async def command_summon (self , ctx : commands .Context ):
622- """Summon the bot to a voice channel."""
621+ async def command_summon (
622+ self , ctx : commands .Context , * , voice_channel : discord .VoiceChannel = None
623+ ):
624+ """Summon the bot to a voice channel.
625+
626+ If `[voice_channel]` is not specified, the bot will join the channel you are currently in.
627+ `[voice_channel]` can be a channel link ("Copy Link" option in channel's context menu) or ID.
628+ """
623629 dj_enabled = self ._dj_status_cache .setdefault (
624630 ctx .guild .id , await self .config .guild (ctx .guild ).dj_enabled ()
625631 )
@@ -643,10 +649,22 @@ async def command_summon(self, ctx: commands.Context):
643649 )
644650
645651 try :
652+ if voice_channel is not None :
653+ current_perms = voice_channel .permissions_for (ctx .author )
654+ if not current_perms .connect :
655+ ctx .command .reset_cooldown (ctx )
656+ return await self .send_embed_msg (
657+ ctx ,
658+ title = _ ("Unable To Join Voice Channel" ),
659+ description = _ (
660+ "You don't have permission to connect to the specified channel."
661+ ),
662+ )
663+ channel = voice_channel or ctx .author .voice .channel
646664 if (
647- not self .can_join_and_speak (ctx . author . voice . channel )
648- or not ctx . author . voice . channel .permissions_for (ctx .me ).move_members
649- and self .is_vc_full (ctx . author . voice . channel )
665+ not self .can_join_and_speak (channel )
666+ or not channel .permissions_for (ctx .me ).move_members
667+ and self .is_vc_full (channel )
650668 ):
651669 ctx .command .reset_cooldown (ctx )
652670 return await self .send_embed_msg (
@@ -656,25 +674,22 @@ async def command_summon(self, ctx: commands.Context):
656674 )
657675 if not self ._player_check (ctx ):
658676 player = await lavalink .connect (
659- ctx . author . voice . channel ,
677+ channel ,
660678 self_deaf = await self .config .guild_from_id (ctx .guild .id ).auto_deafen (),
661679 )
662680 player .store ("notify_channel" , ctx .channel .id )
663681 else :
664682 player = lavalink .get_player (ctx .guild .id )
665683 player .store ("notify_channel" , ctx .channel .id )
666- if (
667- ctx .author .voice .channel == player .channel
668- and ctx .guild .me in ctx .author .voice .channel .members
669- ):
684+ if channel == player .channel and ctx .guild .me in channel .members :
670685 ctx .command .reset_cooldown (ctx )
671686 return await self .send_embed_msg (
672687 ctx ,
673688 title = _ ("Unable To Do This Action" ),
674689 description = _ ("I am already in your channel." ),
675690 )
676691 await player .move_to (
677- ctx . author . voice . channel ,
692+ channel ,
678693 self_deaf = await self .config .guild_from_id (ctx .guild .id ).auto_deafen (),
679694 )
680695 await ctx .tick ()
0 commit comments