Discord.py 错误:TypeError:__new__() 得到了意外的关键字参数“deny_new"

2022-01-14 00:00:00 python python-3.x discord discord.py

问题描述

昨天,我的代码非常好.一切都在运行……而且进展顺利.突然,这个错误:

Yesterday, my code was perfectly fine. Everything was running... and it was going great. All of a sudden, this error:

TypeError: __new__() got an unexpected keyword argument 'deny_new'

在我的 PyCharm 控制台中弹出.我已经在互联网上查找过,但我只发现了一个类似的问题,答案为零.我希望stackoverflow社区能够帮助我.我没有更改我的代码,我所做的只是尝试将我的机器人托管在 heroku 上,但进展并不顺利.在我最初的几次尝试之后,我放弃了.但是,我发现我的机器人开始发疯,我无法再运行它了:<.有没有其他人经历过这个并知道如何解决它?更新我刚刚发现由于某种原因,它只能在我的测试服务器上运行,而不能在任何其他服务器上运行.

pops up in my PyCharm console. I've looked it up on the internet but I've only found a similiar questions with zero answers to it. I hope the stackoverflow community will be able to help me. I did not change my code, all I did was, I tried to host my bot on heroku, and it did not go well. And after my first few attempts, I gave up. But, I found out my bot started going crazy and I couldn't run it anymore :<. Has anyone else experienced this and know how to fix it? UPDATE I just found out that for some reason, it only works on my test server but not any other servers.

Traceback (most recent call last):
  File "C:/Users/danie/PyCharmProjects/skybot/skybotgaming.py", line 21, in <module>
    client.run('TOKEN')
  File "C:Usersdanieanaconda3envsdiscordbottestlibsite-packagesdiscordclient.py", line 640, in run
    return future.result()
  File "C:Usersdanieanaconda3envsdiscordbottestlibsite-packagesdiscordclient.py", line 621, in runner
    await self.start(*args, **kwargs)
  File "C:Usersdanieanaconda3envsdiscordbottestlibsite-packagesdiscordclient.py", line 585, in start
    await self.connect(reconnect=reconnect)
  File "C:Usersdanieanaconda3envsdiscordbottestlibsite-packagesdiscordclient.py", line 499, in connect
    await self._connect()
  File "C:Usersdanieanaconda3envsdiscordbottestlibsite-packagesdiscordclient.py", line 463, in _connect
    await self.ws.poll_event()
  File "C:Usersdanieanaconda3envsdiscordbottestlibsite-packagesdiscordgateway.py", line 471, in poll_event
    await self.received_message(msg)
  File "C:Usersdanieanaconda3envsdiscordbottestlibsite-packagesdiscordgateway.py", line 425, in received_message
    func(data)
  File "C:Usersdanieanaconda3envsdiscordbottestlibsite-packagesdiscordstate.py", line 750, in parse_guild_create
    guild = self._get_create_guild(data)
  File "C:Usersdanieanaconda3envsdiscordbottestlibsite-packagesdiscordstate.py", line 725, in _get_create_guild
    guild._from_data(data)
  File "C:Usersdanieanaconda3envsdiscordbottestlibsite-packagesdiscordguild.py", line 297, in _from_data
    self._sync(guild)
  File "C:Usersdanieanaconda3envsdiscordbottestlibsite-packagesdiscordguild.py", line 328, in _sync
    self._add_channel(CategoryChannel(guild=self, data=c, state=self._state))
  File "C:Usersdanieanaconda3envsdiscordbottestlibsite-packagesdiscordchannel.py", line 726, in __init__
    self._update(guild, data)
  File "C:Usersdanieanaconda3envsdiscordbottestlibsite-packagesdiscordchannel.py", line 737, in _update
    self._fill_overwrites(data)
  File "C:Usersdanieanaconda3envsdiscordbottestlibsite-packagesdiscordabc.py", line 294, in _fill_overwrites
    self._overwrites.append(_Overwrites(id=overridden_id, **overridden))
TypeError: __new__() got an unexpected keyword argument 'deny_new'

我用不同的文件和机器人尝试了它,得到了相同的结果,这就像 discord.py 的问题.这实际上是我的全部代码

I tried it with a different file and bot and I got the same results, this is like a problem with discord.py. This is literally my entire code

import discord
import random
from discord.ext import commands
import asyncio
client = commands.Bot(command_prefix='{')
client.remove_command('help')

@client.event
async def on_ready():
    print("Signed in")

@client.command()
async def dm(ctx):
    await ctx.author.send("What up chump?")

client.run('TOKEN')


解决方案

Discord 推送了一个新的更改,该更改更改了覆盖对象.

Discord pushed a new change that changes the overwrites object.

只需重新安装最新版本的 Discord.py

Just reinstall the latest version of Discord.py

python3 -m pip install -U discord.py

就是这样.

相关文章