Add 'unbook' admin command
Allows admins to clean up a booked slot. Change-Id: I3984530b38a725b537f1457ed3e64224845a170e
This commit is contained in:
parent
6b408c46de
commit
492c8bd8b7
|
@ -124,6 +124,9 @@ You have to be a channel operator (+o) to use admin commands.
|
||||||
~clean TRACK [TRACK..]
|
~clean TRACK [TRACK..]
|
||||||
Removes active entries for specified track(s)
|
Removes active entries for specified track(s)
|
||||||
|
|
||||||
|
~unbook SLOTCODE
|
||||||
|
Removes any booking at the slot named SLOTCODE
|
||||||
|
|
||||||
~newday
|
~newday
|
||||||
Removes now/next/location entries, to be run at the start of a new day
|
Removes now/next/location entries, to be run at the start of a new day
|
||||||
|
|
||||||
|
|
|
@ -165,6 +165,10 @@ class PTGBot(irc.bot.SingleServerIRCBot):
|
||||||
command = words[0][1:].lower()
|
command = words[0][1:].lower()
|
||||||
if command == 'reload':
|
if command == 'reload':
|
||||||
self.data.reload()
|
self.data.reload()
|
||||||
|
elif command == 'unbook':
|
||||||
|
params = str.join(' ', words[1:])
|
||||||
|
room, timeslot = params.split('-')
|
||||||
|
self.data.unbook(room, timeslot)
|
||||||
elif command == 'newday':
|
elif command == 'newday':
|
||||||
self.data.new_day_cleanup()
|
self.data.new_day_cleanup()
|
||||||
elif command == 'list':
|
elif command == 'list':
|
||||||
|
|
|
@ -161,6 +161,12 @@ class PTGDataBase():
|
||||||
self.data['additional'][room][timeslot] = track
|
self.data['additional'][room][timeslot] = track
|
||||||
self.save()
|
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):
|
def new_day_cleanup(self):
|
||||||
self.data['now'] = {}
|
self.data['now'] = {}
|
||||||
self.data['next'] = {}
|
self.data['next'] = {}
|
||||||
|
|
Loading…
Reference in New Issue