Fixed bug when station containing "to" was treated as separator

This commit is contained in:
JuliusFreudenberger 2019-10-16 12:35:00 +02:00
parent 78c337a8eb
commit 274c5b1b48

4
bot.py
View file

@ -25,10 +25,10 @@ class Query:
self.departure_count = int(args[-1]) self.departure_count = int(args[-1])
last_index_string -= 1 last_index_string -= 1
request_tmp = ' '.join(args[0:last_index_string]).strip() request_tmp = ' '.join(args[0:last_index_string]).strip()
separator_index = request_tmp.find("to") separator_index = request_tmp.find(" to ")
if separator_index != -1: if separator_index != -1:
self.input = request_tmp[:separator_index - 1].strip() self.input = request_tmp[:separator_index - 1].strip()
self.destination = request_tmp[separator_index + 2:].strip() self.destination = request_tmp[separator_index + 4:].strip()
else: else:
self.input = request_tmp self.input = request_tmp
if args[0].isdigit(): if args[0].isdigit():