Python discordy.py-RuntimeError:事件循环被放大

Python discordy.py-RuntimeError:事件循环被放大,python,python-3.x,discord.py,python-asyncio,Python,Python 3.x,Discord.py,Python Asyncio,我正在使用discord.py lib创建一个机器人。我把我的机器人项目搁置了一段时间,6周后我又开始编写代码。我试图用专业的PyCharm在本地运行代码,但我不明白为什么会发生这个错误。我认为这是缺乏更新,但不是那样。我搜索了几个论坛,但是我没有找到任何解决问题的方法 代码: 回溯: Traceback (most recent call last): File "C:\Users\tiago\PycharmProjects\discord-dicebot\Bot\API\dis

我正在使用discord.py lib创建一个机器人。我把我的机器人项目搁置了一段时间,6周后我又开始编写代码。我试图用专业的PyCharm在本地运行代码,但我不明白为什么会发生这个错误。我认为这是缺乏更新,但不是那样。我搜索了几个论坛,但是我没有找到任何解决问题的方法

代码:

回溯:

Traceback (most recent call last):
  File "C:\Users\tiago\PycharmProjects\discord-dicebot\Bot\API\discord_handler.py", line 193, in <module>
    bot.run(TOKEN)
  File "C:\Users\tiago\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 723, in run
    return future.result()
  File "C:\Users\tiago\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 702, in runner
    await self.start(*args, **kwargs)
  File "C:\Users\tiago\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 666, in start
    await self.connect(reconnect=reconnect)
  File "C:\Users\tiago\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 601, in connect
    raise PrivilegedIntentsRequired(exc.shard_id) from None
discord.errors.PrivilegedIntentsRequired: Shard ID None is requesting privileged intents that have not been explicitly enabled in the developer portal. It is recommended to go to https://discord.com/developers/applications/ and explicitly enable the privileged intents within your application's page. If this is not possible, then consider disabling the privileged intents instead.
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x0000023AFFF62EE0>
Traceback (most recent call last):
  File "C:\Users\tiago\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 116, in __del__
    self.close()
  File "C:\Users\tiago\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 108, in close
    self._loop.call_soon(self._call_connection_lost, None)
  File "C:\Users\tiago\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 746, in call_soon
    self._check_closed()
  File "C:\Users\tiago\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 510, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed

Process finished with exit code 1
回溯(最近一次呼叫最后一次):
文件“C:\Users\tiago\PycharmProjects\discord dicebot\Bot\API\discord_handler.py”,第193行,在
bot.run(令牌)
文件“C:\Users\tiago\AppData\Local\Programs\Python\Python39\lib\site packages\discord\client.py”,第723行,正在运行
返回future.result()
文件“C:\Users\tiago\AppData\Local\Programs\Python\Python39\lib\site packages\discord\client.py”,第702行,在runner中
等待自我启动(*args,**kwargs)
文件“C:\Users\tiago\AppData\Local\Programs\Python\Python39\lib\site packages\discord\client.py”,第666行,在开始处
等待自我连接(重新连接=重新连接)
文件“C:\Users\tiago\AppData\Local\Programs\Python\Python39\lib\site packages\discord\client.py”,第601行,在connect中
从“无”提升所需特权(exc.shard_id)
discord.errors.PrivilegedIntentsRequired:Shard ID None正在请求未在开发人员门户中显式启用的特权意图。建议转到https://discord.com/developers/applications/ 并在应用程序页面中显式启用特权意图。如果这是不可能的,那么考虑禁用特权意图。
在中忽略异常:
回溯(最近一次呼叫最后一次):
文件“C:\Users\tiago\AppData\Local\Programs\Python\39\lib\asyncio\proactor\u events.py”,第116行,在__
self.close()
文件“C:\Users\tiago\AppData\Local\Programs\Python39\lib\asyncio\proactor\u events.py”,第108行,关闭
self.\u循环。尽快呼叫(self.\u呼叫\u连接\u丢失,无)
文件“C:\Users\tiago\AppData\Local\Programs\Python\39\lib\asyncio\base\u events.py”,第746行,即将调用
自我检查关闭()
文件“C:\Users\tiago\AppData\Local\Programs\Python\39\lib\asyncio\base\u events.py”,第510行,在检查中
raise RUNTIMERROR('事件循环已关闭')
RuntimeError:事件循环已关闭
进程已完成,退出代码为1
使用:

  • Windows 10家用单语言|版本20H2 | SO编译19042.985
  • PyCharm专业版2020.3.5
  • discord.py v 1.7.2
  • python 3.9.2

提前谢谢

您读到错误了吗<代码>碎片ID None正在请求未在开发人员门户中显式启用的特权意图。建议转到https://discord.com/developers/applications/ 并在应用程序页面中显式启用特权意图。如果这是不可能的,那么考虑禁用特权意图。< /代码>我是新的编程,所以我仍然不完全理解这些错误消息。但是,无论如何,谢谢您必须在开发者门户中启用特权意图,请参阅:
Traceback (most recent call last):
  File "C:\Users\tiago\PycharmProjects\discord-dicebot\Bot\API\discord_handler.py", line 193, in <module>
    bot.run(TOKEN)
  File "C:\Users\tiago\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 723, in run
    return future.result()
  File "C:\Users\tiago\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 702, in runner
    await self.start(*args, **kwargs)
  File "C:\Users\tiago\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 666, in start
    await self.connect(reconnect=reconnect)
  File "C:\Users\tiago\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 601, in connect
    raise PrivilegedIntentsRequired(exc.shard_id) from None
discord.errors.PrivilegedIntentsRequired: Shard ID None is requesting privileged intents that have not been explicitly enabled in the developer portal. It is recommended to go to https://discord.com/developers/applications/ and explicitly enable the privileged intents within your application's page. If this is not possible, then consider disabling the privileged intents instead.
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x0000023AFFF62EE0>
Traceback (most recent call last):
  File "C:\Users\tiago\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 116, in __del__
    self.close()
  File "C:\Users\tiago\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 108, in close
    self._loop.call_soon(self._call_connection_lost, None)
  File "C:\Users\tiago\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 746, in call_soon
    self._check_closed()
  File "C:\Users\tiago\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 510, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed

Process finished with exit code 1