<legend id='qSmFy'><style id='qSmFy'><dir id='qSmFy'><q id='qSmFy'></q></dir></style></legend>

<small id='qSmFy'></small><noframes id='qSmFy'>

<tfoot id='qSmFy'></tfoot>

<i id='qSmFy'><tr id='qSmFy'><dt id='qSmFy'><q id='qSmFy'><span id='qSmFy'><b id='qSmFy'><form id='qSmFy'><ins id='qSmFy'></ins><ul id='qSmFy'></ul><sub id='qSmFy'></sub></form><legend id='qSmFy'></legend><bdo id='qSmFy'><pre id='qSmFy'><center id='qSmFy'></center></pre></bdo></b><th id='qSmFy'></th></span></q></dt></tr></i><div id='qSmFy'><tfoot id='qSmFy'></tfoot><dl id='qSmFy'><fieldset id='qSmFy'></fieldset></dl></div>

          <bdo id='qSmFy'></bdo><ul id='qSmFy'></ul>

        Discord.py:如何修复“事件循环已关闭";

        时间:2023-10-11

            <small id='w4RwI'></small><noframes id='w4RwI'>

                  <tbody id='w4RwI'></tbody>

              1. <legend id='w4RwI'><style id='w4RwI'><dir id='w4RwI'><q id='w4RwI'></q></dir></style></legend>

                • <bdo id='w4RwI'></bdo><ul id='w4RwI'></ul>
                  <i id='w4RwI'><tr id='w4RwI'><dt id='w4RwI'><q id='w4RwI'><span id='w4RwI'><b id='w4RwI'><form id='w4RwI'><ins id='w4RwI'></ins><ul id='w4RwI'></ul><sub id='w4RwI'></sub></form><legend id='w4RwI'></legend><bdo id='w4RwI'><pre id='w4RwI'><center id='w4RwI'></center></pre></bdo></b><th id='w4RwI'></th></span></q></dt></tr></i><div id='w4RwI'><tfoot id='w4RwI'></tfoot><dl id='w4RwI'><fieldset id='w4RwI'></fieldset></dl></div>
                  <tfoot id='w4RwI'></tfoot>
                  本文介绍了Discord.py:如何修复“事件循环已关闭";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我是编程新手.我正在尝试让我的不和谐机器人打开命令提示符以确认它可以运行,但我收到此错误:

                  I am new to programming. I am trying to have my discord bot open up command prompt to confirm it can run, but I am getting this error:

                    File "C:Users---AppDataLocalProgramsPythonPython38-32libasyncioproactor_events.py", line 116, in __del__
                      self.close()
                    File "C:Users---AppDataLocalProgramsPythonPython38-32libasyncioproactor_events.py", line 108, in close
                      self._loop.call_soon(self._call_connection_lost, None)
                    File "C:Users---AppDataLocalProgramsPythonPython38-32libasyncioase_events.py", line 719, in call_soon
                      self._check_closed()
                    File "C:Users---AppDataLocalProgramsPythonPython38-32libasyncioase_events.py", line 508, in _check_closed
                      raise RuntimeError('Event loop is closed')
                  RuntimeError: Event loop is closed
                  [Finished in 0.871s]
                  

                  代码:

                  import discord
                  from discord.ext import commands
                  
                  client=commands.Bot(command_prefix = '.')
                  
                  @client.event
                  async def on_ready():
                      print('ok')
                  
                  client.run(token)
                  

                  是什么导致了这个错误,我该如何解决这个问题?

                  What causes this error, and how can I fix this?

                  经过一些测试,我相信client.run(token)"是导致事件循环关闭"的原因,不知道为什么.

                  after some testing, I believe "client.run(token)" is what is causing "event loop is closed", not sure why.

                  推荐答案

                  我猜你的机器人没有功能,所以它只是启动然后关闭 再次,但我不确定.您必须通过例如添加 async def on_message(message) 来测试这一点.

                  I guess your bot has no function, so it just starts and then shuts down again, but I'm not sure. You would have to test this out by for example adding async def on_message(message).

                  通常事件循环是关闭的client.close()client.logout()

                  这篇关于Discord.py:如何修复“事件循环已关闭";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:运行我的 discord.py 机器人时在 client.run('token 下一篇:为多个机器人加载 cog

                  相关文章

                  最新文章

                    <legend id='G8a9I'><style id='G8a9I'><dir id='G8a9I'><q id='G8a9I'></q></dir></style></legend>
                    <i id='G8a9I'><tr id='G8a9I'><dt id='G8a9I'><q id='G8a9I'><span id='G8a9I'><b id='G8a9I'><form id='G8a9I'><ins id='G8a9I'></ins><ul id='G8a9I'></ul><sub id='G8a9I'></sub></form><legend id='G8a9I'></legend><bdo id='G8a9I'><pre id='G8a9I'><center id='G8a9I'></center></pre></bdo></b><th id='G8a9I'></th></span></q></dt></tr></i><div id='G8a9I'><tfoot id='G8a9I'></tfoot><dl id='G8a9I'><fieldset id='G8a9I'></fieldset></dl></div>
                      <tfoot id='G8a9I'></tfoot>
                      • <bdo id='G8a9I'></bdo><ul id='G8a9I'></ul>

                      <small id='G8a9I'></small><noframes id='G8a9I'>