Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import {Client} from "./src";
- const client = new Client(
- 'CrazyNigerAPIClient-0.1.0',
- 'the-tale.org',
- 'https',
- null
- );
- client.login(email, password)
- .then(() => client.shopGetInfo())
- .then(shopInfo => {
- shopInfo.data.info.forEach(async (lotInfo) => {
- if (lotInfo.owner_sell_number > 0) {
- try {
- const lotDetail = await client.shopGetLotDetails(lotInfo.full_type);
- Object.keys(lotDetail.data.owner_prices).forEach((lotPrice: string) => {
- const priceCount = lotDetail.data.owner_prices[lotPrice];
- for (let i = 0; i < priceCount; i++) {
- setTimeout(() => {
- client.shopCancelSellCard(lotInfo.full_type, Number.parseInt(lotPrice, 10))
- .catch(err => {
- console.log(`Error on cancel lot ${lotInfo.full_type} for ${lotPrice}`, err);
- process.exit();
- })
- }, cancelRequestNumber * 50);
- cancelRequestNumber++;
- }
- })
- } catch (err) {
- console.log("Error on get lot detail", lotInfo, err);
- process.exit();
- }
- }
- });
- })
- .catch(error => console.error(error));
Advertisement
Add Comment
Please, Sign In to add comment