Add command to clean up at start of day
The ~newday admin command cleans up now/next/location to get to a fresh start at the beginning of a new day / end of previous day. Change-Id: I0a274164939a37e4a3aa9f734d4aebdc4cd82bf3
This commit is contained in:
parent
9046cbe463
commit
96d1a8421b
|
@ -74,6 +74,9 @@ You have to be a channel operator (+o) to use admin commands.
|
|||
~clean TRACK [TRACK..]
|
||||
Removes active entries for specified track(s)
|
||||
|
||||
~newday
|
||||
Removes now/next/location entries, to be run at the start of a new day
|
||||
|
||||
~wipe
|
||||
Resets the database entirely (removes all defined tracks and topics)
|
||||
|
||||
|
|
|
@ -160,9 +160,10 @@ class PTGBot(irc.bot.SingleServerIRCBot):
|
|||
command = words[0][1:].lower()
|
||||
if command == 'wipe':
|
||||
self.data.wipe()
|
||||
elif command == 'newday':
|
||||
self.data.new_day_cleanup()
|
||||
elif command == 'list':
|
||||
self.send_track_list(chan)
|
||||
return
|
||||
elif command in ('clean', 'add', 'del'):
|
||||
if len(words) < 2:
|
||||
self.send(chan, "this command takes one or more arguments")
|
||||
|
|
|
@ -128,6 +128,12 @@ class PTGDataBase():
|
|||
self.data['additional'][room][timeslot] = track
|
||||
self.save()
|
||||
|
||||
def new_day_cleanup(self):
|
||||
self.data['now'] = {}
|
||||
self.data['next'] = {}
|
||||
self.data['location'] = {}
|
||||
self.save()
|
||||
|
||||
def wipe(self):
|
||||
self.data = self.BASE
|
||||
self.save()
|
||||
|
|
Loading…
Reference in New Issue