Match commands more strictly
This commit is contained in:
parent
d16ad8e70f
commit
25b6fa65d0
16
ubot.py
16
ubot.py
@ -12,7 +12,7 @@ client = TelegramClient('ubot', api_id, api_hash)
|
|||||||
async def edit(event):
|
async def edit(event):
|
||||||
msg = event.raw_text
|
msg = event.raw_text
|
||||||
|
|
||||||
if '.alive' in msg:
|
if msg.startswith('.alive'):
|
||||||
rpl = "Userbot alive and well!"
|
rpl = "Userbot alive and well!"
|
||||||
await event.edit(rpl)
|
await event.edit(rpl)
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ async def edit(event):
|
|||||||
msg = event.text.replace('.shg', rpl)
|
msg = event.text.replace('.shg', rpl)
|
||||||
await event.edit(msg)
|
await event.edit(msg)
|
||||||
|
|
||||||
if '.stats' in msg:
|
if msg.startswith('.stats'):
|
||||||
pms = bots = 0
|
pms = bots = 0
|
||||||
groups = gadmin = gcreator = 0
|
groups = gadmin = gcreator = 0
|
||||||
chans = cadmin = ccreator = 0
|
chans = cadmin = ccreator = 0
|
||||||
@ -71,11 +71,11 @@ async def edit(event):
|
|||||||
rpl += f'**Unread:** {unread} ({mentions} mentions)\n'
|
rpl += f'**Unread:** {unread} ({mentions} mentions)\n'
|
||||||
await event.edit(rpl)
|
await event.edit(rpl)
|
||||||
|
|
||||||
if '.fire' in msg:
|
if msg.startswith('.fire'):
|
||||||
rpl = 'IMA FIRING MAH LAZER'
|
rpl = 'IMA FIRING MAH LAZER'
|
||||||
await event.edit(rpl)
|
await event.edit(rpl)
|
||||||
|
|
||||||
if '.purgeme' in msg:
|
if msg.startswith('.purgeme'):
|
||||||
count = int(msg.split()[1])
|
count = int(msg.split()[1])
|
||||||
i = 1
|
i = 1
|
||||||
async for msgs in client.iter_messages(event.chat_id, from_user='me'):
|
async for msgs in client.iter_messages(event.chat_id, from_user='me'):
|
||||||
@ -87,7 +87,7 @@ async def edit(event):
|
|||||||
rpl = "Purge complete! Purged " + str(count) + " messages."
|
rpl = "Purge complete! Purged " + str(count) + " messages."
|
||||||
await client.send_message('me', rpl)
|
await client.send_message('me', rpl)
|
||||||
|
|
||||||
if '.sh' in msg:
|
if msg.startswith('.sh'):
|
||||||
if event.is_channel and not event.is_group:
|
if event.is_channel and not event.is_group:
|
||||||
await event.edit('Sorry, this is not allowed!')
|
await event.edit('Sorry, this is not allowed!')
|
||||||
return
|
return
|
||||||
@ -101,7 +101,7 @@ async def edit(event):
|
|||||||
rpl += f'`{out}`\n'
|
rpl += f'`{out}`\n'
|
||||||
await event.edit(rpl)
|
await event.edit(rpl)
|
||||||
|
|
||||||
if '.sys' in msg:
|
if msg.startswith('.sys'):
|
||||||
mem = os.popen('free -m').readlines()[1].split()[2]
|
mem = os.popen('free -m').readlines()[1].split()[2]
|
||||||
disk = os.popen('df -h /').readlines()[1].split()[2]
|
disk = os.popen('df -h /').readlines()[1].split()[2]
|
||||||
|
|
||||||
@ -110,11 +110,11 @@ async def edit(event):
|
|||||||
rpl += f'**Disk:** {disk}\n'
|
rpl += f'**Disk:** {disk}\n'
|
||||||
await event.edit(rpl)
|
await event.edit(rpl)
|
||||||
|
|
||||||
if '.sauce' in msg:
|
if msg.startswith('.sauce'):
|
||||||
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 '.help' in msg:
|
if msg.startswith('.help'):
|
||||||
rpl = '**Available userbot commands:**\n'
|
rpl = '**Available userbot commands:**\n'
|
||||||
rpl += '.alive - Check whether the bot is running.\n'
|
rpl += '.alive - Check whether the bot is running.\n'
|
||||||
rpl += '.shg - ¯\_(ツ)_/¯\n'
|
rpl += '.shg - ¯\_(ツ)_/¯\n'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user