diff --git a/README.rst b/README.rst index 21bd4f3..b92b679 100644 --- a/README.rst +++ b/README.rst @@ -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) diff --git a/ptgbot/bot.py b/ptgbot/bot.py index b085e36..8080c7a 100644 --- a/ptgbot/bot.py +++ b/ptgbot/bot.py @@ -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") diff --git a/ptgbot/db.py b/ptgbot/db.py index b7d7a2d..1541175 100644 --- a/ptgbot/db.py +++ b/ptgbot/db.py @@ -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()