From 8108273be4a607bbd79405ef44ba3a1bd1485bfb Mon Sep 17 00:00:00 2001 From: Thierry Carrez Date: Mon, 26 Feb 2018 12:26:38 +0100 Subject: [PATCH] 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 --- ptgbot/bot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ptgbot/bot.py b/ptgbot/bot.py index 24f6921..3af836f 100644 --- a/ptgbot/bot.py +++ b/ptgbot/bot.py @@ -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()