Allow unscheduled tracks to use now/next

PTGbot used to reject now/next (and location) commands for
tracks that do not have a room scheduled on the same day.

However, it is sometimes useful for teams to indicate such
a message (double-booked rooms, team photo time, etc), so
PTGbot will now issue a warning rather than reject command.

Change-Id: Ib04fbf860b22a3b2e99b106f4f83ae702dd215d8
This commit is contained in:
Thierry Carrez 2018-11-26 15:01:44 +01:00
parent af5bab2f3e
commit 6f9be1606a
1 changed files with 5 additions and 5 deletions

View File

@ -124,11 +124,6 @@ class PTGBot(SASL, SSL, 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':
@ -164,6 +159,11 @@ class PTGBot(SASL, SSL, irc.bot.SingleServerIRCBot):
"Did you mean: %s now %s... ?" %
(nick, adverb, track, adverb))
return
if adverb in ['now', 'next']:
if not self.data.get_track_room(track):
self.send(chan, "%s: message added, but please note that "
"track '%s' does not appear to have a room "
"scheduled today." % (nick, track))
if msg.startswith('~'):
if not self.channels[chan].is_oper(nick):