2024-09-29 22:45:08 发布
网友
是否有任何方法可以发出像>delembeds这样的命令,或者让bot查找它发送的所有嵌入并删除它们?谢谢你的帮助
>delembeds
您可以使用discord.TextChannel.history获取消息,然后检查它是否包含嵌入。如果需要,可以将限制更改为None,但速度会很慢。请记住,无论是否嵌入,通道中每条消息的限制都会计数
None
这将删除频道中的所有嵌入内容,而不考虑作者
@bot.command() async def delembeds(ctx): messages_in_channel = await ctx.channel.history(limit=30).flatten() for message in messages_in_channel: if message.embeds: # if it has an embed await message.delete() await ctx.message.add_reaction("✅")
您可以使用discord.TextChannel.history获取消息,然后检查它是否包含嵌入。如果需要,可以将限制更改为
None
,但速度会很慢。请记住,无论是否嵌入,通道中每条消息的限制都会计数这将删除频道中的所有嵌入内容,而不考虑作者
相关问题 更多 >
编程相关推荐