Log first, then run interactive commands
This commit is contained in:
parent
116a6d7deb
commit
5c5ecd7f48
29
log.py
29
log.py
@ -5,21 +5,6 @@ from config import *
|
||||
client = TelegramClient('telelog', api_id, api_hash)
|
||||
|
||||
@client.on(events.NewMessage)
|
||||
|
||||
async def edit(event):
|
||||
msg = event.raw_text
|
||||
if event.sender_id != myid:
|
||||
return
|
||||
|
||||
if msg.startswith('.tl.alive'):
|
||||
rpl = "Telelog alive and well!"
|
||||
await event.edit(rpl)
|
||||
|
||||
if msg.startswith('.tl.log'):
|
||||
chat = str(msg.split()[1])
|
||||
f = open(chat)
|
||||
await event.edit(f.read())
|
||||
|
||||
async def log(event):
|
||||
if event.is_private:
|
||||
if event.sender_id != myid:
|
||||
@ -42,5 +27,19 @@ async def log(event):
|
||||
f.write(event.raw_text + "\n")
|
||||
f.close()
|
||||
|
||||
# Interactive commands
|
||||
msg = event.raw_text
|
||||
if event.sender_id != myid:
|
||||
return
|
||||
|
||||
if msg.startswith('.tl.alive'):
|
||||
rpl = "Telelog alive and well!"
|
||||
await event.edit(rpl)
|
||||
|
||||
if msg.startswith('.tl.log'):
|
||||
chat = str(msg.split()[1])
|
||||
f = open(chat)
|
||||
await event.edit(f.read())
|
||||
|
||||
client.start()
|
||||
client.run_until_disconnected()
|
||||
|
Loading…
x
Reference in New Issue
Block a user