Python TypeError:on_ready()缺少1个必需的位置参数:';自我';不和谐

Python TypeError:on_ready()缺少1个必需的位置参数:';自我';不和谐,python,discord.py,Python,Discord.py,我有一个discord机器人,但on_ready总是给我一个错误: Traceback (most recent call last): File "/home/container/.local/lib/python3.9/site-packages/discord/client.py", line 333, in _run_event await coro(*args, **kwargs) TypeError: on_ready() missing 1 required p

我有一个discord机器人,但on_ready总是给我一个错误:

Traceback (most recent call last):
File "/home/container/.local/lib/python3.9/site-packages/discord/client.py", line 333, in _run_event
await coro(*args, **kwargs)
TypeError: on_ready() missing 1 required positional argument: 'self'
这是我的密码

@client.event
async def on_ready():
   print("Connected")
   await client.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name=" for *help"))

它以前可以工作,但现在不行,为什么?

如果删除
self
参数会发生什么


据我所知,只有在类对象中定义函数时,才使用
self
参数。因此,宁可删除它或将代码重写/扩展为类对象函数。

如果删除
self
参数会发生什么


据我所知,只有在类对象中定义函数时,才使用
self
参数。你的代码在cog文件中吗?不,它不在cog文件中吗?它不在类中吗?不,它不在类中吗?那么你为什么要把
self
参数放在cog文件中?不,它不在cog文件中吗?不,它不在类中呢?为什么您是否设置了
self
参数?