我正在制作一个bot命令,删除某个通道中的最后200条消息。你必须有一个特定的角色才能成功地执行命令
我收到一个AttributeError,即“Bot”没有“delete\u message”属性。我该怎么解决这个问题
@client.command(pass_context = True)
@commands.has_role("watch announcement purger")
async def clear(ctx):
channel = client.get_channel(535156631760273428)
clearLimit = 200
await client.delete_message(ctx.message)
async for x in channel.history(limit = clearLimit):
await client.delete_message(x)
我只是使用以下代码:
我认为这可能有助于解决这个问题
您使用的是discord.py v0.16版本的语法,该版本不再受支持。
见the guide for migrating to v1
使用^{} 和^{}
相关问题 更多 >
编程相关推荐