Guest User

Забрать все карты с рынка

a guest
Aug 31st, 2023
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     import {Client} from "./src";  
  2.  
  3.     const client = new Client(
  4.         'CrazyNigerAPIClient-0.1.0',
  5.         'the-tale.org',
  6.         'https',
  7.         null
  8.     );
  9.     client.login(email, password)
  10.         .then(() => client.shopGetInfo())
  11.         .then(shopInfo => {
  12.             shopInfo.data.info.forEach(async (lotInfo) => {
  13.                 if (lotInfo.owner_sell_number > 0) {
  14.                     try {
  15.                         const lotDetail = await client.shopGetLotDetails(lotInfo.full_type);
  16.  
  17.                         Object.keys(lotDetail.data.owner_prices).forEach((lotPrice: string) => {
  18.                             const priceCount = lotDetail.data.owner_prices[lotPrice];
  19.  
  20.                             for (let i = 0; i < priceCount; i++) {
  21.                                 setTimeout(() => {
  22.                                     client.shopCancelSellCard(lotInfo.full_type, Number.parseInt(lotPrice, 10))
  23.                                         .catch(err => {
  24.                                             console.log(`Error on cancel lot  ${lotInfo.full_type} for ${lotPrice}`, err);
  25.                                             process.exit();
  26.                                         })
  27.                                 }, cancelRequestNumber * 50);
  28.                                 cancelRequestNumber++;
  29.  
  30.                             }
  31.                         })
  32.                     } catch (err) {
  33.                         console.log("Error on get lot detail", lotInfo, err);
  34.                         process.exit();
  35.                     }
  36.                 }
  37.             });
  38.         })
  39.         .catch(error => console.error(error));
Advertisement
Add Comment
Please, Sign In to add comment