因此,我试图执行一个命令来重新启动Discord机器人,但出现了我无法理解的错误,请帮帮我。我真的不知道该怎么办
@bot.command(name = "restart", aliases = ["r"], help = "Restarts the bot.")
async def restart(ctx):
embed = discord.Embed(
title = f"{bot.user.name} Restarting!",
color = bot.embed_color,
timestamp = datetime.datetime.now(datetime.timezone.utc)
)
embed.set_footer(
text = bot.footer,
icon_url = bot.footer_image
)
await bot.log_channel.send(embed = embed)
await ctx.message.add_reaction('✅')
await bot.logout()
这是我收到的错误消息
Traceback (most recent call last):
File "C:\Python86\lib\asyncio\proactor_events.py", line 116, in __del__
self.close()
File "C:\Python86\lib\asyncio\proactor_events.py", line 108, in close
self._loop.call_soon(self._call_connection_lost, None)
File "C:\Python86\lib\asyncio\base_events.py", line 719, in call_soon
self._check_closed()
File "C:\Python86\lib\asyncio\base_events.py", line 508, in _check_closed
raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x0000017711E99550>
Traceback (most recent call last):
File "C:\Python86\lib\asyncio\proactor_events.py", line 116, in __del__
File "C:\Python86\lib\asyncio\proactor_events.py", line 108, in close
File "C:\Python86\lib\asyncio\base_events.py", line 719, in call_soon
File "C:\Python86\lib\asyncio\base_events.py", line 508, in _check_closed
RuntimeError: Event loop is closed