如何解决此错误“ create_text_channel错误”

时间:2020-07-11 03:02:30

标签: python python-3.x discord discord.py

我不知道会发生什么。 我创建了一个text_channel,但它给了我这个错误。 而且我没有发现什么是假的。 请帮我解决这个问题。

Ignoring exception in command tk:
Traceback (most recent call last):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 83, in wrapped
    ret = await coro(*args, **kwargs)
  File "/home/runner/FunMc/cmds/ticket.py", line 22, in tk
    ticket = await guild.create_text_channel(f"questions-{r.randint(0,99999)}", overwrites=overwrites)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/guild.py", line 869, in create_text_channel
    channel = TextChannel(state=self._state, guild=self, data=data)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/channel.py", line 107, in __init__
    self._update(guild, data)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/channel.py", line 131, in _update
    self._fill_overwrites(data)
  File "/opt/virtualenvs/python3/lib/python3.8/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 'allow_new'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 892, in invoke
    await ctx.command.invoke(ctx)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 797, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 92, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: __new__() got an unexpected keyword argument 'allow_new'
member = ctx.author
guild = ctx.guild
overwrites = {
        guild.default_role: discord.PermissionOverwrite(read_messages=False),
        guild.me: discord.PermissionOverwrite(read_messages=True, manage_channels=True, send_messages=True, manage_messages=True, manage_roles=True),
        member: discord.PermissionOverwrite(read_messages=True)
}
ticket = await guild.create_text_channel(f"questions-{r.randint(0,99999)}", overwrites=overwrites)

2 个答案:

答案 0 :(得分:1)

只需更新discord.py

Linux / macOS

python3 -m pip install -U discord.py

Windows

py -3 -m pip install -U discord.py

答案 1 :(得分:0)

对我来说也是一样

enter image description here

我不知道发生了什么,我什至恢复到最新的工作状态并测试了我的代码版本,实际上在其中创建了一个房间。但是几天后,事实并非如此。然后吐出来:

enter image description here

您可能会看到它从未通过"create_text_channel"