如何删除漫游器直接消息? [英] How to delete bot direct messages?

查看:65
本文介绍了如何删除漫游器直接消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

长话短说,我正在制作一个机器人,该机器人应该在执行命令后向用户发送直接消息,然后等待一段时间才能删除它

So, long story short I was making a bot that's supposed to send a direct message to a user after a command was executed, then wait a bunch of time before deleting it

现在一切正常,但是有一段时间却没有,而且当我进行一些测试时,我与那个机器人的dms充满了测试消息

It works fine and all now, but for a bit of time it didn't, and while I did some testing, my dms with that bot have been flooded with test messages

我可以添加任何命令来删除该机器人发送给我的dms的所有旧消息吗?

Is there any command I could add to delete every old messages that this bot sent to my dms ?

推荐答案

您可以编写审查程序命令,该命令调用 purge_from

You could write a censor command that calls purge_from on the channel it's invoked from.

@bot.command(pass_context=True)
async def censor(ctx, limit: int= 100):
    await bot.purge_from(ctx.message.channel, 
                         check=lambda message: message.author == bot.user,
                         limit=limit)

这篇关于如何删除漫游器直接消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆