Conditions | 3 |
Total Lines | 16 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | """Cog for tasks that are scheduled to run""" |
||
27 | @tasks.loop(hours=24.0) |
||
28 | async def report_errors(self): |
||
29 | """report_errors |
||
30 | --- |
||
31 | Every 24 hours, all errors for the current day are send to the admin channels. |
||
32 | """ |
||
33 | date = datetime.utcnow().strftime("%Y-%m-%d") |
||
34 | error_record = await utils.select("errors", "message, error", |
||
35 | "date_trunc('day', time)", date) |
||
36 | if not error_record: |
||
37 | errors = "No errors found for {}".format(date) |
||
38 | else: |
||
39 | errors = "Errors for {}.\n".format(date) |
||
40 | for error in error_record: |
||
41 | errors += "- {}; {}\n".format(*error) |
||
42 | await utils.admin_log(self.bot, errors, True) |
||
43 | |||
48 |