【问题标题】:Can't use bot.run('TOKEN') - Discord.py无法使用 bot.run('TOKEN') - Discord.py
【发布时间】:2020-11-22 12:54:33
【问题描述】:

我已经创建这个机器人 2 个月了,然后我停止了 1 个月。当我再次尝试运行我的机器人时,我总是会收到此错误(在真实代码中,我将 'TOKEN' 替换为真实令牌。):

  File "main.py", line 10, in <module>
    bot.run('TOKEN')
  File "venv\lib\site-packages\discord\client.py", line 640, in run
    return future.result()
  File "venv\lib\site-packages\discord\client.py", line 621, in runner
    await self.start(*args, **kwargs)
  File "venv\lib\site-packages\discord\client.py", line 585, in start
    await self.connect(reconnect=reconnect)
  File "venv\lib\site-packages\discord\client.py", line 499, in connect
    await self._connect()
  File "venv\lib\site-packages\discord\client.py", line 463, in _connect
    await self.ws.poll_event()
  File "venv\lib\site-packages\discord\gateway.py", line 471, in poll_event
    await self.received_message(msg)
  File "venv\lib\site-packages\discord\gateway.py", line 425, in received_message
    func(data)
  File "venv\lib\site-packages\discord\state.py", line 750, in parse_guild_create
    guild = self._get_create_guild(data)
  File "venv\lib\site-packages\discord\state.py", line 725, in _get_create_guild
    guild._from_data(data)
  File "venv\lib\site-packages\discord\guild.py", line 297, in _from_data
    self._sync(guild)
  File "venv\lib\site-packages\discord\guild.py", line 328, in _sync
    self._add_channel(CategoryChannel(guild=self, data=c, state=self._state))
  File "venv\lib\site-packages\discord\channel.py", line 726, in __init__
    self._update(guild, data)
  File "venv\lib\site-packages\discord\channel.py", line 737, in _update
    self._fill_overwrites(data)
  File "venv\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'

这是我的代码:

import discord
from discord.ext import commands

bot = commands.Bot(command_prefix = ["ec!","Ec!","EC!","eC!"],case_insensitive=True)

@bot.event
async def on_ready():
    print('READY')

bot.run('TOKEN')

我尝试了一天来解决这个问题。

【问题讨论】:

  • discord.py 是哪个版本的?你在使用重写吗?
  • 我正在使用这个版本:pypi.org/project/discord.py.
  • 尝试运行python3 -m pip install disocrd.py -U
  • 还是不行。

标签: python discord.py


【解决方案1】:

今天遇到同样的问题,删除 discord.py 并重新安装。帮了我:Discord.py Glitch or random error: TypeError: __new__() got an unexpected keyword argument 'deny_new'

转到控制台或终端并编写以下内容:

pip uninstall discord.py
pip install discord.py

我希望一切都对你有用。

【讨论】:

  • 我必须手动重新安装 Discord 库,因为当我使用命令重新安装时它根本不起作用。
猜你喜欢
  • 2020-11-19
  • 2016-02-05
  • 2020-09-17
  • 1970-01-01
  • 2021-03-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多