pyircbot/bin/pyircbot

37 lines
822 B
Plaintext
Raw Normal View History

2013-12-28 09:58:20 -08:00
#!/usr/bin/env python3
import os
import sys
import logging
import yaml
from optparse import OptionParser
2015-06-18 19:29:46 -07:00
from pyircbot import PyIRCBot
2013-12-28 09:58:20 -08:00
if __name__ == "__main__":
" logging level and facility "
logging.basicConfig(level=logging.DEBUG, format="%(asctime)-15s %(levelname)-8s %(message)s")
log = logging.getLogger('main')
" parse command line args "
parser = OptionParser()
2015-06-18 19:57:45 -07:00
parser.add_option("-c", "--config", action="store", type="string", dest="config", help="Path to config file")
2013-12-28 09:58:20 -08:00
(options, args) = parser.parse_args()
log.debug(options)
if not options.config:
2015-06-18 19:57:45 -07:00
log.critical("No bot config file specified (-c). Exiting.")
2013-12-28 09:58:20 -08:00
sys.exit(0)
2015-06-18 19:57:45 -07:00
botconfig = yaml.load(open(options.config, 'r'))
2013-12-28 09:58:20 -08:00
log.debug(botconfig)
2015-06-18 19:57:45 -07:00
bot = PyIRCBot(botconfig)
2013-12-28 09:58:20 -08:00
try:
bot.loop()
2013-12-28 09:58:20 -08:00
except KeyboardInterrupt:
bot.kill()