finished name feature for addtags

This commit is contained in:
alpcentaur 2024-02-06 15:54:02 +01:00
parent d61f595c9f
commit 81851a2963
2 changed files with 4 additions and 5 deletions

View file

@ -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)

View file

@ -1 +1 @@
printrooms§%§%oFHwGiDZ3DNW7gFpg
printrooms§%§%woo7acFTE5ZikxmaG