def run(args): from tyggbot.tbutil import load_config config = load_config(args.config) if 'main' not in config: log.error('Missing section [main] in config') sys.exit(1) if 'sql' in config: log.error( 'The [sql] section in config is no longer used. See config.example.ini for the new format under [main].' ) sys.exit(1) if 'db' not in config['main']: log.error('Missing required db config in the [main] section.') sys.exit(1) 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
def setUp(self): from tyggbot.tyggbot import TyggBot from tyggbot.models.user import User, UserManager from tyggbot.tbutil import load_config import datetime config = load_config('config.ini') args = TyggBot.parse_args() self.tyggbot = TyggBot(config, args) self.source = self.tyggbot.users['testuser123Kappa'] self.source.username_raw = 'PajladA' self.source.points = 142 self.source.last_seen = datetime.datetime.strptime( '17:01:42', '%H:%M:%S')