Browse Source

Add 'unbook' admin command

Allows admins to clean up a booked slot.

Change-Id: I3984530b38a725b537f1457ed3e64224845a170e
changes/81/543981/1
Thierry Carrez 3 years ago
parent
commit
492c8bd8b7
3 changed files with 13 additions and 0 deletions
  1. +3
    -0
      README.rst
  2. +4
    -0
      ptgbot/bot.py
  3. +6
    -0
      ptgbot/db.py

+ 3
- 0
README.rst 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


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


+ 6
- 0
ptgbot/db.py 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'] = {}


Loading…
Cancel
Save