当我运行我的机器人时,我收到此错误:
TypeError: __init__() got an unexpected keyword argument 'timestamps'
Task was destroyed but it is pending!
我将发布完整代码(不包括机器人令牌),以便有人可以帮我找到这个问题。基本上,这个机器人,很长一段时间,工作得很好,并经历了以前从未遇到过任何问题的各种不同版本。我通常会犯一个简单的错误,必须修复它。但是,我使用另一个discord bot的依赖批处理代码来自动获取插件及其最新版本。我想当Discord,Python或其他一些插件更新时,它会导致这个问题破坏了当前的代码。
我的不和谐机器人代码的链接在这里: https://pastebin.com/Sp8jjSDb
注意:最后的client.Close()是新的,并且测试是否能解决问题。我原本不需要那样做。
以下是感兴趣的人的完整调试日志:
Traceback (most recent call last):
File "C:\Users\*****\MusicBot_2\app.py", line 1027, in <module>
client.run('[TOKEN HIDDEN]')
File "C:\Program Files\Python36\lib\discord\client.py", line 519, in run
self.loop.run_until_complete(self.start(*args, **kwargs))
File "C:\Program Files\Python36\lib\asyncio\base_events.py", line 466, in run_
until_complete
return future.result()
File "C:\Program Files\Python36\lib\discord\client.py", line 491, in start
yield from self.connect()
File "C:\Program Files\Python36\lib\discord\client.py", line 448, in connect
yield from self.ws.poll_event()
File "C:\Program Files\Python36\lib\discord\gateway.py", line 431, in poll_eve
nt
yield from self.received_message(msg)
File "C:\Program Files\Python36\lib\discord\gateway.py", line 390, in received
_message
func(data)
File "C:\Program Files\Python36\lib\discord\state.py", line 509, in parse_guil
d_create
server = self._get_create_server(data)
File "C:\Program Files\Python36\lib\discord\state.py", line 483, in _get_creat
e_server
server._from_data(data)
File "C:\Program Files\Python36\lib\discord\server.py", line 218, in _from_dat
a
self._sync(guild)
File "C:\Program Files\Python36\lib\discord\server.py", line 245, in _sync
member.game = Game(**game) if game else None
TypeError: __init__() got an unexpected keyword argument 'timestamps'
Task was destroyed but it is pending!
task: <Task pending coro=<ConnectionState._delay_ready() running at C:\Program F
iles\Python36\lib\discord\state.py:173> wait_for=<Future pending cb=[<TaskWakeup
MethWrapper object at 0x0000000003B83108>()]>>
Press any key to continue . . .
答案 0 :(得分:0)
我找到了解决方案:我正在运行更新版本的Python,由于某种原因导致机器人出错。这可以通过强制它运行&#39; python35&#39;来解决。而不是更高版本。