Conditions | 3 |
Total Lines | 22 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | #!/usr/bin/env python |
||
7 | def run_bot(): |
||
8 | from handler import Bot |
||
9 | |||
10 | while True: |
||
11 | try: |
||
12 | # initialize and run |
||
13 | botko = Bot() |
||
14 | botko.run() |
||
15 | |||
16 | except Exception: |
||
17 | # log the error |
||
18 | from traceback import format_exc |
||
19 | from datetime import datetime |
||
20 | from time import sleep |
||
21 | |||
22 | print("ERR " + str(format_exc())) |
||
23 | |||
24 | f = open('error_log', 'a') |
||
25 | f.write(str(datetime.now()) + "\n") |
||
26 | f.write(str(format_exc() + "\n\n")) |
||
27 | f.close() |
||
28 | sleep(10) |
||
29 | |||
58 |