Browse Source

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
changes/94/547994/3
Thierry Carrez 3 years ago
parent
commit
8108273be4
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      ptgbot/bot.py

+ 2
- 2
ptgbot/bot.py 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()


Loading…
Cancel
Save