aboutsummaryrefslogtreecommitdiff
path: root/modules/database_backup.py
diff options
context:
space:
mode:
authorGravatar jesopo2018-09-26 18:27:17 +0100
committerGravatar jesopo2018-09-26 18:27:17 +0100
commit51a52e2b0e54031cce5876f54d1d48c268b5441c (patch)
treea4c0e8e86c55aa701b06297d5b5a2ceebeaab60d /modules/database_backup.py
parentAlso use docstrings to check if a command has help available, allow one-string (diff)
signature
Switch to using @Utils.hook and docstrings for event hooks
Diffstat (limited to 'modules/database_backup.py')
-rw-r--r--modules/database_backup.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/modules/database_backup.py b/modules/database_backup.py
index 27a366a3..45bc730f 100644
--- a/modules/database_backup.py
+++ b/modules/database_backup.py
@@ -1,4 +1,5 @@
import datetime, glob, os, shutil, time
+from src import Utils
BACKUP_INTERVAL = 60*60 # 1 hour
BACKUP_COUNT = 5
@@ -10,10 +11,10 @@ class Module(object):
until_next_hour = 60-now.second
until_next_hour += ((60-(now.minute+1))*60)
- events.on("timer.database-backup").hook(self.backup)
bot.add_timer("database-backup", BACKUP_INTERVAL, persist=False,
next_due=time.time()+until_next_hour)
+ @Utils.hook("timer.database-backup")
def backup(self, event):
full_location = self.bot.database.full_location
files = glob.glob("%s.*" % full_location)