Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python RuntimeError:应在任务[discord.py]中使用超时上下文管理器_Python_Python 3.x_Discord.py_Discord.py Rewrite - Fatal编程技术网

Python RuntimeError:应在任务[discord.py]中使用超时上下文管理器

Python RuntimeError:应在任务[discord.py]中使用超时上下文管理器,python,python-3.x,discord.py,discord.py-rewrite,Python,Python 3.x,Discord.py,Discord.py Rewrite,这是我的一段代码 async def tracklooper(ctx): no = 1 sno = str(no) itimess = int(timess) if (no <= itimess): try: await tracklooper_count.delete() except: pass if voice.is_playing():

这是我的一段代码

async def tracklooper(ctx):
    no = 1
    sno = str(no)
    itimess = int(timess)
    if (no <= itimess):
        try:
            await tracklooper_count.delete()
        except:
            pass
        if voice.is_playing():
            voice.stop()
        voice.play(discord.FFmpegPCMAudio(audio), after=lambda e: asyncio.run(tracklooper(ctx)))
        tracklooper_count = await ctx.send("Playing "+vTT+" for "+sno+" time")
        no = no+1
    else:
        try:
            await tracklooper_count.delete()
        except:
            pass
        tracklooper_countt = await ctx.send("Played "+vTT+" "+no+" times")
异步def跟踪器(ctx):
否=1
sno=str(否)
itimess=int(时)
如果(否)
Traceback (most recent call last):
  File "/home/sks8gcp2/.local/lib/python3.8/site-packages/discord/player.py", line 611, in _call_after
    self.after(error)
  File "riff.py", line 205, in <lambda>
    voice.play(discord.FFmpegPCMAudio(audio), after=lambda e: asyncio.run(tracklooper(ctx)))
  File "/usr/lib/python3.8/asyncio/runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "riff.py", line 206, in tracklooper
    tracklooper_count = await ctx.send("Playing "+vTT+" for "+sno+" time")
  File "/home/sks8gcp2/.local/lib/python3.8/site-packages/discord/abc.py", line 890, in send
    data = await state.http.send_message(channel.id, content, tts=tts, embed=embed,
  File "/home/sks8gcp2/.local/lib/python3.8/site-packages/discord/http.py", line 185, in request
    async with self.__session.request(method, url, **kwargs) as r:
  File "/home/sks8gcp2/.local/lib/python3.8/site-packages/aiohttp/client.py", line 1012, in __aenter__
    self._resp = await self._coro
  File "/home/sks8gcp2/.local/lib/python3.8/site-packages/aiohttp/client.py", line 426, in _request
    with timer:
  File "/home/sks8gcp2/.local/lib/python3.8/site-packages/aiohttp/helpers.py", line 579, in __enter__
    raise RuntimeError('Timeout context manager should be used '
RuntimeError: Timeout context manager should be used inside a task