
If debug=True: - Most plugin methods (if not all) should end the script and report the error to std.out If debug=False: - Plugin methods will log the error, data, and stack trace Future planning: - The debug=False case here has better behavior in my opinion, maybe there's a better way of handling debug=True
26 lines
513 B
Python
Executable file
26 lines
513 B
Python
Executable file
#!/usr/bin/env python
|
|
import sys
|
|
from argparse import ArgumentParser
|
|
|
|
import yaml
|
|
from rtmbot import RtmBot
|
|
|
|
|
|
def parse_args():
|
|
parser = ArgumentParser()
|
|
parser.add_argument(
|
|
'-c',
|
|
'--config',
|
|
help='Full path to config file.',
|
|
metavar='path'
|
|
)
|
|
return parser.parse_args()
|
|
|
|
# load args with config path
|
|
args = parse_args()
|
|
config = yaml.load(open(args.config or 'rtmbot.conf', 'r'))
|
|
bot = RtmBot(config)
|
|
try:
|
|
bot.start()
|
|
except KeyboardInterrupt:
|
|
sys.exit(0)
|