Browse Source

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
changes/47/529847/1
Thierry Carrez 3 years ago
parent
commit
d73d65a2c1
1 changed files with 5 additions and 0 deletions
  1. +5
    -0
      ptgbot/bot.py

+ 5
- 0
ptgbot/bot.py 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':


Loading…
Cancel
Save