Add 'unbook' admin command

Allows admins to clean up a booked slot.

Change-Id: I3984530b38a725b537f1457ed3e64224845a170e
This commit is contained in:
Thierry Carrez 2018-02-13 16:26:57 +01:00
parent 6b408c46de
commit 492c8bd8b7
3 changed files with 13 additions and 0 deletions

View File

@ -124,6 +124,9 @@ You have to be a channel operator (+o) to use admin commands.
~clean TRACK [TRACK..]
Removes active entries for specified track(s)
~unbook SLOTCODE
Removes any booking at the slot named SLOTCODE
~newday
Removes now/next/location entries, to be run at the start of a new day

View File

@ -165,6 +165,10 @@ class PTGBot(irc.bot.SingleServerIRCBot):
command = words[0][1:].lower()
if command == 'reload':
self.data.reload()
elif command == 'unbook':
params = str.join(' ', words[1:])
room, timeslot = params.split('-')
self.data.unbook(room, timeslot)
elif command == 'newday':
self.data.new_day_cleanup()
elif command == 'list':

View File

@ -161,6 +161,12 @@ class PTGDataBase():
self.data['additional'][room][timeslot] = track
self.save()
def unbook(self, room, timeslot):
if room in self.data['additional'].keys():
if timeslot in self.data['additional'][room].keys():
self.data['additional'][room][timeslot] = ""
self.save()
def new_day_cleanup(self):
self.data['now'] = {}
self.data['next'] = {}