nada formado (1)
This commit is contained in:
parent
4cbd59c188
commit
5c4c85743f
25
main.py
25
main.py
@ -27,26 +27,41 @@ with TelegramClient(sesion, api_id, api_hash, spawn_read_thread=False)).start()
|
||||
|
||||
#TODO: selector de conversaciones si el bot no esta inicializado
|
||||
chat1 = client.get_entity('t.me/lonami')
|
||||
createNewDump('lonami', chat1)
|
||||
|
||||
chat2 = client.get_entity('t.me/lol')
|
||||
createNewDump('lol', chat2)
|
||||
|
||||
chat3 = client.get_entity('t.me/telegram')
|
||||
createNewDump('telegram', chat3)
|
||||
|
||||
chats = (chat1, chat2, chat3)
|
||||
|
||||
|
||||
|
||||
|
||||
@client.on.message(events.NewMessage(chats=lonami, incoming = True))
|
||||
@client.on.message(events.NewMessage(chats=chats, incoming = True))
|
||||
|
||||
async def handler(events):
|
||||
await
|
||||
def handler(events):
|
||||
event.get
|
||||
|
||||
def createNewDump(name, entity):
|
||||
#TODO Test si ya existe un dump anterior
|
||||
#TODO Test si ya existe un dump anterior, si no, dumpear todo lo anterior
|
||||
fileName = name+"Dump.json"
|
||||
|
||||
with open(fileName,"w+") as f:
|
||||
meta = {'meta':[{
|
||||
'name': name,
|
||||
'entity': entity,
|
||||
'creationDate': strftime("%Y-%m-%d %H:%M:%S", gmtime())
|
||||
}]}
|
||||
json.dump(meta, f)
|
||||
|
||||
def addEntryToDump(name, element):
|
||||
#TODO Test si existe el dump anterior
|
||||
fileName = name+"Dump.json"
|
||||
with open(fileName,"w+") as f:
|
||||
message = {'mensaje':[{
|
||||
'element': element,
|
||||
'Date': strftime("%Y-%m-%d %H:%M:%S", gmtime())
|
||||
}]}
|
||||
json.dump(meta, f)
|
Loading…
Reference in New Issue
Block a user