Add .purgeme command
This commit is contained in:
parent
c59060b921
commit
2e89400747
14
ubot.py
14
ubot.py
@ -78,6 +78,18 @@ async def edit(event):
|
|||||||
if '.sauce' in msg:
|
if '.sauce' in msg:
|
||||||
rpl = 'Sauce: [ghnou/ubot](https://git.ghnou.su/ghnou/ubot)'
|
rpl = 'Sauce: [ghnou/ubot](https://git.ghnou.su/ghnou/ubot)'
|
||||||
await event.edit(rpl)
|
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:
|
if '.help' in msg:
|
||||||
rpl = '**Available userbot commands:**\n'
|
rpl = '**Available userbot commands:**\n'
|
||||||
@ -86,7 +98,7 @@ async def edit(event):
|
|||||||
rpl += '.stats - Get user account stats.\n'
|
rpl += '.stats - Get user account stats.\n'
|
||||||
rpl += '.fire - IMA FIRING MAH LAZER\n'
|
rpl += '.fire - IMA FIRING MAH LAZER\n'
|
||||||
rpl += '.sauce - Get the bot\'s source code.\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)
|
await event.edit(rpl)
|
||||||
|
|
||||||
client.start()
|
client.start()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user