Reject some commands if a track is not scheduled

If a given track is not scheduled for the day, reject the
now / next / location commands.

Change-Id: I0b57c557534f0bc26eed3d7bdbefabe66e1607a0
This commit is contained in:
Thierry Carrez 2017-12-22 16:31:41 +01:00
parent 96d1a8421b
commit d73d65a2c1
1 changed files with 5 additions and 0 deletions

View File

@ -130,6 +130,11 @@ class PTGBot(irc.bot.SingleServerIRCBot):
adverb = words[1].lower()
params = str.join(' ', words[2:])
if adverb in ['now', 'next', 'location']:
if not self.data.get_track_room(track):
self.send(chan, "%s: track '%s' is not scheduled today" %
(nick, track))
return
if adverb == 'now':
self.data.add_now(track, params)
elif adverb == 'next':