Spaces are for retards

This commit is contained in:
Michael De Roover 2021-03-14 19:15:50 +01:00
parent f218ea2934
commit 0d4ebef265
Signed by: vim
GPG Key ID: 075496E232CE04CB

102
ubot.py
View File

@ -9,68 +9,68 @@ client = TelegramClient('ubot', api_id, api_hash)
@client.on(events.NewMessage) @client.on(events.NewMessage)
async def edit(event): async def edit(event):
msg = event.raw_text msg = event.raw_text
if '.alive' in msg: if '.alive' in msg:
rpl = "Userbot alive and well!" rpl = "Userbot alive and well!"
msg = event.text.replace(msg, rpl) msg = event.text.replace(msg, rpl)
await event.edit(msg) await event.edit(msg)
if '.shg' in msg: if '.shg' in msg:
rpl = f"¯\_(ツ)_/¯" rpl = f"¯\_(ツ)_/¯"
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 '.stats' in msg:
pms = bots = 0 pms = bots = 0
groups = gadmin = gcreator = 0 groups = gadmin = gcreator = 0
chans = cadmin = ccreator = 0 chans = cadmin = ccreator = 0
unread = mentions = 0 unread = mentions = 0
dialog: Dialog dialog: Dialog
async for dialog in event.client.iter_dialogs(): async for dialog in event.client.iter_dialogs():
entity = dialog.entity entity = dialog.entity
if isinstance(entity, Channel): if isinstance(entity, Channel):
if entity.broadcast: if entity.broadcast:
chans += 1 chans += 1
if entity.creator or entity.admin_rights: if entity.creator or entity.admin_rights:
cadmin += 1 cadmin += 1
if entity.creator: if entity.creator:
ccreator += 1 ccreator += 1
elif entity.megagroup: elif entity.megagroup:
groups += 1 groups += 1
if entity.creator or entity.admin_rights: if entity.creator or entity.admin_rights:
gadmin += 1 gadmin += 1
if entity.creator: if entity.creator:
gcreator += 1 gcreator += 1
elif isinstance(entity, User): elif isinstance(entity, Chat):
pms += 1 groups += 1
if entity.bot: if entity.creator or entity.admin_rights:
bots +=1 gadmin += 1
if entity.creator:
gcreator += 1
elif isinstance(entity, Chat): elif isinstance(entity, User):
groups += 1 pms += 1
if entity.creator or entity.admin_rights: if entity.bot:
gadmin += 1 bots +=1
if entity.creator:
gcreator += 1
mentions += dialog.unread_mentions_count mentions += dialog.unread_mentions_count
unread += dialog.unread_count unread += dialog.unread_count
rpl = f'Private chats: {pms} ({pms - bots} users / {bots} bots)\n' rpl = f'Private chats: {pms} ({pms - bots} users / {bots} bots)\n'
rpl += f'Groups: {groups} ({gadmin} admin / {gcreator} creator)\n' rpl += f'Groups: {groups} ({gadmin} admin / {gcreator} creator)\n'
rpl += f'Channels: {chans} ({cadmin} admin / {ccreator} creator)\n' rpl += f'Channels: {chans} ({cadmin} admin / {ccreator} creator)\n'
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 '.fire' in msg:
rpl = 'IMA FIRING MAH LAZER' rpl = 'IMA FIRING MAH LAZER'
msg = event.text.replace(msg, rpl) msg = event.text.replace(msg, rpl)
await event.edit(msg) await event.edit(msg)
client.start() client.start()
client.run_until_disconnected() client.run_until_disconnected()