ubot2/start_rtmbot.py
Jeff Ammons 84db35fa6f Improve debug state handling and error messaging
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
2016-04-24 12:40:37 -07:00

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)