diff --git a/fdb_spider_interface.py b/fdb_spider_interface.py index d7c3c45..a4f7d39 100644 --- a/fdb_spider_interface.py +++ b/fdb_spider_interface.py @@ -41,10 +41,14 @@ if __name__ == '__main__': # myinfo = api.get_my_info() + #room_history = api.get_private_room_history(room_id) + + #print(room_history['messages'][0]['msg']) + # print(myinfo) - # rooms = api.get_private_rooms() + rooms = api.get_private_rooms() - # print(rooms) + print('blubidab oioioi', rooms) # api.send_message('Ole', room_id) @@ -138,6 +142,11 @@ if __name__ == '__main__': room_tags = room[3] #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): #print('room_fdb',room_fdb, 'fdb_list',fdb_list) try: @@ -174,11 +183,15 @@ if __name__ == '__main__': except: 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: print("probably i was not there in last page, original error is:", e) @@ -404,6 +417,17 @@ if __name__ == '__main__': room_tags = room[3] #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): #print('room_fdb',room_fdb, 'fdb_list',fdb_list) try: @@ -440,11 +464,19 @@ if __name__ == '__main__': except: 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: print("probably i was not there in last page, original error is:", e) @@ -504,7 +536,7 @@ if __name__ == '__main__': try: new_room = api.create_public_room(room_name, members=[latest_message_user_username], - read_only=True) + read_only=False) new_room_id = new_room['channel']['_id'] room_file = open('rooms/' + new_room_id + '.txt', 'w') room_file.write( room_name + '§%§%' + databases + '§%§%' + filters) diff --git a/new_message_file.txt b/new_message_file.txt index 0b8bc93..8794b5e 100644 --- a/new_message_file.txt +++ b/new_message_file.txt @@ -1 +1 @@ -deleteroom 65737f4aebb39dd248d0cff1§%§%FyCwhRtdqAnrmHvP9 \ No newline at end of file +createroom oioitestroom3 ['giz'] ['solar','regenerative','sustainable','energy']§%§%vMKkL8H6t6MScmj6t \ No newline at end of file