some more error handling for the interface commands
This commit is contained in:
parent
acc00d1ccd
commit
892e8057c9
1 changed files with 17 additions and 10 deletions
|
@ -286,10 +286,15 @@ if __name__ == '__main__':
|
|||
answer = "The room_id to update the tags was not found"
|
||||
|
||||
if user_input_list[0] == 'printtags':
|
||||
if len(user_input_list[1]) >= 1:
|
||||
try:
|
||||
room_id_to_print_tags = user_input_list[1]
|
||||
except:
|
||||
answer = "after the command printtags, the second argument has to be the room id.. use printrooms and look up the id of the room you want to print the tags"
|
||||
room_id_to_print_tags = 'NONE'
|
||||
if room_id_to_print_tags not 'NONE':
|
||||
try:
|
||||
|
||||
room_file = open('rooms/' + user_input_list[1] + '.txt', 'r')
|
||||
room_file = open('rooms/' + room_id_to_print_tags + '.txt', 'r')
|
||||
room_info_raw = room_file.read()
|
||||
room_file.close()
|
||||
room_info = room_info_raw.split('§%§%')
|
||||
|
@ -303,7 +308,6 @@ if __name__ == '__main__':
|
|||
answer = "The room_id to get the tags was not found"
|
||||
|
||||
|
||||
|
||||
if user_input_list[0] == 'printcommands':
|
||||
answer = """
|
||||
|
||||
|
@ -344,9 +348,10 @@ if __name__ == '__main__':
|
|||
answer = str(room_list)
|
||||
|
||||
if user_input_list[0] == 'updaterooms':
|
||||
if len(user_input_list[1]) >= 1:
|
||||
room_to_update = user_input_list[1]
|
||||
else:
|
||||
try:
|
||||
if len(user_input_list[1]) >= 1:
|
||||
room_to_update = user_input_list[1]
|
||||
except Exception as e:
|
||||
room_to_update = 'NONE'
|
||||
room_list = []
|
||||
rooms = os.listdir('rooms')
|
||||
|
@ -427,10 +432,12 @@ if __name__ == '__main__':
|
|||
|
||||
except Exception as e:
|
||||
print("probably i was not there in last page, original error is:", e)
|
||||
if room_was_found == False:
|
||||
answer = 'Den angegebenen Raum gibt es nicht.. Versuche es noch einmal mit -> updaterooms <room-id>'
|
||||
if room_was_found == True:
|
||||
answer = "Ich update die Rooms auf Basis der Daten in fdb-spider/spiders/output.."
|
||||
if room_to_update == 'NONE':
|
||||
answer = 'No room was specified, all rooms will get an update based on the data available'
|
||||
if room_was_found == False and room_to_update != 'NONE':
|
||||
answer = 'The room you specified does not exist, or there are no rooms configured, try the command without argument -> updaterooms'
|
||||
if room_was_found == True and room_to_update != 'NONE':
|
||||
answer = "I am updating the specified room based on the data in fdb-spider/spiders/output.."
|
||||
|
||||
|
||||
if user_input_list[0] == 'printfdbs':
|
||||
|
|
Loading…
Reference in a new issue