+ Change raise cannot login for transfer credit

This commit is contained in:
Wong Yiek Heng 2025-10-04 11:29:27 +08:00
parent 0408a7cbcf
commit 57906ed2c6
2 changed files with 6 additions and 3 deletions

View File

@ -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.')

View File

@ -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)