From 6b408c46de9524d43f5eef7405e505e483f03365 Mon Sep 17 00:00:00 2001 From: Thierry Carrez Date: Tue, 13 Feb 2018 15:19:59 +0100 Subject: [PATCH] Replace ~wipe by more selective ~reload Wiping the database was no longer very useful. Replace this with a ~reload action that reload base data from configuration. Change-Id: Iaa55a2060053f77dd2ab1072e59b21a28812f213 --- README.rst | 4 ++-- ptgbot/bot.py | 4 ++-- ptgbot/db.py | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.rst b/README.rst index 43daa64..9afb215 100644 --- a/README.rst +++ b/README.rst @@ -127,8 +127,8 @@ You have to be a channel operator (+o) to use admin commands. ~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) +~reload + Resets the database entirely (reloads from configuration) Local testing diff --git a/ptgbot/bot.py b/ptgbot/bot.py index ed13bdf..29bc809 100644 --- a/ptgbot/bot.py +++ b/ptgbot/bot.py @@ -163,8 +163,8 @@ class PTGBot(irc.bot.SingleServerIRCBot): return words = msg.split() command = words[0][1:].lower() - if command == 'wipe': - self.data.wipe() + if command == 'reload': + self.data.reload() elif command == 'newday': self.data.new_day_cleanup() elif command == 'list': diff --git a/ptgbot/db.py b/ptgbot/db.py index 8dc01d1..ec1f360 100644 --- a/ptgbot/db.py +++ b/ptgbot/db.py @@ -167,8 +167,9 @@ class PTGDataBase(): self.data['location'] = {} self.save() - def wipe(self): + def reload(self): self.data = copy.deepcopy(self.BASE) + self.load_data_from_config() self.save() def save(self):