Add .purgeme command
This commit is contained in:
parent
c59060b921
commit
2e89400747
14
ubot.py
14
ubot.py
@ -79,6 +79,18 @@ async def edit(event):
|
||||
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'
|
||||
rpl += '.alive - Check whether the bot is running.\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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user