-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathrun.py
executable file
·41 lines (31 loc) · 899 Bytes
/
run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env python3.5
"""Run CactusBot."""
import logging
from argparse import ArgumentParser
from asyncio import get_event_loop
from cactusbot.cactus import run
from config import SERVICE, api
if __name__ == "__main__":
parser = ArgumentParser(description="Run CactusBot.")
parser.add_argument(
"--debug",
help="set custom logger level",
metavar="LEVEL",
nargs='?',
const="DEBUG",
default="INFO"
)
args = parser.parse_args()
logging.basicConfig(
level=args.debug,
format="{asctime} {levelname} {name} {funcName}: {message}",
datefmt="%Y-%m-%d %H:%M:%S",
style='{'
)
loop = get_event_loop()
try:
# TODO: Convert this to be able to have multiple services
loop.run_until_complete(run(api, SERVICE))
loop.run_forever()
finally:
loop.close()