+ Sync with rex_cm_bot 7-jul-2025

This commit is contained in:
yiekheng 2025-07-07 13:49:34 +00:00
parent c6ef5d43e2
commit 512342075c
2 changed files with 6 additions and 6 deletions

View File

@ -143,7 +143,7 @@ class cmBot extends Bot {
await page.type("#username", t_username); await page.type("#username", t_username);
await page.click("#search"); await page.click("#search");
await page.waitForSelector("#amount", { visible: true, timeout: 5000 }); await page.waitForSelector("#amount", { visible: true, timeout: 5000 });
await page.type("#amount", amount); await page.type("#amount", amount.toString());
await page.type("#securityPin", t_password); await page.type("#securityPin", t_password);
await page.click("#button_transfer"); await page.click("#button_transfer");
await new Promise(resolve => setTimeout(resolve, 3000)); await new Promise(resolve => setTimeout(resolve, 3000));

View File

@ -51,7 +51,8 @@ class transferCommissionBot {
(await tds[0].evaluate((el) => el.textContent)) === "Credit Available" (await tds[0].evaluate((el) => el.textContent)) === "Credit Available"
) { ) {
const text = await tds[2].evaluate((el) => el.textContent); const text = await tds[2].evaluate((el) => el.textContent);
const match = text.match(/\d+(\.\d+)?/); const match = text.replace(/,/g, '').match(/\d+(\.\d+)?/);
return match ? match[0].replace(/,/g, '') : null;
return match ? match[0] : null; return match ? match[0] : null;
} }
} }
@ -72,7 +73,7 @@ class transferCommissionBot {
await this.cmBot.login(page, acc.f_username, acc.f_password); await this.cmBot.login(page, acc.f_username, acc.f_password);
await new Promise((resolve) => setTimeout(resolve, 1000)); await new Promise((resolve) => setTimeout(resolve, 1000));
logger.info(`User: ${acc.f_username}, logged in successfully`); logger.info(`User: ${acc.f_username}, logged in successfully`);
const commission = parseFloat(await this.getCommissionCredit(page)); const commission = parseFloat((await this.getCommissionCredit(page))).toFixed(2);
logger.info(`User: ${acc.f_username}, commission: ${commission}`); logger.info(`User: ${acc.f_username}, commission: ${commission}`);
if (commission <= 0.01) { if (commission <= 0.01) {
logger.warn( logger.warn(
@ -83,10 +84,9 @@ class transferCommissionBot {
page, page,
acc.t_username, acc.t_username,
acc.t_password, acc.t_password,
(commission - 0.01).toString() (commission - 0.01).toFixed(2)
); );
logger.info( logger.info(
`Successfully transferred ${commission} credit from ${acc.f_username} to ${acc.t_username}`
); );
} }
} catch (error) { } catch (error) {
@ -116,7 +116,7 @@ class transferCommissionBot {
async transferCommission() { async transferCommission() {
console.log("Transfer commission is running"); console.log("Transfer commission is running");
const response = await axios.get('https://api2.luckytown888.net/user'); const response = await axios.get('https://api.luckytown888.net/user');
const accs = response.data; const accs = response.data;
const progressBar = new Progress( const progressBar = new Progress(