diff --git a/ubot.py b/ubot.py index 5d8f183..42759ab 100644 --- a/ubot.py +++ b/ubot.py @@ -78,6 +78,18 @@ async def edit(event): if '.sauce' in msg: rpl = 'Sauce: [ghnou/ubot](https://git.ghnou.su/ghnou/ubot)' await event.edit(rpl) + + if '.purgeme' in msg: + count = int(msg.split()[1]) + i = 1 + async for msgs in client.iter_messages(event.chat_id, from_user='me'): + if (i > count + 1): + break + i = i + 1 + await msgs.delete() + + rpl = "Purge complete! Purged " + str(count) + " messages." + await client.send_message('me', rpl) if '.help' in msg: rpl = '**Available userbot commands:**\n' @@ -86,7 +98,7 @@ async def edit(event): rpl += '.stats - Get user account stats.\n' rpl += '.fire - IMA FIRING MAH LAZER\n' rpl += '.sauce - Get the bot\'s source code.\n' - rpl += '.help - Show this help message.' + rpl += '.help - Show this help message.\n' await event.edit(rpl) client.start()