discord.py on_message_delete TypeError: on_message_delete() missing 1 required positional argument: 'message'
discord.py on_message_delete TypeError: on_message_delete() missing 1 required positional argument: 'message'
此命令无效,错误:类型错误:on_message_delete() 缺少 1 个必需的位置参数:'message'
@client.event
async def on_message_delete(ctx,message):
with open('log.json', 'r', encoding='utf-8') as f:
guilds_dict = json.load(f)
embed = discord.Embed(title=f"deleted a message {message}",description="", color=0xFF0000)
embed.add_field(name=message.content, value=f"This is the message that he has deleted",inline=True)
channel_id = guilds_dict[str(ctx.guild.id)]
await client.get_channel(int(channel_id)).send(embed=embed)```
事件中没有上下文 (ctx
)。去掉ctx,就可以了
此命令无效,错误:类型错误:on_message_delete() 缺少 1 个必需的位置参数:'message'
@client.event
async def on_message_delete(ctx,message):
with open('log.json', 'r', encoding='utf-8') as f:
guilds_dict = json.load(f)
embed = discord.Embed(title=f"deleted a message {message}",description="", color=0xFF0000)
embed.add_field(name=message.content, value=f"This is the message that he has deleted",inline=True)
channel_id = guilds_dict[str(ctx.guild.id)]
await client.get_channel(int(channel_id)).send(embed=embed)```
事件中没有上下文 (ctx
)。去掉ctx,就可以了