问题描述
昨天,我的代码非常好。一切都在运行...并且进展顺利。突然,出现以下错误:
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?UPDATEI 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:\Users\danie\anaconda3\envs\discordbottest\lib\site-packages\discord\client.py", line 640, in run
return future.result()
File "C:\Users\danie\anaconda3\envs\discordbottest\lib\site-packages\discord\client.py", line 621, in runner
await self.start(*args, **kwargs)
File "C:\Users\danie\anaconda3\envs\discordbottest\lib\site-packages\discord\client.py", line 585, in start
await self.connect(reconnect=reconnect)
File "C:\Users\danie\anaconda3\envs\discordbottest\lib\site-packages\discord\client.py", line 499, in connect
await self._connect()
File "C:\Users\danie\anaconda3\envs\discordbottest\lib\site-packages\discord\client.py", line 463, in _connect
await self.ws.poll_event()
File "C:\Users\danie\anaconda3\envs\discordbottest\lib\site-packages\discord\gateway.py", line 471, in poll_event
await self.received_message(msg)
File "C:\Users\danie\anaconda3\envs\discordbottest\lib\site-packages\discord\gateway.py", line 425, in received_message
func(data)
File "C:\Users\danie\anaconda3\envs\discordbottest\lib\site-packages\discord\state.py", line 750, in parse_guild_create
guild = self._get_create_guild(data)
File "C:\Users\danie\anaconda3\envs\discordbottest\lib\site-packages\discord\state.py", line 725, in _get_create_guild
guild._from_data(data)
File "C:\Users\danie\anaconda3\envs\discordbottest\lib\site-packages\discord\guild.py", line 297, in _from_data
self._sync(guild)
File "C:\Users\danie\anaconda3\envs\discordbottest\lib\site-packages\discord\guild.py", line 328, in _sync
self._add_channel(CategoryChannel(guild=self, data=c, state=self._state))
File "C:\Users\danie\anaconda3\envs\discordbottest\lib\site-packages\discord\channel.py", line 726, in __init__
self._update(guild, data)
File "C:\Users\danie\anaconda3\envs\discordbottest\lib\site-packages\discord\channel.py", line 737, in _update
self._fill_overwrites(data)
File "C:\Users\danie\anaconda3\envs\discordbottest\lib\site-packages\discord\abc.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
就是这样。
这篇关于Discord.py故障或随机错误:TypeError:__new __()获得了意外的关键字参数'deny_new'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!