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