From 6feb48d527555543ad163e852cb78545a5773f12 Mon Sep 17 00:00:00 2001 From: IdiNium <47635037+idinium96@users.noreply.github.com> Date: Mon, 8 Aug 2022 04:43:51 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix=20group=20being=20altered=20?= =?UTF-8?q?on=20reset=20autoprice?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../offer/accepted/updateListings.ts | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/classes/MyHandler/offer/accepted/updateListings.ts b/src/classes/MyHandler/offer/accepted/updateListings.ts index c8d806520..e215afc71 100644 --- a/src/classes/MyHandler/offer/accepted/updateListings.ts +++ b/src/classes/MyHandler/offer/accepted/updateListings.ts @@ -182,27 +182,22 @@ export default function updateListings( // if (isAutopriceManuallyPricedItem) { - const entry: EntryData = { - sku: priceListEntry.sku, - intent: priceListEntry.intent, - enabled: priceListEntry.enabled, - min: priceListEntry.min, - max: priceListEntry.max, - autoprice: true - }; + priceListEntry.autoprice = true; + delete priceListEntry.name; + delete priceListEntry.time; bot.pricelist - .updatePrice({ priceKey, entryData: entry, emitChange: true }) + .updatePrice({ priceKey, entryData: priceListEntry, emitChange: true }) .then(updatedEntry => { const msg = - `✅ Automatically reset ${entry.sku} to autoprice (item sold).` + + `✅ Automatically reset ${priceListEntry.sku} to autoprice (item sold).` + `\nPrevious: ${priceListEntry.buy.toString()}/${priceListEntry.sell.toString()}` + `\nNew: ${updatedEntry.buy.toString()}/${updatedEntry.sell.toString()}`; log.debug(msg); if (opt.sendAlert.enable && opt.sendAlert.autoResetToAutopriceOnceSold) { if (dwEnabled) { - sendAlert('autoResetToAutopriceOnceSold', bot, msg, null, null, [entry.sku]); + sendAlert('autoResetToAutopriceOnceSold', bot, msg, null, null, [priceListEntry.sku]); } else { bot.messageAdmins(msg, []); } @@ -211,7 +206,7 @@ export default function updateListings( if (isPricecheckRequestEnabled) addToQ(priceKey, isNotPure, existsInPricelist); }) .catch(err => { - log.warn(`❌ Failed to automatically reset ${entry.sku} to autoprice: `, err); + log.warn(`❌ Failed to automatically reset ${priceListEntry.sku} to autoprice: `, err); if (isPricecheckRequestEnabled) addToQ(priceKey, isNotPure, existsInPricelist); }); }