From 81851a2963c9647235945aa6e609d54151cb9af2 Mon Sep 17 00:00:00 2001 From: alpcentaur Date: Tue, 6 Feb 2024 15:54:02 +0100 Subject: [PATCH] finished name feature for addtags --- fdb_spider_interface.py | 7 +++---- new_message_file.txt | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/fdb_spider_interface.py b/fdb_spider_interface.py index 4621a61..3eef169 100644 --- a/fdb_spider_interface.py +++ b/fdb_spider_interface.py @@ -368,6 +368,7 @@ if __name__ == '__main__': try: room_name_add_tags = user_input_list[1] room_id_add_tags = name2id(room_name_add_tags) + print(room_id_add_tags) except: room_id_add_tags = 'NONE' try: @@ -380,18 +381,16 @@ if __name__ == '__main__': thirdarg = 'NONE' if room_id_add_tags != 'NONE' and len(new_tags) >= 1 and thirdarg == 'NONE': try: - room_file_add_tags = open('rooms/' + room_id_add_tags + '.txt', 'r') room_info_raw = room_file_add_tags.read() room_file_add_tags.close() room_info = room_info_raw.split('§%§%') - tag_list = eval(room_info[-1]) + tag_list = eval(room_info[-2]) for tag in eval(user_input_list[2]): if tag not in tag_list: tag_list.append(tag) - room_file_add_tags = open('rooms/' + room_id_add_tags + '.txt', 'w') - room_file_add_tags.write( str(room_info[0]) + '§%§%' + str(room_info[1]) + '§%§%' + str(tag_list)) + room_file_add_tags.write( str(room_info[0]) + '§%§%' + str(room_info[1]) + '§%§%' + str(tag_list) + '§%§%' + str(room_info[-1])) room_file_add_tags.close() answer = 'the updated tag list is' + str(tag_list) diff --git a/new_message_file.txt b/new_message_file.txt index 1faa600..3b4d005 100644 --- a/new_message_file.txt +++ b/new_message_file.txt @@ -1 +1 @@ -printrooms§%§%oFHwGiDZ3DNW7gFpg \ No newline at end of file +printrooms§%§%woo7acFTE5ZikxmaG \ No newline at end of file