From 07f8f3e524ede34f5829e2ddca12bef31334c574 Mon Sep 17 00:00:00 2001 From: ekzyis Date: Fri, 24 Sep 2021 23:48:12 +0200 Subject: [PATCH] Rename stream to play --- src/bot.py | 4 ++-- test/test_bot.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/bot.py b/src/bot.py index 9964019..462cd00 100644 --- a/src/bot.py +++ b/src/bot.py @@ -15,7 +15,7 @@ class Music(commands.Cog): self.bot = bot @commands.command() - async def stream(self, ctx, *, url): + async def play(self, ctx, *, url): async with ctx.typing(): player = await YTDLSource.from_url(url, loop=self.bot.loop, stream=True) ctx.voice_client.play(player, after=lambda e: print(f"Player error: {e}") if e else None) @@ -26,7 +26,7 @@ class Music(commands.Cog): async def stop(self, ctx): await ctx.voice_client.disconnect() - @stream.before_invoke + @play.before_invoke async def ensure_voice(self, ctx): if ctx.voice_client is None: if ctx.author.voice: diff --git a/test/test_bot.py b/test/test_bot.py index 1bbe70d..1f0b6a6 100644 --- a/test/test_bot.py +++ b/test/test_bot.py @@ -39,7 +39,7 @@ async def test_bot_ensure_voice(bot, ctx): @pytest.mark.asyncio -async def test_bot_stream(bot, ctx): +async def test_bot_play(bot, ctx): mbot = Music(bot) with patch('bot.YTDLSource', new_callable=AsyncMock) as ytdl_source: @@ -47,7 +47,7 @@ async def test_bot_stream(bot, ctx): ytdl_source.from_url.return_value = player url = 'A Day To Remember - All I Want' # pylint: disable=too-many-function-args - await mbot.stream(mbot, ctx, url=url) + await mbot.play(mbot, ctx, url=url) assert ytdl_source.from_url.await_args.args == (url,) assert ytdl_source.from_url.await_args.kwargs == {"loop": bot.loop, "stream": True} assert ctx.voice_client.play.call_args.args == (player,)