|
@ -41,10 +41,14 @@ if __name__ == '__main__': |
|
|
|
|
|
|
|
|
# myinfo = api.get_my_info() |
|
|
# myinfo = api.get_my_info() |
|
|
|
|
|
|
|
|
|
|
|
#room_history = api.get_private_room_history(room_id) |
|
|
|
|
|
|
|
|
|
|
|
#print(room_history['messages'][0]['msg']) |
|
|
|
|
|
|
|
|
# print(myinfo) |
|
|
# print(myinfo) |
|
|
# rooms = api.get_private_rooms() |
|
|
|
|
|
|
|
|
rooms = api.get_private_rooms() |
|
|
|
|
|
|
|
|
# print(rooms) |
|
|
|
|
|
|
|
|
print('blubidab oioioi', rooms) |
|
|
|
|
|
|
|
|
# api.send_message('Ole', room_id) |
|
|
# api.send_message('Ole', room_id) |
|
|
|
|
|
|
|
@ -138,6 +142,11 @@ if __name__ == '__main__': |
|
|
room_tags = room[3] |
|
|
room_tags = room[3] |
|
|
#subprocess.run(["python", spider_directory + 'main.py', fdbs]) |
|
|
#subprocess.run(["python", spider_directory + 'main.py', fdbs]) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
date = datetime.datetime.now() - timedelta(days=3) |
|
|
|
|
|
|
|
|
|
|
|
room_history = api.get_room_history(room[0], oldest=date, latest=datetime.datetime.now()) |
|
|
|
|
|
|
|
|
for room_fdb in eval(room_fdbs): |
|
|
for room_fdb in eval(room_fdbs): |
|
|
#print('room_fdb',room_fdb, 'fdb_list',fdb_list) |
|
|
#print('room_fdb',room_fdb, 'fdb_list',fdb_list) |
|
|
try: |
|
|
try: |
|
@ -174,11 +183,15 @@ if __name__ == '__main__': |
|
|
except: |
|
|
except: |
|
|
url = data[room_fdb][i][key]["link"] |
|
|
url = data[room_fdb][i][key]["link"] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
message_was_already_there = False |
|
|
|
|
|
for message in room_history['messages']: |
|
|
|
|
|
if name_data_lower.join(' ') in message['msg']: |
|
|
|
|
|
message_was_already_there = True |
|
|
|
|
|
|
|
|
entry_message = '<' + url + '|' + data[room_fdb][i][key]["name"]+ '>' + '\n' + data[room_fdb][i][key]["info"] |
|
|
|
|
|
|
|
|
if message_was_already_there == False: |
|
|
|
|
|
entry_message = '<' + url + '|' + data[room_fdb][i][key]["name"]+ '>' + '\n' + data[room_fdb][i][key]["info"] |
|
|
|
|
|
|
|
|
api.send_message(entry_message, room[0]) |
|
|
|
|
|
|
|
|
api.send_message(entry_message, room[0]) |
|
|
|
|
|
|
|
|
except Exception as e: |
|
|
except Exception as e: |
|
|
print("probably i was not there in last page, original error is:", e) |
|
|
print("probably i was not there in last page, original error is:", e) |
|
@ -404,6 +417,17 @@ if __name__ == '__main__': |
|
|
room_tags = room[3] |
|
|
room_tags = room[3] |
|
|
#subprocess.run(["python", spider_directory + 'main.py', fdbs]) |
|
|
#subprocess.run(["python", spider_directory + 'main.py', fdbs]) |
|
|
|
|
|
|
|
|
|
|
|
#myinfo = api.get_room_info(room[0]) |
|
|
|
|
|
#print(myinfo) |
|
|
|
|
|
roomid = "'657cbeccebb39dd248d38ec3'" |
|
|
|
|
|
|
|
|
|
|
|
roomoioioi = api.get_user_info(bot_user_id) |
|
|
|
|
|
|
|
|
|
|
|
print(roomoioioi) |
|
|
|
|
|
|
|
|
|
|
|
room_history_updateroom = api.get_private_room_history(room[0]) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for room_fdb in eval(room_fdbs): |
|
|
for room_fdb in eval(room_fdbs): |
|
|
#print('room_fdb',room_fdb, 'fdb_list',fdb_list) |
|
|
#print('room_fdb',room_fdb, 'fdb_list',fdb_list) |
|
|
try: |
|
|
try: |
|
@ -440,11 +464,19 @@ if __name__ == '__main__': |
|
|
except: |
|
|
except: |
|
|
url = data[room_fdb][i][key]["link"] |
|
|
url = data[room_fdb][i][key]["link"] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print('101110001101010010010101000111') |
|
|
|
|
|
|
|
|
|
|
|
message_was_already_there = False |
|
|
|
|
|
for message in room_history['messages']: |
|
|
|
|
|
if name_data_lower.join(' ') in message['msg']: |
|
|
|
|
|
message_was_already_there = True |
|
|
|
|
|
|
|
|
|
|
|
if message_was_already_there == False: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
entry_message = '<' + url + '|' + data[room_fdb][i][key]["name"]+ '>' + '\n' + data[room_fdb][i][key]["info"] |
|
|
|
|
|
|
|
|
entry_message = '<' + url + '|' + data[room_fdb][i][key]["name"]+ '>' + '\n' + data[room_fdb][i][key]["info"] |
|
|
|
|
|
|
|
|
api.send_message(entry_message, room[0]) |
|
|
|
|
|
|
|
|
api.send_message(entry_message, room[0]) |
|
|
|
|
|
|
|
|
except Exception as e: |
|
|
except Exception as e: |
|
|
print("probably i was not there in last page, original error is:", e) |
|
|
print("probably i was not there in last page, original error is:", e) |
|
@ -504,7 +536,7 @@ if __name__ == '__main__': |
|
|
try: |
|
|
try: |
|
|
new_room = api.create_public_room(room_name, |
|
|
new_room = api.create_public_room(room_name, |
|
|
members=[latest_message_user_username], |
|
|
members=[latest_message_user_username], |
|
|
read_only=True) |
|
|
|
|
|
|
|
|
read_only=False) |
|
|
new_room_id = new_room['channel']['_id'] |
|
|
new_room_id = new_room['channel']['_id'] |
|
|
room_file = open('rooms/' + new_room_id + '.txt', 'w') |
|
|
room_file = open('rooms/' + new_room_id + '.txt', 'w') |
|
|
room_file.write( room_name + '§%§%' + databases + '§%§%' + filters) |
|
|
room_file.write( room_name + '§%§%' + databases + '§%§%' + filters) |
|
|