diff --git a/cm_bot_hal.py b/cm_bot_hal.py index 41a3033..bad1f6a 100644 --- a/cm_bot_hal.py +++ b/cm_bot_hal.py @@ -166,7 +166,8 @@ class CM_BOT_HAL: username = f_username, password = f_password ) == False: - raise Exception(f'[Cannot login] {f_username} cannot login.') + print(f'[Cannot login] {f_username} cannot login.') + return 0 return float(cm_bot.get_user_credit()) def transfer_credit_api(self, f_username: str, f_password: str, t_username: str, t_password: str): @@ -175,7 +176,8 @@ class CM_BOT_HAL: username = f_username, password = f_password ) == False: - raise Exception(f'[Cannot login] {f_username} cannot login.') + print(f'[Cannot login] {f_username} cannot login.') + return False amount = cm_bot.get_user_credit() - 0.01 if amount <= 0.01: print(f'[No enough credit] {f_username} do not have enough credit.') diff --git a/cm_transfer_credit.py b/cm_transfer_credit.py index 03b2fde..553dcd1 100644 --- a/cm_transfer_credit.py +++ b/cm_transfer_credit.py @@ -19,7 +19,8 @@ max_threading = 1 def transfer(data: dict, local_logger): bot = CM_BOT_HAL() local_logger.info(f"[Start] Transfer Credit from {data['f_username']} to {data['t_username']}") - bot.transfer_credit_api(data['f_username'], data['f_password'], data['t_username'], data['t_password']) + if bot.transfer_credit_api(data['f_username'], data['f_password'], data['t_username'], data['t_password']) == False: + local_logger.error(f"Cannot transfer for {data['f_username']}") local_logger.info(f"[Done] {data['f_username']} transfer done!") del bot time.sleep(0.5)