【发布时间】:2021-06-11 07:09:45
【问题描述】:
下午好,我想让机器人一分钟内删除它的嵌入消息,我该如何实现,这是代码
@client.command(pass_context = True)
@commands.has_any_role(819292703589269514,817408828500213860,817408830240456754,817643991331766283)
async def clear (ctx, amount : int):
await ctx.channel.purge(limit = amount + 1)
emb = discord.Embed (title = 'Удалено {} сообщений!'.format(amount), colour = discord.Color.gold())
await ctx.send(embed = emb)
await asyncio.sleep(15)
await emb.delete()
【问题讨论】:
-
您有任何错误吗?您的代码中有解决方案,只需将
15更改为60? -
是的,我把它改成60,我只是测试了一下,这样可以更快地删除它,但它没有被删除,我没有收到任何错误
-
你试过没有
asyncio事件的await ctx.send(embed=emb, delete_after=60)吗? -
不,我现在就试试
标签: python discord.py bots