From 2e5039cef30af71f6841107a8609d9a788ae9134 Mon Sep 17 00:00:00 2001 From: alpcentaur Date: Tue, 6 Feb 2024 17:12:08 +0100 Subject: [PATCH] added check for double names when creating rooms, plus some updates to printcommands --- fdb_spider_interface.py | 17 ++++++++++++----- new_message_file.txt | 2 +- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/fdb_spider_interface.py b/fdb_spider_interface.py index 2293823..590ce18 100644 --- a/fdb_spider_interface.py +++ b/fdb_spider_interface.py @@ -443,8 +443,8 @@ if __name__ == '__main__': example : `createroom room-test-1 ['giz','fdb2'] ['tag1','tag2','tag3'] 7` ----------------------------------------------------------------------------------------- To delete a room use - command : `deleteroom ` - example : `deleteroom 6572012bebb39dd248d08320` + command : `deleteroom ` + example : `deleteroom test42` ----------------------------------------------------------------------------------------- To print the tags of a room use command : `printtags ` @@ -738,7 +738,7 @@ if __name__ == '__main__': print(e) os.remove("rooms/" + room_id_del + ".txt") - anwer = 'deleting the requested room..' + answer = 'deleting the requested room..' if len(user_input_list) > 2: answer = 'Die Syntax zum Löschen eines Raumes hat einen Fehler. Versuche es erneut, nach dem Muster -> deleteroom ' @@ -746,7 +746,14 @@ if __name__ == '__main__': if user_input_list[0] == 'createroom': try: - room_name = user_input_list[1] + room_name_from_input = user_input_list[1] + room_id = name2id(room_name_from_input) + if room_id == 'NONE': + room_name = user_input_list[1] + else: + if len(room_id) > 8: + room_name = 'NONE' + except Exception as e: room_name = 'NONE' print(e) @@ -771,7 +778,7 @@ if __name__ == '__main__': answer = 'Die Syntax hat einen Fehler. Wahrscheinlich sind Leerzeichen in den Listen. Leerzeichen definieren die Syntax. Versuche es erneut, nach dem Muster -> createroom room1 ["fdb1","fdb2"] ["tag1","tag2"]' if room_name == 'NONE' or databases == 'NONE' or filters == 'NONE' or days_to_deadline == 'NONE': - answer = 'Um einen Raum zu erstellen, in dem neueste Einträge geteilt werden, lautet die Syntax: createroom ' + answer = 'Um einen Raum zu erstellen, in dem neueste Einträge geteilt werden, lautet die Syntax: createroom \n Dabei darf der Name noch nicht vergeben sein. Im Zweifel einfach nochmal printrooms ausgeben lassen..' else: try: diff --git a/new_message_file.txt b/new_message_file.txt index 4b4a3e4..9edc23b 100644 --- a/new_message_file.txt +++ b/new_message_file.txt @@ -1 +1 @@ -printcommands§%§%ZqWKDLrEKM3vKgdSy \ No newline at end of file +printrooms§%§%eoj3hTktBCRcBbrt8 \ No newline at end of file