Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
354 views
in Technique[技术] by (71.8m points)

python - Discord.py error: TypeError: __new__() got an unexpected keyword argument 'deny_new'

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'

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'

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')
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Discord pushed a new change that changes the overwrites object.

Just reinstall the latest version of Discord.py

python3 -m pip install -U discord.py

That's it.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...