def run(args): from tbutil import load_config config = load_config(args.config) if 'main' not in config: log.error('Missing section [main] in config') sys.exit(0) if 'sql' not in config: log.error('Missing section [sql] in config') sys.exit(0) tyggbot = TyggBot(config, args) tyggbot.connect() def on_sigterm(signal, frame): tyggbot.quit() sys.exit(0) signal.signal(signal.SIGTERM, on_sigterm) try: tyggbot.start() except KeyboardInterrupt: tyggbot.quit() pass
cursor.close() return True if __name__ == "__main__": import sys sys.path.append('../') from tbutil import load_config, init_logging init_logging('tyggbot') from apiwrappers import APIBase import argparse parser = argparse.ArgumentParser() parser.add_argument('--config', '-c', required=True, help='Specify which config file to use ' '(default: config.ini)') args = parser.parse_args() config = load_config(args.config) sqlconn = pymysql.connect(unix_socket=config['sql']['unix_socket'], user=config['sql']['user'], passwd=config['sql']['passwd'], db=config['sql']['db'], charset='utf8') cursor = sqlconn.cursor() refresh_emotes(cursor) sqlconn.commit() cursor.close() sqlconn.close()
if __name__ == "__main__": import sys sys.path.append('../') from tbutil import load_config, init_logging init_logging('pajbot') from apiwrappers import APIBase import argparse parser = argparse.ArgumentParser() parser.add_argument('--config', '-c', required=True, help='Specify which config file to use ' '(default: config.ini)') args = parser.parse_args() config = load_config(args.config) sqlconn = pymysql.connect(unix_socket=config['sql']['unix_socket'], user=config['sql']['user'], passwd=config['sql']['passwd'], db=config['sql']['db'], charset='utf8') cursor = sqlconn.cursor() refresh_emotes(cursor) sqlconn.commit() cursor.close() sqlconn.close()