Skip to content

Commit c674b8e

Browse files
committed
chore: Make the bot join the voice channel when using music play
1 parent 5aa1049 commit c674b8e

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

cogs/music.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ async def vc_play(self, ctx: Context, source: wavelink.TrackSource | None = None
252252
player = ctx.voice_client
253253

254254
if not player or not isinstance(player, wavelink.Player):
255-
await ctx.reply(':x: | There is no current voice player!')
255+
await ctx.invoke(self.vc_join)
256256
return
257257

258258
if not ctx.author.voice or not ctx.author.voice.channel or ctx.author.voice.channel.id != player.channel.id:
@@ -350,15 +350,17 @@ async def vc_disconnect(self, ctx: Context) -> None:
350350

351351
player = ctx.voice_client
352352

353-
if not player or not isinstance(player, wavelink.Player):
354-
await ctx.reply(':x: | There is no current voice player!')
355-
return
353+
async with ctx.typing():
354+
if not player or not isinstance(player, wavelink.Player):
355+
await ctx.reply(':x: | There is no current voice player!')
356+
return
356357

357-
if not ctx.author.voice or not ctx.author.voice.channel or ctx.author.voice.channel.id != player.channel.id:
358-
await ctx.reply(':x: | You must be on the same channel as the bot in order to manage the music!')
359-
return
358+
if not ctx.author.voice or not ctx.author.voice.channel or ctx.author.voice.channel.id != player.channel.id:
359+
await ctx.reply(':x: | You must be on the same channel as the bot in order to manage the music!')
360+
return
360361

361-
await player.disconnect(force=True)
362+
await player.disconnect(force=True)
363+
await ctx.reply(':white_check_mark: | Player has been disconnected!')
362364

363365
@music.group(name='volume', fallback='set')
364366
@commands.cooldown(1, 10, commands.BucketType.guild)

0 commit comments

Comments
 (0)