Fix crash w/ slot codes with more than one hyphen

Split room code only once so that if (wrong) slot codes with
more than one hyphen are entered, it won't crash the bot.

Change-Id: Iaa75da497f026e0d0e601c54d9ddcd52f0028367
This commit is contained in:
Thierry Carrez 2018-02-26 12:26:38 +01:00
parent b6ea7e45a2
commit 8108273be4
1 changed files with 2 additions and 2 deletions

View File

@ -147,7 +147,7 @@ class PTGBot(irc.bot.SingleServerIRCBot):
elif adverb == 'location':
self.data.add_location(track, params)
elif adverb == 'book':
room, timeslot = params.split('-')
room, timeslot = params.split('-', 1)
if self.data.is_slot_valid_and_empty(room, timeslot):
self.data.book(track, room, timeslot)
else:
@ -168,7 +168,7 @@ class PTGBot(irc.bot.SingleServerIRCBot):
self.data.reload()
elif command == 'unbook':
params = str.join(' ', words[1:])
room, timeslot = params.split('-')
room, timeslot = params.split('-', 1)
self.data.unbook(room, timeslot)
elif command == 'newday':
self.data.new_day_cleanup()