2013-12-28 09:58:20 -08:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
import logging
|
|
|
|
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 20:19:06 -07:00
|
|
|
botconfig = PyIRCBot.load(options.config)
|
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:
|
2015-06-16 23:36:23 -07:00
|
|
|
bot.loop()
|
2013-12-28 09:58:20 -08:00
|
|
|
except KeyboardInterrupt:
|
|
|
|
bot.kill()
|
|
|
|
|