From f87dd9652c06e99a3047493366b2ccf216ec452e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 16 Jul 2020 02:20:47 +0000 Subject: [PATCH 01/31] Bump lodash from 4.17.15 to 4.17.19 Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19. - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.19) Signed-off-by: dependabot[bot] --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3904b9e5e..341507a3f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2920,9 +2920,9 @@ } }, "lodash": { - "version": "4.17.15", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", - "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==" + "version": "4.17.19", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz", + "integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==" }, "lodash.assignin": { "version": "4.2.0", From b1f05a5732b8785ec1911d034e6729d52c25a075 Mon Sep 17 00:00:00 2001 From: idinium96 Date: Fri, 17 Jul 2020 07:34:32 +0800 Subject: [PATCH 02/31] update note --- src/classes/MyHandler.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/classes/MyHandler.ts b/src/classes/MyHandler.ts index 6e5846e65..1fb5419ac 100644 --- a/src/classes/MyHandler.ts +++ b/src/classes/MyHandler.ts @@ -1390,8 +1390,8 @@ export = class MyHandler extends Handler { */ /** - * disable Autokeys - true if minRef ≤ currRef ≤ maxRef AND - * (currKeys ≤ minKeys OR minKeys ≤ currKeys ≤ maxKeys OR currKeys ≥ maxKeys) + * disable Autokeys - true if currRef \>= maxRef AND currKeys \>= maxKeys OR + * (minRef \<= currRef \<= maxRef AND currKeys \<= maxKeys) */ const isRemoveAutoKeys = (currReftoScrap >= userMaxReftoScrap && currKeys >= userMaxKeys) || From 4ac0c7f32b0bb9a81e08d03fc84f0b26be7d77b2 Mon Sep 17 00:00:00 2001 From: idinium96 Date: Fri, 17 Jul 2020 07:37:47 +0800 Subject: [PATCH 03/31] add a parameter %amount_can_buy% for listing note --- README.md | 7 ++++--- src/classes/Listings.ts | 37 +++++++++++++------------------------ 2 files changed, 17 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 77cea2b40..72285a6b7 100644 --- a/README.md +++ b/README.md @@ -231,9 +231,10 @@ Time will be use in "!time" command and **Parameters:** - `%name%` - display an item name - `%price%` - display item's buying/selling price -- `%current_stock%` - display item's current stock -- `%max_stock%` - display item's maximum stock -- `%amount_trade%` - display amount that can be traded (between minimum and maximum stock) +- `%current_stock%` - display item's current stock (by default this is used in `BPTF_DETAILS_BUY`) +- `%max_stock%` - display item's maximum stock (by default this is used in `BPTF_DETAILS_BUY`) +- `%amount_trade%` - display amount that can be traded (between minimum and maximum stock, use it on `BPTF_DETAILS_SELL`) +- `%amount_can_buy%` - display the amount that the bot can buy (use it on `BPTF_DETAILS_BUY`) - `%keyPrice%` - display current key rate (selling price), it will show as `Key rate: x ref/key` only if the item price include x key, otherwise, it will show as ✨ - `%dueling%` - will display `(𝗢𝗡𝗟𝗬 𝗪𝗜𝗧𝗛 𝟱x 𝗨𝗦𝗘𝗦)` on only Dueling Mini-Game listing - prefer to only place this on `BPTF_DETAILS_BUY`, on other item will show as ✨ diff --git a/src/classes/Listings.ts b/src/classes/Listings.ts index 2bd893042..ae3a7335a 100644 --- a/src/classes/Listings.ts +++ b/src/classes/Listings.ts @@ -472,51 +472,40 @@ export = class Listings { const key = buying ? 'buy' : 'sell'; const keyPrice = this.bot.pricelist.getKeyPrice().toString(); + const maxStock = entry.max; + const currentStock = this.bot.inventoryManager.getInventory().getAmount(entry.sku); + const amountCanBuy = maxStock - currentStock; + let details: string; if (entry.sku === '241;6') { details = this.templates[key] .replace(/%price%/g, entry[key].toString()) .replace(/%name%/g, entry.name) - .replace(/%max_stock%/g, entry.max.toString()) - .replace( - /%current_stock%/g, - this.bot.inventoryManager - .getInventory() - .getAmount(entry.sku) - .toString() - ) + .replace(/%max_stock%/g, maxStock.toString()) + .replace(/%current_stock%/g, currentStock.toString()) .replace(/%amount_trade%/g, this.bot.inventoryManager.amountCanTrade(entry.sku, buying).toString()) + .replace(/%amount_can_buy%/g, amountCanBuy.toString()) .replace(/%keyPrice%/g, '✨') .replace(/%dueling%/g, '(𝗢𝗡𝗟𝗬 𝗪𝗜𝗧𝗛 𝟱x 𝗨𝗦𝗘𝗦)'); } else if (entry.name === 'Mann Co. Supply Crate Key' || !entry[key].toString().includes('key')) { details = this.templates[key] .replace(/%price%/g, entry[key].toString()) .replace(/%name%/g, entry.name) - .replace(/%max_stock%/g, entry.max.toString()) - .replace( - /%current_stock%/g, - this.bot.inventoryManager - .getInventory() - .getAmount(entry.sku) - .toString() - ) + .replace(/%max_stock%/g, maxStock.toString()) + .replace(/%current_stock%/g, currentStock.toString()) .replace(/%amount_trade%/g, this.bot.inventoryManager.amountCanTrade(entry.sku, buying).toString()) + .replace(/%amount_can_buy%/g, amountCanBuy.toString()) .replace(/%keyPrice%/g, '✨') .replace(/%dueling%/g, '✨'); } else { details = this.templates[key] .replace(/%price%/g, entry[key].toString()) .replace(/%name%/g, entry.name) - .replace(/%max_stock%/g, entry.max.toString()) - .replace( - /%current_stock%/g, - this.bot.inventoryManager - .getInventory() - .getAmount(entry.sku) - .toString() - ) + .replace(/%max_stock%/g, maxStock.toString()) + .replace(/%current_stock%/g, currentStock.toString()) .replace(/%amount_trade%/g, this.bot.inventoryManager.amountCanTrade(entry.sku, buying).toString()) + .replace(/%amount_can_buy%/g, amountCanBuy.toString()) .replace(/%keyPrice%/g, 'Key rate: ' + keyPrice + '/key') .replace(/%dueling%/g, '✨'); } From dfa03ab940fb800bc757891dbcf246d261720160 Mon Sep 17 00:00:00 2001 From: idinium96 Date: Fri, 17 Jul 2020 19:18:48 +0800 Subject: [PATCH 04/31] add an option to customize playing game name --- README.md | 2 ++ src/classes/MyHandler.ts | 21 ++++++++++++++++++--- template.ecosystem.json | 2 ++ template.env | 2 ++ 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 72285a6b7..5ad14ba32 100644 --- a/README.md +++ b/README.md @@ -315,6 +315,8 @@ What the trade partner will received: "Dueling Mini-Game, Secret Saxton are not ### Others +- `CUSTOM_PLAYING_GAME_NAME` - Custom name of the game your bot is playing. Limited to only 45 characters. Example: https://gyazo.com/308e4e05bf4c49929520df4e0064864c. + - `CUSTOM_WELCOME_MESSAGE` - Your custom WELCOME_MESSAGE note. Two parameters: `%name%` (display trade partner name) and `%admin%` (if admin, it will use "!help", else "!how2trade"). - `CUSTOM_I_DONT_KNOW_WHAT_YOU_MEAN` - Your custom note when people sends wrong command. - `CUSTOM_HOW2TRADE_MESSAGE` - Your custom HOW2TRADE note. diff --git a/src/classes/MyHandler.ts b/src/classes/MyHandler.ts index 1fb5419ac..66fabd787 100644 --- a/src/classes/MyHandler.ts +++ b/src/classes/MyHandler.ts @@ -89,6 +89,8 @@ export = class MyHandler extends Handler { private autoRelistNotBuyingKeys = 0; + private customGameName: string; + recentlySentMessage: UnknownDictionary = {}; constructor(bot: Bot) { @@ -124,6 +126,19 @@ export = class MyHandler extends Handler { this.invalidValueExceptionSKU = [';5;u', ';11;australium']; } + if (process.env.CUSTOM_PLAYING_GAME_NAME === 'tf2-automatic') { + this.customGameName = process.env.CUSTOM_PLAYING_GAME_NAME; + } else { + if (process.env.CUSTOM_PLAYING_GAME_NAME.length <= 45) { + this.customGameName = process.env.CUSTOM_PLAYING_GAME_NAME + ' - tf2-automatic'; + } else { + log.warn( + 'Your custom game playing name is more than 45 characters, resetting to only "tf2-automatic"...' + ); + this.customGameName = 'tf2-automatic'; + } + } + const exceptionRefFromEnv = exceptionRef === 0 || isNaN(exceptionRef) ? 0 : exceptionRef; this.invalidValueException = Currencies.toScrap(exceptionRefFromEnv); @@ -254,7 +269,7 @@ export = class MyHandler extends Handler { ')' ); - this.bot.client.gamesPlayed(['tf2-automatic', 440]); + this.bot.client.gamesPlayed([this.customGameName, 440]); this.bot.client.setPersona(SteamUser.EPersonaState.Online); // Smelt / combine metal if needed @@ -304,7 +319,7 @@ export = class MyHandler extends Handler { onLoggedOn(): void { if (this.bot.isReady()) { this.bot.client.setPersona(SteamUser.EPersonaState.Online); - this.bot.client.gamesPlayed(['tf2-automatic', 440]); + this.bot.client.gamesPlayed([this.customGameName, 440]); } } @@ -2808,6 +2823,6 @@ Autokeys status:- onTF2QueueCompleted(): void { log.debug('Queue finished'); - this.bot.client.gamesPlayed(['tf2-automatic', 440]); + this.bot.client.gamesPlayed([this.customGameName, 440]); } }; diff --git a/template.ecosystem.json b/template.ecosystem.json index df5ca2097..c0c06f7a2 100644 --- a/template.ecosystem.json +++ b/template.ecosystem.json @@ -122,6 +122,8 @@ "DUPE_CHECK_FAILED_NOTE": "", "ADDITIONAL_NOTE": "", + "CUSTOM_PLAYING_GAME_NAME": "tf2-automatic", + "CUSTOM_WELCOME_MESSAGE": "", "CUSTOM_I_DONT_KNOW_WHAT_YOU_MEAN": "", "CUSTOM_HOW2TRADE_MESSAGE": "", diff --git a/template.env b/template.env index fa6a90a05..700c07cc0 100644 --- a/template.env +++ b/template.env @@ -109,6 +109,8 @@ DUPE_ITEMS_NOTE="" DUPE_CHECK_FAILED_NOTE="" ADDITIONAL_NOTE="" +CUSTOM_PLAYING_GAME_NAME="tf2-automatic" + CUSTOM_WELCOME_MESSAGE="" CUSTOM_I_DONT_KNOW_WHAT_YOU_MEAN="" CUSTOM_HOW2TRADE_MESSAGE="" From ede73bd91af89e6939ee63b69a406f6e64e952d3 Mon Sep 17 00:00:00 2001 From: idinium96 Date: Fri, 17 Jul 2020 19:22:50 +0800 Subject: [PATCH 05/31] 5x Uses for Dueling Mini-Game is now an option --- README.md | 3 ++- src/classes/MyHandler.ts | 43 +++++++++++++++++++++++----------------- template.ecosystem.json | 1 + 3 files changed, 28 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 5ad14ba32..e8a9099ef 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ The original tf2-automatic repository already have a lot of features, but some f - INVALID_VALUE exception - add an option to NOT mention (Discord Webhook) on an INVALID_VALUE offer - Mention every items on each offer review reasons -- Dueling Mini-Game: Only accept 5 Uses! +- Dueling Mini-Game: Only accept 5 Uses! (option) - New added commands: "!pure", "!time", "!delete", "!check", "!block", "!unblock" and "!autokeys" - add an option to disable acceptting friend request - and more to come! @@ -183,6 +183,7 @@ You can run your bot without this first, which then on the first run, it will pr - `DISABLE_SOMETHING_WRONG_ALERT`: [true|false] - Default: false. My custom - Used to notify owner if your bot has a queue problem/full inventory/low in pure (if Autokeys is on). - `DISABLE_CRAFTWEAPON_AS_CURRENCY`: [true|false] - Default: false. Set it as true if you don't want to set craft weapons as currency (0.05 ref). - `DISABLE_ADD_FRIENDS`: [true|false] - Default: false. Set to true if you don't want people to add your bot (not recommended). +- `DISABLE_CHECK_USES_DUELING_MINI_GAME`: [true|false] - Default: false. Set to true if you want your bot to buy Dueling Mini-Game of regardless of how many uses left. #### Misc feature - `TRADES_MADE_STARTER_VALUE`: [Number] - Used mainly for displaying your bot total trades made, found in your bot Steam Profile page (leave it 0 if you don't care about it, used for discord webhook). diff --git a/src/classes/MyHandler.ts b/src/classes/MyHandler.ts index 66fabd787..fcc0e3f28 100644 --- a/src/classes/MyHandler.ts +++ b/src/classes/MyHandler.ts @@ -521,28 +521,35 @@ export = class MyHandler extends Handler { return { action: 'decline', reason: 'GIFT_NO_NOTE' }; } - let hasNot5Uses = false; - offer.itemsToReceive.forEach(item => { - if (item.name === 'Dueling Mini-Game') { - for (let i = 0; i < item.descriptions.length; i++) { - const descriptionValue = item.descriptions[i].value; - const descriptionColor = item.descriptions[i].color; + // Check for Dueling Mini-Game for 5x Uses only when enabled and exist in pricelist - if ( - !descriptionValue.includes('This is a limited use item. Uses: 5') && - descriptionColor === '00a000' - ) { - hasNot5Uses = true; - log.debug('info', `Dueling Mini-Game (${item.assetid}) is not 5 uses.`); - break; + const checkExist = this.bot.pricelist; + + if (process.env.DISABLE_CHECK_USES_DUELING_MINI_GAME !== 'true') { + let hasNot5Uses = false; + offer.itemsToReceive.forEach(item => { + if (item.name === 'Dueling Mini-Game') { + for (let i = 0; i < item.descriptions.length; i++) { + const descriptionValue = item.descriptions[i].value; + const descriptionColor = item.descriptions[i].color; + + if ( + !descriptionValue.includes('This is a limited use item. Uses: 5') && + descriptionColor === '00a000' + ) { + hasNot5Uses = true; + log.debug('info', `Dueling Mini-Game (${item.assetid}) is not 5 uses.`); + break; + } } } - } - }); + }); - if (hasNot5Uses && this.bot.pricelist.getPrice('241;6', true) !== null) { - offer.log('info', 'contains Dueling Mini-Game that is not 5 uses.'); - return { action: 'decline', reason: 'DUELING_NOT_5_USES' }; + if (hasNot5Uses && checkExist.getPrice('241;6', true) !== null) { + // Only decline if exist in pricelist + offer.log('info', 'contains Dueling Mini-Game that are not 5 uses.'); + return { action: 'decline', reason: 'DUELING_NOT_5_USES' }; + } } const manualReviewEnabled = process.env.ENABLE_MANUAL_REVIEW !== 'false'; diff --git a/template.ecosystem.json b/template.ecosystem.json index c0c06f7a2..561fcc9a1 100644 --- a/template.ecosystem.json +++ b/template.ecosystem.json @@ -42,6 +42,7 @@ "DISABLE_SOMETHING_WRONG_ALERT": false, "DISABLE_CRAFTWEAPON_AS_CURRENCY": false, "DISABLE_ADD_FRIENDS": false, + "DISABLE_CHECK_USES_DUELING_MINI_GAME": false, "TRADES_MADE_STARTER_VALUE": 0, "LAST_TOTAL_TRADES": 0, From 82a46e904b5a349df70cc4f5d4df13212a0bce33 Mon Sep 17 00:00:00 2001 From: idinium96 Date: Fri, 17 Jul 2020 19:26:51 +0800 Subject: [PATCH 06/31] add an option for 25 uses Noise Maker check --- README.md | 2 ++ src/classes/MyHandler.ts | 71 ++++++++++++++++++++++++++++++++++++++++ template.ecosystem.json | 1 + template.env | 2 ++ 4 files changed, 76 insertions(+) diff --git a/README.md b/README.md index e8a9099ef..c58fb07dd 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,7 @@ The original tf2-automatic repository already have a lot of features, but some f - add an option to NOT mention (Discord Webhook) on an INVALID_VALUE offer - Mention every items on each offer review reasons - Dueling Mini-Game: Only accept 5 Uses! (option) +- Noise Maker: Only accept 25 Uses! (option) - New added commands: "!pure", "!time", "!delete", "!check", "!block", "!unblock" and "!autokeys" - add an option to disable acceptting friend request - and more to come! @@ -184,6 +185,7 @@ You can run your bot without this first, which then on the first run, it will pr - `DISABLE_CRAFTWEAPON_AS_CURRENCY`: [true|false] - Default: false. Set it as true if you don't want to set craft weapons as currency (0.05 ref). - `DISABLE_ADD_FRIENDS`: [true|false] - Default: false. Set to true if you don't want people to add your bot (not recommended). - `DISABLE_CHECK_USES_DUELING_MINI_GAME`: [true|false] - Default: false. Set to true if you want your bot to buy Dueling Mini-Game of regardless of how many uses left. +- `DISABLE_CHECK_USES_NOISE_MAKER`: [true|false] - Default: false. Set to true if you want your bot to accept Noise Maker that is not 25 Uses. #### Misc feature - `TRADES_MADE_STARTER_VALUE`: [Number] - Used mainly for displaying your bot total trades made, found in your bot Steam Profile page (leave it 0 if you don't care about it, used for discord webhook). diff --git a/src/classes/MyHandler.ts b/src/classes/MyHandler.ts index fcc0e3f28..aab6e3fa9 100644 --- a/src/classes/MyHandler.ts +++ b/src/classes/MyHandler.ts @@ -552,6 +552,75 @@ export = class MyHandler extends Handler { } } + // Check for Noise Maker for 25x Uses only when enabled and exist in pricelist + + if (process.env.DISABLE_CHECK_USES_NOISE_MAKER !== 'true') { + let hasNot25Uses = false; + offer.itemsToReceive.forEach(item => { + if ( + item.name.includes('Noise Maker - Black Cat') || // defindex: 280 + item.name.includes('Noise Maker - Gremlin') || // defindex: 281 + item.name.includes('Noise Maker - Werewolf') || // defindex: 282 + item.name.includes('Noise Maker - Witch') || // defindex: 283 + item.name.includes('Noise Maker - Banshee') || // defindex: 284 + item.name.includes('Noise Maker - Crazy Laugh') || // defindex: 286 + item.name.includes('Noise Maker - Stabby') || // defindex: 288 + item.name.includes('Noise Maker - Bell') || // defindex: 362 + item.name.includes('Noise Maker - Gong') || // defindex: 364 + item.name.includes('Noise Maker - Koto') || // defindex: 365 + item.name.includes('Noise Maker - Fireworks') || // defindex: 493 + item.name.includes('Noise Maker - Vuvuzela') // defindex: 542 + ) { + for (let i = 0; i < item.descriptions.length; i++) { + const descriptionValue = item.descriptions[i].value; + const descriptionColor = item.descriptions[i].color; + + if ( + !descriptionValue.includes('This is a limited use item. Uses: 25') && + descriptionColor === '00a000' + ) { + hasNot25Uses = true; + log.debug('info', `${item.name} (${item.assetid}) is not 25 uses.`); + break; + } + } + } + }); + + if ( + hasNot25Uses && + (checkExist.getPrice('280;6', true) !== null || // Noise Maker - Black Cat + checkExist.getPrice('280;6;uncraftable', true) !== null || + checkExist.getPrice('281;6', true) !== null || // Noise Maker - Gremlin + checkExist.getPrice('281;6;uncraftable', true) !== null || + checkExist.getPrice('282;6', true) !== null || // Noise Maker - Werewolf + checkExist.getPrice('282;6;uncraftable', true) !== null || + checkExist.getPrice('283;6', true) !== null || // Noise Maker - Witch + checkExist.getPrice('283;6;uncraftable', true) !== null || + checkExist.getPrice('284;6', true) !== null || // Noise Maker - Banshee + checkExist.getPrice('284;6;uncraftable', true) !== null || + checkExist.getPrice('286;6', true) !== null || // Noise Maker - Crazy Laugh + checkExist.getPrice('286;6;uncraftable', true) !== null || + checkExist.getPrice('288;6', true) !== null || // Noise Maker - Stabby + checkExist.getPrice('288;6;uncraftable', true) !== null || + checkExist.getPrice('362;6', true) !== null || // Noise Maker - Bell + checkExist.getPrice('362;6;uncraftable', true) !== null || + checkExist.getPrice('364;6', true) !== null || // Noise Maker - Gong + checkExist.getPrice('364;6;uncraftable', true) !== null || + checkExist.getPrice('365;6', true) !== null || // Noise Maker - Koto + checkExist.getPrice('365;6;uncraftable', true) !== null || + checkExist.getPrice('365;1', true) !== null || // Genuine + checkExist.getPrice('493;6', true) !== null || // Noise Maker - Fireworks + checkExist.getPrice('493;6;uncraftable', true) !== null || + checkExist.getPrice('542;6', true) !== null || // Noise Maker - Vuvuzela + checkExist.getPrice('542;6;uncraftable', true) !== null || + checkExist.getPrice('542;1', true) !== null) // Genuine + ) { + offer.log('info', 'contains Noice Maker that are not 25 uses.'); + return { action: 'decline', reason: 'NOISE_MAKER_NOT_25_USES' }; + } + } + const manualReviewEnabled = process.env.ENABLE_MANUAL_REVIEW !== 'false'; const itemPrices = {}; @@ -1015,6 +1084,8 @@ export = class MyHandler extends Handler { reason = `the offer you've sent is an empty offer on my side without any offer message. If you wish to give it as a gift, please include "gift" in the offer message. Thank you.`; } else if (offerReason.reason === 'DUELING_NOT_5_USES') { reason = 'your offer contains Dueling Mini-Game that are not 5 uses.'; + } else if (offerReason.reason === 'NOISE_MAKER_NOT_25_USES') { + reason = 'your offer contains Noise Maker that are not 25 uses.'; } this.bot.sendMessage( offer.partner, diff --git a/template.ecosystem.json b/template.ecosystem.json index 561fcc9a1..4ffd1e650 100644 --- a/template.ecosystem.json +++ b/template.ecosystem.json @@ -43,6 +43,7 @@ "DISABLE_CRAFTWEAPON_AS_CURRENCY": false, "DISABLE_ADD_FRIENDS": false, "DISABLE_CHECK_USES_DUELING_MINI_GAME": false, + "DISABLE_CHECK_USES_NOISE_MAKER": false, "TRADES_MADE_STARTER_VALUE": 0, "LAST_TOTAL_TRADES": 0, diff --git a/template.env b/template.env index 700c07cc0..df0f9f0b3 100644 --- a/template.env +++ b/template.env @@ -29,6 +29,8 @@ DISABLE_MESSAGES=false DISABLE_SOMETHING_WRONG_ALERT=false DISABLE_CRAFTWEAPON_AS_CURRENCY=false DISABLE_ADD_FRIENDS=false +DISABLE_CHECK_USES_DUELING_MINI_GAME=false +DISABLE_CHECK_USES_NOISE_MAKER=false TRADES_MADE_STARTER_VALUE=0 LAST_TOTAL_TRADES=0 From 23c1300d3a392b4f97585049681dbd30a5f9e866 Mon Sep 17 00:00:00 2001 From: idinium96 Date: Fri, 17 Jul 2020 19:29:26 +0800 Subject: [PATCH 07/31] ouch. I need more glasses. --- src/classes/MyHandler.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/classes/MyHandler.ts b/src/classes/MyHandler.ts index aab6e3fa9..969d82cd2 100644 --- a/src/classes/MyHandler.ts +++ b/src/classes/MyHandler.ts @@ -129,7 +129,7 @@ export = class MyHandler extends Handler { if (process.env.CUSTOM_PLAYING_GAME_NAME === 'tf2-automatic') { this.customGameName = process.env.CUSTOM_PLAYING_GAME_NAME; } else { - if (process.env.CUSTOM_PLAYING_GAME_NAME.length <= 45) { + if (process.env.CUSTOM_PLAYING_GAME_NAME.length > 45) { this.customGameName = process.env.CUSTOM_PLAYING_GAME_NAME + ' - tf2-automatic'; } else { log.warn( From be84a06cee80dbcebd1412a4aa549be4afca67ae Mon Sep 17 00:00:00 2001 From: idinium96 Date: Fri, 17 Jul 2020 19:30:43 +0800 Subject: [PATCH 08/31] revert - it's actually already correct. -.-' --- src/classes/MyHandler.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/classes/MyHandler.ts b/src/classes/MyHandler.ts index 969d82cd2..aab6e3fa9 100644 --- a/src/classes/MyHandler.ts +++ b/src/classes/MyHandler.ts @@ -129,7 +129,7 @@ export = class MyHandler extends Handler { if (process.env.CUSTOM_PLAYING_GAME_NAME === 'tf2-automatic') { this.customGameName = process.env.CUSTOM_PLAYING_GAME_NAME; } else { - if (process.env.CUSTOM_PLAYING_GAME_NAME.length > 45) { + if (process.env.CUSTOM_PLAYING_GAME_NAME.length <= 45) { this.customGameName = process.env.CUSTOM_PLAYING_GAME_NAME + ' - tf2-automatic'; } else { log.warn( From ce454040fd058a41c8e9d6d970e5526709712675 Mon Sep 17 00:00:00 2001 From: idinium96 Date: Fri, 17 Jul 2020 19:33:52 +0800 Subject: [PATCH 09/31] update README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c58fb07dd..f82ed6205 100644 --- a/README.md +++ b/README.md @@ -318,7 +318,7 @@ What the trade partner will received: "Dueling Mini-Game, Secret Saxton are not ### Others -- `CUSTOM_PLAYING_GAME_NAME` - Custom name of the game your bot is playing. Limited to only 45 characters. Example: https://gyazo.com/308e4e05bf4c49929520df4e0064864c. +- `CUSTOM_PLAYING_GAME_NAME` - Custom name of the game your bot is playing. Limited to only 45 characters. Example: https://gyazo.com/308e4e05bf4c49929520df4e0064864c (you do not need to include that `- tf2-automatic`, just your custom game name but not more than 45 characters.) - `CUSTOM_WELCOME_MESSAGE` - Your custom WELCOME_MESSAGE note. Two parameters: `%name%` (display trade partner name) and `%admin%` (if admin, it will use "!help", else "!how2trade"). - `CUSTOM_I_DONT_KNOW_WHAT_YOU_MEAN` - Your custom note when people sends wrong command. From 48c1e16f631efc21d9da79e635d887798b363d42 Mon Sep 17 00:00:00 2001 From: idinium96 Date: Sat, 18 Jul 2020 09:42:59 +0800 Subject: [PATCH 10/31] for feature experiment - old crateseries # problem --- src/lib/extend/item/getSKU.ts | 82 +++++++++++++++++++++++++++++++++++ src/lib/items.ts | 5 ++- 2 files changed, 86 insertions(+), 1 deletion(-) diff --git a/src/lib/extend/item/getSKU.ts b/src/lib/extend/item/getSKU.ts index 69c581d2f..365f19db0 100644 --- a/src/lib/extend/item/getSKU.ts +++ b/src/lib/extend/item/getSKU.ts @@ -26,6 +26,7 @@ export = function(schema: SchemaManager.Schema): string { wear: getWear(self), paintkit: getPaintKit(self, schema), quality2: getElevatedQuality(self) + // crateseries: getCrateSeries(self) }, getOutput(self, schema) ); @@ -322,3 +323,84 @@ function getTarget(item: EconItem, schema: SchemaManager.Schema): number | null return null; } + +// /** +// * Gets crate series of Mann Co. Supply Crate +// * @param item - Item object +// */ +// function getCrateSeries(item: EconItem): number | null { +// const defindex = getDefindex(item); + +// const is5022 = { +// 'Mann Co. Supply Crate Series #1': 1, +// 'Mann Co. Supply Crate Series #3': 3, +// 'Mann Co. Supply Crate Series #7': 7, +// 'Mann Co. Supply Crate Series #12': 12, +// 'Mann Co. Supply Crate Series #13': 13, +// 'Mann Co. Supply Crate Series #18': 18, +// 'Mann Co. Supply Crate Series #19': 19, +// 'Mann Co. Supply Crate Series #23': 23, +// 'Mann Co. Supply Crate Series #26': 26, +// 'Mann Co. Supply Crate Series #31': 31, +// 'Mann Co. Supply Crate Series #34': 34, +// 'Mann Co. Supply Crate Series #39': 39, +// 'Mann Co. Supply Crate Series #43': 43, +// 'Mann Co. Supply Crate Series #47': 47, +// 'Mann Co. Supply Crate Series #54': 54, +// 'Mann Co. Supply Crate Series #57': 57, +// 'Mann Co. Supply Crate Series #75': 75 +// }; +// const is5041 = { +// 'Mann Co. Supply Crate Series #2': 2, +// 'Mann Co. Supply Crate Series #4': 4, +// 'Mann Co. Supply Crate Series #8': 8, +// 'Mann Co. Supply Crate Series #11': 11, +// 'Mann Co. Supply Crate Series #14': 14, +// 'Mann Co. Supply Crate Series #17': 17, +// 'Mann Co. Supply Crate Series #20': 20, +// 'Mann Co. Supply Crate Series #24': 24, +// 'Mann Co. Supply Crate Series #27': 27, +// 'Mann Co. Supply Crate Series #32': 32, +// 'Mann Co. Supply Crate Series #37': 37, +// 'Mann Co. Supply Crate Series #42': 42, +// 'Mann Co. Supply Crate Series #44': 44, +// 'Mann Co. Supply Crate Series #49': 49, +// 'Mann Co. Supply Crate Series #56': 56, +// 'Mann Co. Supply Crate Series #71': 71, +// 'Mann Co. Supply Crate Series #75': 76 +// }; +// const is5045 = { +// 'Mann Co. Supply Crate Series #5': 5, +// 'Mann Co. Supply Crate Series #9': 9, +// 'Mann Co. Supply Crate Series #10': 10, +// 'Mann Co. Supply Crate Series #15': 15, +// 'Mann Co. Supply Crate Series #16': 16, +// 'Mann Co. Supply Crate Series #21': 21, +// 'Mann Co. Supply Crate #Series 25': 25, +// 'Mann Co. Supply Crate #Series 28': 28, +// 'Mann Co. Supply Crate Series #29': 29, +// 'Mann Co. Supply Crate Series #33': 33, +// 'Mann Co. Supply Crate Series #38': 38, +// 'Mann Co. Supply Crate Series #41': 41, +// 'Mann Co. Supply Crate Series #45': 45, +// 'Mann Co. Supply Crate Series #55': 55, +// 'Mann Co. Supply Crate Series #59': 59, +// 'Mann Co. Supply Crate Series #77': 77 +// }; + +// let series = 0; + +// if (defindex === 5022 && Object.keys(is5022).includes(item.name)) { +// series = is5022[item.name]; +// } else if (defindex === 5041 && Object.keys(is5041).includes(item.name)) { +// series = is5041[item.name]; +// } else if (defindex === 5045 && Object.keys(is5045).includes(item.name)) { +// series = is5045[item.name]; +// } + +// if (series !== 0) { +// return series; +// } else { +// return null; +// } +// } diff --git a/src/lib/items.ts b/src/lib/items.ts index e3132bfbc..89da2ced2 100644 --- a/src/lib/items.ts +++ b/src/lib/items.ts @@ -57,7 +57,10 @@ export function fixItem(item: Item, schema: SchemaManager.Schema): Item { for (let i = 0; i < schemaItem.attributes.length; i++) { const attribute = schemaItem.attributes[i]; - if (attribute.name === 'set supply crate series') { + if ( + attribute.name === 'set supply crate series' + // !(attribute.value === 82 || attribute.value === 83 || attribute.value === 77) + ) { series = attribute.value; } } From ce434e9cb3967d2e894dd2e61234e04a114d8db3 Mon Sep 17 00:00:00 2001 From: idinium96 Date: Sat, 18 Jul 2020 10:01:47 +0800 Subject: [PATCH 11/31] add !craftweapon and !uncraftweapon commands --- README.md | 2 +- src/classes/Commands.ts | 101 +++++++++++++++++++++++++++ src/classes/MyHandler.ts | 144 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 246 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f82ed6205..f01241e66 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ The original tf2-automatic repository already have a lot of features, but some f - Mention every items on each offer review reasons - Dueling Mini-Game: Only accept 5 Uses! (option) - Noise Maker: Only accept 25 Uses! (option) -- New added commands: "!pure", "!time", "!delete", "!check", "!block", "!unblock" and "!autokeys" +- New added commands: "!pure", "!time", "!delete", "!check", "!block", "!unblock", "!autokeys", "!craftweapon" and "!uncraftweapon" commands - add an option to disable acceptting friend request - and more to come! diff --git a/src/classes/Commands.ts b/src/classes/Commands.ts index 29f1c85e0..85adf25e5 100644 --- a/src/classes/Commands.ts +++ b/src/classes/Commands.ts @@ -32,6 +32,8 @@ const COMMANDS: string[] = [ '!stock - Get a list of items that the bot has', '!pure - Get current pure stock 💰', '!rate - Get current key prices 🔑', + '!craftweapon - get a list of craft weapon stock 🔫', + '!uncraftweapon - get a list of uncraft weapon stock 🔫', '!message - Send a message to the owner of the bot 💬', '!buy [amount] - Instantly buy an item 💲', '!sell [amount] - Instantly sell an item 💲', @@ -106,6 +108,10 @@ export = class Commands { this.timeCommand(steamID); } else if (command === 'autokeys' && isAdmin) { this.autoKeysCommand(steamID); + } else if (command === 'craftweapon') { + this.craftweaponCommand(steamID); + } else if (command === 'uncraftweapon') { + this.uncraftweaponCommand(steamID); } else if (command === 'rate') { this.rateCommand(steamID); } else if (command === 'message') { @@ -412,6 +418,31 @@ export = class Commands { this.bot.sendMessage(steamID, reply); } + private craftweaponCommand(steamID: SteamID): void { + const crafWeaponStock = this.craftWeapons(); + + let reply: string; + if (crafWeaponStock.length > 0) { + reply = "📃 Here's a list of all craft weapons stock in my inventory:\n\n" + crafWeaponStock.join(', \n'); + } else { + reply = "❌ I don't have any craftable weapons in my inventory."; + } + this.bot.sendMessage(steamID, reply); + } + + private uncraftweaponCommand(steamID: SteamID): void { + const uncrafWeaponStock = this.uncraftWeapons(); + + let reply: string; + if (uncrafWeaponStock.length > 0) { + reply = + "📃 Here's a list of all uncraft weapons stock in my inventory:\n\n" + uncrafWeaponStock.join(', \n'); + } else { + reply = "❌ I don't have any uncraftable weapons in my inventory."; + } + this.bot.sendMessage(steamID, reply); + } + private timeCommand(steamID: SteamID): void { const timeWithEmojis = (this.bot.handler as MyHandler).timeWithEmoji(); this.bot.sendMessage( @@ -2470,6 +2501,76 @@ export = class Commands { return fixItem(item, this.bot.schema); } + + private craftWeapons(): string[] { + const craftWeapons = (this.bot.handler as MyHandler).craftweaponOnlyCraftable(); + + const items: { amount: number; name: string }[] = []; + + craftWeapons.forEach(sku => { + items.push({ + name: this.bot.schema.getName(SKU.fromString(sku), false), + amount: this.bot.inventoryManager.getInventory().getAmount(sku) + }); + }); + + items.sort(function(a, b) { + if (a.amount === b.amount) { + if (a.name < b.name) { + return -1; + } else if (a.name > b.name) { + return 1; + } else { + return 0; + } + } + return b.amount - a.amount; + }); + + const craftWeaponsStock: string[] = []; + + if (items.length > 0) { + for (let i = 0; i < items.length; i++) { + craftWeaponsStock.push(items[i].name + ': ' + items[i].amount); + } + } + return craftWeaponsStock; + } + + private uncraftWeapons(): string[] { + const uncraftWeapons = (this.bot.handler as MyHandler).craftweaponOnlyUncraftable(); + + const items: { amount: number; name: string }[] = []; + + uncraftWeapons.forEach(sku => { + items.push({ + name: this.bot.schema.getName(SKU.fromString(sku), false), + amount: this.bot.inventoryManager.getInventory().getAmount(sku) + }); + }); + + items.sort(function(a, b) { + if (a.amount === b.amount) { + if (a.name < b.name) { + return -1; + } else if (a.name > b.name) { + return 1; + } else { + return 0; + } + } + return b.amount - a.amount; + }); + + const uncraftWeaponsStock: string[] = []; + + if (items.length > 0) { + for (let i = 0; i < items.length; i++) { + uncraftWeaponsStock.push(items[i].name + ': ' + items[i].amount); + } + } + return uncraftWeaponsStock; + } }; function removeLinkProtocol(message: string): string { diff --git a/src/classes/MyHandler.ts b/src/classes/MyHandler.ts index aab6e3fa9..f12f24bac 100644 --- a/src/classes/MyHandler.ts +++ b/src/classes/MyHandler.ts @@ -2829,6 +2829,150 @@ Autokeys status:- return weapons; } + craftweaponOnlyUncraftable(): string[] { + const weapons = [ + '61;6;uncraftable', + '1101;6;uncraftable', + '226;6;uncraftable', + '46;6;uncraftable', + '129;6;uncraftable', + '311;6;uncraftable', + '131;6;uncraftable', + '751;6;uncraftable', + '354;6;uncraftable', + '642;6;uncraftable', + '163;6;uncraftable', + '159;6;uncraftable', + '231;6;uncraftable', + '351;6;uncraftable', + '525;6;uncraftable', + '460;6;uncraftable', + '425;6;uncraftable', + '39;6;uncraftable', + '812;6;uncraftable', + '133;6;uncraftable', + '58;6;uncraftable', + '35;6;uncraftable', + '224;6;uncraftable', + '222;6;uncraftable', + '595;6;uncraftable', + '444;6;uncraftable', + '773;6;uncraftable', + '411;6;uncraftable', + '1150;6;uncraftable', + '57;6;uncraftable', + '415;6;uncraftable', + '442;6;uncraftable', + '42;6;uncraftable', + '740;6;uncraftable', + '130;6;uncraftable', + '528;6;uncraftable', + '406;6;uncraftable', + '265;6;uncraftable', + '1099;6;uncraftable', + '998;6;uncraftable', + '449;6;uncraftable', + '140;6;uncraftable', + '1104;6;uncraftable', + '405;6;uncraftable', + '772;6;uncraftable', + '1103;6;uncraftable', + '40;6;uncraftable', + '402;6;uncraftable', + '730;6;uncraftable', + '228;6;uncraftable', + '36;6;uncraftable', + '608;6;uncraftable', + '312;6;uncraftable', + '1098;6;uncraftable', + '441;6;uncraftable', + '305;6;uncraftable', + '215;6;uncraftable', + '127;6;uncraftable', + '45;6;uncraftable', + '1092;6;uncraftable', + '141;6;uncraftable', + '752;6;uncraftable', + '56;6;uncraftable', + '811;6;uncraftable', + '1151;6;uncraftable', + '414;6;uncraftable', + '308;6;uncraftable', + '996;6;uncraftable', + '526;6;uncraftable', + '41;6;uncraftable', + '513;6;uncraftable', + '412;6;uncraftable', + '1153;6;uncraftable', + '594;6;uncraftable', + '588;6;uncraftable', + '741;6;uncraftable', + '997;6;uncraftable', + '237;6;uncraftable', + '220;6;uncraftable', + '448;6;uncraftable', + '230;6;uncraftable', + '424;6;uncraftable', + '527;6;uncraftable', + '60;6;uncraftable', + '59;6;uncraftable', + '304;6;uncraftable', + '450;6;uncraftable', + '38;6;uncraftable', + '326;6;uncraftable', + '939;6;uncraftable', + '461;6;uncraftable', + '325;6;uncraftable', + '232;6;uncraftable', + '317;6;uncraftable', + '327;6;uncraftable', + '356;6;uncraftable', + '447;6;uncraftable', + '128;6;uncraftable', + '775;6;uncraftable', + '589;6;uncraftable', + '426;6;uncraftable', + '132;6;uncraftable', + '355;6;uncraftable', + '331;6;uncraftable', + '239;6;uncraftable', + '142;6;uncraftable', + '357;6;uncraftable', + '656;6;uncraftable', + '221;6;uncraftable', + '153;6;uncraftable', + '329;6;uncraftable', + '43;6;uncraftable', + '739;6;uncraftable', + '416;6;uncraftable', + '813;6;uncraftable', + '482;6;uncraftable', + '154;6;uncraftable', + '404;6;uncraftable', + '457;6;uncraftable', + '214;6;uncraftable', + '44;6;uncraftable', + '172;6;uncraftable', + '609;6;uncraftable', + '401;6;uncraftable', + '348;6;uncraftable', + '413;6;uncraftable', + '155;6;uncraftable', + '649;6;uncraftable', + '349;6;uncraftable', + '593;6;uncraftable', + '171;6;uncraftable', + '37;6;uncraftable', + '307;6;uncraftable', + '173;6;uncraftable', + '310;6;uncraftable', + '648;6;uncraftable', + '225;6;uncraftable', + '810;6;uncraftable' + ]; + return weapons; + } + private checkGroupInvites(): void { log.debug('Checking group invites'); From 1ab4bb906ec4553704f62879a5daaa78f6413c76 Mon Sep 17 00:00:00 2001 From: idinium96 Date: Sat, 18 Jul 2020 10:24:09 +0800 Subject: [PATCH 12/31] delete an item with an item assetid or sku --- src/classes/Commands.ts | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/classes/Commands.ts b/src/classes/Commands.ts index 85adf25e5..d065da6fd 100644 --- a/src/classes/Commands.ts +++ b/src/classes/Commands.ts @@ -56,7 +56,7 @@ const ADMIN_COMMANDS: string[] = [ '!pricecheck OR - Requests an item to be priced by PricesTF', '!check sku= - Request current price for an item from Prices.TF', '!expand - Uses Backpack Expanders to increase the inventory limit', - '!delete sku= - Delete any item (use only sku) 🚮', + '!delete sku= OR assetid= - Delete any item (use only sku) 🚮', '!stop - Stop the bot 🔴', '!restart - Restart the bot 🔄', '!version - Get version that the bot is running', @@ -1594,6 +1594,22 @@ export = class Commands { private deleteCommand(steamID: SteamID, message: string): void { const params = CommandParser.parseParams(CommandParser.removeCommand(message)); + if (params.assetid !== undefined) { + const sku = this.bot.inventoryManager.getInventory().findByAssetid(params.assetid); + const item = SKU.fromString(sku); + const name = this.bot.schema.getName(item, false); + + this.bot.tf2gc.deleteItem(params.assetid, err => { + if (err) { + log.warn(`Error trying to delete ${name}: `, err); + this.bot.sendMessage(steamID, `❌ Failed to delete ${name}(${params.assetid}): ${err.message}`); + return; + } + this.bot.sendMessage(steamID, `✅ Deleted ${name}(${params.assetid})!`); + }); + return; + } + if (params.name !== undefined || params.item !== undefined) { this.bot.sendMessage( steamID, @@ -1669,7 +1685,7 @@ export = class Commands { const name = this.bot.schema.getName(item, false); if (assetids.length === 0) { - // No backpack expanders + // Item not found this.bot.sendMessage(steamID, `❌ I couldn't find any ${pluralize(name, 0)}`); return; } @@ -1677,11 +1693,11 @@ export = class Commands { this.bot.tf2gc.deleteItem(assetids[0], err => { if (err) { log.warn(`Error trying to delete ${name}: `, err); - this.bot.sendMessage(steamID, `❌ Failed to delete ${name}: ${err.message}`); + this.bot.sendMessage(steamID, `❌ Failed to delete ${name}(${assetids[0]}): ${err.message}`); return; } - this.bot.sendMessage(steamID, `✅ Deleted ${name}!`); + this.bot.sendMessage(steamID, `✅ Deleted ${name}(${assetids[0]})!`); }); } From 0735688a9636b1aa5ed07899c656c1763ed12a59 Mon Sep 17 00:00:00 2001 From: idinium96 Date: Sat, 18 Jul 2020 11:11:43 +0800 Subject: [PATCH 13/31] option to accept INVALID_ITEMS/OVERSTOCKED overpay --- README.md | 5 +++++ src/classes/MyHandler.ts | 37 ++++++++++++++++++++++++++++--------- template.ecosystem.json | 5 +++++ template.env | 5 +++++ 4 files changed, 43 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index f01241e66..73fff2e95 100644 --- a/README.md +++ b/README.md @@ -298,8 +298,13 @@ Time will be use in "!time" command and - `DISABLE_SHOW_REVIEW_OFFER_SUMMARY`: [true|false] - set to true if you do not want your bot to show offer summary to trade partner, but it will only notify trade partner that their offer is being hold for a review. - `DISABLE_REVIEW_OFFER_NOTE`: [true|false] - If set to false, it will show note on [each error](https://github.com/idinium96/tf2autobot/blob/master/src/classes/MyHandler.ts#L1140-L1264) - `DISABLE_SHOW_CURRENT_TIME`: [true|false] - If set to false, it will show owner time on offer review notification that trade partner will received. + +- `ACCEPT_INVALID_ITEMS_OVERPAY`: [true|false] - Default: false. Set to true if you want your bot to accept a trade with INVALID_ITEMS but with their value more or equal to our value. +- `ACCEPT_OVERSTOCKED_OVERPAY`: [true|false] - Default: false. Set to true if you want your bot to accept a trade with OVERSTOCKED but with their value more or equal to our value. + - `INVALID_VALUE_EXCEPTION_SKUS` [StringArray] - An array of sku that will skip Invalid value if the difference between our and their value is not more than exception value in ref. Let say you want to trade an unusual, but then someone sent an offer with 0.11 ref less, but you want your bot to accept it anyway if it's less than 10 ref, so the trade will be accepted. By default, it will check only for any unusual and australium: `[";5;u", ";11;australium"]`, you can also leave it empty (`[""]`) so all with invalid value will be notified. - `INVALID_VALUE_EXCEPTION_VALUE_IN_REF` [Number] - Exception value for the sku(s) that you set above. Default is `0` (no exception). + - `INVALID_VALUE_NOTE` - Your custom INVALID_VALUE note. - *`INVALID_ITEMS_NOTE` - Your custom INVALID_ITEMS note. - *`OVERSTOCKED_NOTE` - Your custom OVERSTOCKED note. diff --git a/src/classes/MyHandler.ts b/src/classes/MyHandler.ts index f12f24bac..472e131bb 100644 --- a/src/classes/MyHandler.ts +++ b/src/classes/MyHandler.ts @@ -1039,15 +1039,34 @@ export = class MyHandler extends Handler { // const counteroffer = offer.counter(); // } - offer.log('info', `offer needs review (${uniqueReasons.join(', ')}), skipping...`); - return { - action: 'skip', - reason: 'REVIEW', - meta: { - uniqueReasons: uniqueReasons, - reasons: wrongAboutOffer - } - }; + if ( + ((uniqueReasons.includes('🟨INVALID_ITEMS') && process.env.ACCEPT_INVALID_ITEMS_OVERPAY === 'true') || + (uniqueReasons.includes('🟦OVERSTOCKED') && process.env.ACCEPT_OVERSTOCKED_OVERPAY === 'true')) && + !( + uniqueReasons.includes('🟥INVALID_VALUE') || + uniqueReasons.includes('🟫DUPED_ITEMS') || + uniqueReasons.includes('🟪DUPE_CHECK_FAILED') + ) && + exchange.our.value <= exchange.their.value + ) { + offer.log( + 'trade', + `contains invalid items/overstocked, but offer more or equal value, accepting. Summary:\n${offer.summarize( + this.bot.schema + )}` + ); + return { action: 'accept', reason: 'VALID' }; + } else { + offer.log('info', `offer needs review (${uniqueReasons.join(', ')}), skipping...`); + return { + action: 'skip', + reason: 'REVIEW', + meta: { + uniqueReasons: uniqueReasons, + reasons: wrongAboutOffer + } + }; + } } offer.log('trade', `accepting. Summary:\n${offer.summarize(this.bot.schema)}`); diff --git a/template.ecosystem.json b/template.ecosystem.json index 4ffd1e650..b1ef46be2 100644 --- a/template.ecosystem.json +++ b/template.ecosystem.json @@ -115,8 +115,13 @@ "DISABLE_SHOW_REVIEW_OFFER_SUMMARY": false, "DISABLE_REVIEW_OFFER_NOTE": false, "DISABLE_SHOW_CURRENT_TIME": false, + + "ACCEPT_INVALID_ITEMS_OVERPAY": false, + "ACCEPT_OVERSTOCKED_OVERPAY": false, + "INVALID_VALUE_EXCEPTION_SKUS": [";5;u", ";11;australium"], "INVALID_VALUE_EXCEPTION_VALUE_IN_REF": 0, + "INVALID_VALUE_NOTE": "", "INVALID_ITEMS_NOTE": "", "OVERSTOCKED_NOTE": "", diff --git a/template.env b/template.env index df0f9f0b3..0fcf3fa7a 100644 --- a/template.env +++ b/template.env @@ -102,8 +102,13 @@ ENABLE_MANUAL_REVIEW=true DISABLE_SHOW_REVIEW_OFFER_SUMMARY=false DISABLE_REVIEW_OFFER_NOTE=false DISABLE_SHOW_CURRENT_TIME=false + +ACCEPT_INVALID_ITEMS_OVERPAY=false +ACCEPT_OVERSTOCKED_OVERPAY=false + INVALID_VALUE_EXCEPTION_SKUS=[";5;u", ";11;australium"] INVALID_VALUE_EXCEPTION_VALUE_IN_REF=0 + INVALID_VALUE_NOTE="" INVALID_ITEMS_NOTE="" OVERSTOCKED_NOTE="" From f9c2461b74d10ad97eb0dad6ae606351dff3e6e4 Mon Sep 17 00:00:00 2001 From: idinium96 Date: Sat, 18 Jul 2020 16:29:18 +0800 Subject: [PATCH 14/31] fix crashed - but mostly can't delete by assetid --- src/classes/Commands.ts | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/src/classes/Commands.ts b/src/classes/Commands.ts index d065da6fd..314e08931 100644 --- a/src/classes/Commands.ts +++ b/src/classes/Commands.ts @@ -1595,19 +1595,33 @@ export = class Commands { const params = CommandParser.parseParams(CommandParser.removeCommand(message)); if (params.assetid !== undefined) { - const sku = this.bot.inventoryManager.getInventory().findByAssetid(params.assetid); - const item = SKU.fromString(sku); - const name = this.bot.schema.getName(item, false); + const ourInventory = this.bot.inventoryManager.getInventory(); + const sku = ourInventory.findByAssetid(params.assetid); - this.bot.tf2gc.deleteItem(params.assetid, err => { - if (err) { - log.warn(`Error trying to delete ${name}: `, err); - this.bot.sendMessage(steamID, `❌ Failed to delete ${name}(${params.assetid}): ${err.message}`); - return; - } - this.bot.sendMessage(steamID, `✅ Deleted ${name}(${params.assetid})!`); - }); - return; + if (sku === null) { + this.bot.tf2gc.deleteItem(params.assetid, err => { + if (err) { + log.warn(`Error trying to delete ${params.assetid}: `, err); + this.bot.sendMessage(steamID, `❌ Failed to delete ${params.assetid}: ${err.message}`); + return; + } + this.bot.sendMessage(steamID, `✅ Deleted ${params.assetid}!`); + }); + return; + } else { + const item = SKU.fromString(sku); + const name = this.bot.schema.getName(item, false); + + this.bot.tf2gc.deleteItem(params.assetid, err => { + if (err) { + log.warn(`Error trying to delete ${name}: `, err); + this.bot.sendMessage(steamID, `❌ Failed to delete ${name}(${params.assetid}): ${err.message}`); + return; + } + this.bot.sendMessage(steamID, `✅ Deleted ${name}(${params.assetid})!`); + }); + return; + } } if (params.name !== undefined || params.item !== undefined) { From 4272596e809d130d788c93fb910f00e8333e696c Mon Sep 17 00:00:00 2001 From: idinium96 Date: Sat, 18 Jul 2020 16:44:09 +0800 Subject: [PATCH 15/31] can have both sku and assetid parameters --- src/classes/Commands.ts | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/src/classes/Commands.ts b/src/classes/Commands.ts index 314e08931..420ff1236 100644 --- a/src/classes/Commands.ts +++ b/src/classes/Commands.ts @@ -1594,7 +1594,7 @@ export = class Commands { private deleteCommand(steamID: SteamID, message: string): void { const params = CommandParser.parseParams(CommandParser.removeCommand(message)); - if (params.assetid !== undefined) { + if (params.assetid !== undefined && params.sku === undefined) { const ourInventory = this.bot.inventoryManager.getInventory(); const sku = ourInventory.findByAssetid(params.assetid); @@ -1704,14 +1704,35 @@ export = class Commands { return; } - this.bot.tf2gc.deleteItem(assetids[0], err => { + let assetid: string; + if (params.assetid !== undefined && assetids.includes(params.assetid)) { + assetid = params.assetid; + } else { + assetid = assetids[0]; + } + + this.bot.tf2gc.deleteItem(assetid, err => { if (err) { log.warn(`Error trying to delete ${name}: `, err); - this.bot.sendMessage(steamID, `❌ Failed to delete ${name}(${assetids[0]}): ${err.message}`); + this.bot.sendMessage( + steamID, + `❌ Failed to delete ${name}(${ + assetid === params.assetid + ? assetid + : `assetid ${params.assetid} didn't matched, used a random assetid ${assetids[0]}` + }): ${err.message}` + ); return; } - this.bot.sendMessage(steamID, `✅ Deleted ${name}(${assetids[0]})!`); + this.bot.sendMessage( + steamID, + `✅ Deleted ${name}(${ + assetid === params.assetid + ? assetid + : `assetid ${params.assetid} didn't matched, used a random assetid ${assetids[0]}` + })!` + ); }); } From 0a41762ef89c479e576111a35891449b17d35a9c Mon Sep 17 00:00:00 2001 From: idinium96 Date: Sat, 18 Jul 2020 17:04:12 +0800 Subject: [PATCH 16/31] only delete if sku & assetid entered match. --- src/classes/Commands.ts | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/src/classes/Commands.ts b/src/classes/Commands.ts index 420ff1236..9a6ece8b3 100644 --- a/src/classes/Commands.ts +++ b/src/classes/Commands.ts @@ -1595,6 +1595,7 @@ export = class Commands { const params = CommandParser.parseParams(CommandParser.removeCommand(message)); if (params.assetid !== undefined && params.sku === undefined) { + // This most likely not working with Non-Tradable items. const ourInventory = this.bot.inventoryManager.getInventory(); const sku = ourInventory.findByAssetid(params.assetid); @@ -1705,8 +1706,16 @@ export = class Commands { } let assetid: string; - if (params.assetid !== undefined && assetids.includes(params.assetid)) { - assetid = params.assetid; + if (params.assetid !== undefined) { + if (assetids.includes(params.assetid)) { + assetid = params.assetid; + } else { + this.bot.sendMessage( + steamID, + `❌ Looks like an assetid ${params.assetid} did not matched with any assetids associated with ${name}(${params.sku}) in my inventory. Try only with sku to delete a random assetid.` + ); + return; + } } else { assetid = assetids[0]; } @@ -1714,25 +1723,11 @@ export = class Commands { this.bot.tf2gc.deleteItem(assetid, err => { if (err) { log.warn(`Error trying to delete ${name}: `, err); - this.bot.sendMessage( - steamID, - `❌ Failed to delete ${name}(${ - assetid === params.assetid - ? assetid - : `assetid ${params.assetid} didn't matched, used a random assetid ${assetids[0]}` - }): ${err.message}` - ); + this.bot.sendMessage(steamID, `❌ Failed to delete ${name}(${assetid}): ${err.message}`); return; } - this.bot.sendMessage( - steamID, - `✅ Deleted ${name}(${ - assetid === params.assetid - ? assetid - : `assetid ${params.assetid} didn't matched, used a random assetid ${assetids[0]}` - })!` - ); + this.bot.sendMessage(steamID, `✅ Deleted ${name}(${assetid})!`); }); } From e192e06b57604c932aae4d50ece324b29d7c0c8d Mon Sep 17 00:00:00 2001 From: idinium96 Date: Sat, 18 Jul 2020 17:43:06 +0800 Subject: [PATCH 17/31] option to just decline INVALID_VALUE trades --- src/classes/MyHandler.ts | 15 +++++++++++++++ template.ecosystem.json | 1 + template.env | 1 + 3 files changed, 17 insertions(+) diff --git a/src/classes/MyHandler.ts b/src/classes/MyHandler.ts index 472e131bb..925a32618 100644 --- a/src/classes/MyHandler.ts +++ b/src/classes/MyHandler.ts @@ -1056,6 +1056,19 @@ export = class MyHandler extends Handler { )}` ); return { action: 'accept', reason: 'VALID' }; + } else if ( + // If only INVALID_VALUE and did not matched exception value, will just decline the trade. + process.env.DISABLE_AUTOMATIC_DECLINE_ONLY_INVALID_VALUE_THAT_DID_NOT_MATCHED_EXCEPTION_VALUE_TRADE !== + 'true' && + uniqueReasons.includes('🟥INVALID_VALUE') && + !( + uniqueReasons.includes('🟨INVALID_ITEMS') || + uniqueReasons.includes('🟦OVERSTOCKED') || + uniqueReasons.includes('🟫DUPED_ITEMS') || + uniqueReasons.includes('🟪DUPE_CHECK_FAILED') + ) + ) { + return { action: 'decline', reason: 'ONLY_INVALID_VALUE' }; } else { offer.log('info', `offer needs review (${uniqueReasons.join(', ')}), skipping...`); return { @@ -1105,6 +1118,8 @@ export = class MyHandler extends Handler { reason = 'your offer contains Dueling Mini-Game that are not 5 uses.'; } else if (offerReason.reason === 'NOISE_MAKER_NOT_25_USES') { reason = 'your offer contains Noise Maker that are not 25 uses.'; + } else if (offerReason.reason === 'ONLY_INVALID_VALUE') { + reason = "you've sent a trade with an invalid value (your side and my side did not matched)."; } this.bot.sendMessage( offer.partner, diff --git a/template.ecosystem.json b/template.ecosystem.json index b1ef46be2..a9b9272a3 100644 --- a/template.ecosystem.json +++ b/template.ecosystem.json @@ -118,6 +118,7 @@ "ACCEPT_INVALID_ITEMS_OVERPAY": false, "ACCEPT_OVERSTOCKED_OVERPAY": false, + "DISABLE_AUTOMATIC_DECLINE_ONLY_INVALID_VALUE_THAT_DID_NOT_MATCHED_EXCEPTION_VALUE_TRADE": true, "INVALID_VALUE_EXCEPTION_SKUS": [";5;u", ";11;australium"], "INVALID_VALUE_EXCEPTION_VALUE_IN_REF": 0, diff --git a/template.env b/template.env index 0fcf3fa7a..e5b923ff3 100644 --- a/template.env +++ b/template.env @@ -105,6 +105,7 @@ DISABLE_SHOW_CURRENT_TIME=false ACCEPT_INVALID_ITEMS_OVERPAY=false ACCEPT_OVERSTOCKED_OVERPAY=false +DISABLE_AUTOMATIC_DECLINE_ONLY_INVALID_VALUE_THAT_DID_NOT_MATCHED_EXCEPTION_VALUE_TRADE=true INVALID_VALUE_EXCEPTION_SKUS=[";5;u", ";11;australium"] INVALID_VALUE_EXCEPTION_VALUE_IN_REF=0 From b87850cf174539729054c7c9853e184cf34cc284 Mon Sep 17 00:00:00 2001 From: idinium96 Date: Sat, 18 Jul 2020 17:59:09 +0800 Subject: [PATCH 18/31] add option to automatically decline INVALID_VALUE --- README.md | 1 + src/classes/MyHandler.ts | 3 +-- template.ecosystem.json | 2 +- template.env | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 73fff2e95..718d1ef01 100644 --- a/README.md +++ b/README.md @@ -301,6 +301,7 @@ Time will be use in "!time" command and - `ACCEPT_INVALID_ITEMS_OVERPAY`: [true|false] - Default: false. Set to true if you want your bot to accept a trade with INVALID_ITEMS but with their value more or equal to our value. - `ACCEPT_OVERSTOCKED_OVERPAY`: [true|false] - Default: false. Set to true if you want your bot to accept a trade with OVERSTOCKED but with their value more or equal to our value. +- `DISABLE_AUTOMATIC_DECLINE_ONLY_INVALID_VALUE`: [true|false]: Default: false. Set to true if you want to automatically decline trade with **ONLY** `INVALID_VALUE` and did not match the exception sku(s) and exception value. - `INVALID_VALUE_EXCEPTION_SKUS` [StringArray] - An array of sku that will skip Invalid value if the difference between our and their value is not more than exception value in ref. Let say you want to trade an unusual, but then someone sent an offer with 0.11 ref less, but you want your bot to accept it anyway if it's less than 10 ref, so the trade will be accepted. By default, it will check only for any unusual and australium: `[";5;u", ";11;australium"]`, you can also leave it empty (`[""]`) so all with invalid value will be notified. - `INVALID_VALUE_EXCEPTION_VALUE_IN_REF` [Number] - Exception value for the sku(s) that you set above. Default is `0` (no exception). diff --git a/src/classes/MyHandler.ts b/src/classes/MyHandler.ts index 925a32618..6dcece145 100644 --- a/src/classes/MyHandler.ts +++ b/src/classes/MyHandler.ts @@ -1058,8 +1058,7 @@ export = class MyHandler extends Handler { return { action: 'accept', reason: 'VALID' }; } else if ( // If only INVALID_VALUE and did not matched exception value, will just decline the trade. - process.env.DISABLE_AUTOMATIC_DECLINE_ONLY_INVALID_VALUE_THAT_DID_NOT_MATCHED_EXCEPTION_VALUE_TRADE !== - 'true' && + process.env.DISABLE_AUTOMATIC_DECLINE_ONLY_INVALID_VALUE !== 'true' && uniqueReasons.includes('🟥INVALID_VALUE') && !( uniqueReasons.includes('🟨INVALID_ITEMS') || diff --git a/template.ecosystem.json b/template.ecosystem.json index a9b9272a3..64b194f64 100644 --- a/template.ecosystem.json +++ b/template.ecosystem.json @@ -118,7 +118,7 @@ "ACCEPT_INVALID_ITEMS_OVERPAY": false, "ACCEPT_OVERSTOCKED_OVERPAY": false, - "DISABLE_AUTOMATIC_DECLINE_ONLY_INVALID_VALUE_THAT_DID_NOT_MATCHED_EXCEPTION_VALUE_TRADE": true, + "DISABLE_AUTOMATIC_DECLINE_ONLY_INVALID_VALUE": true, "INVALID_VALUE_EXCEPTION_SKUS": [";5;u", ";11;australium"], "INVALID_VALUE_EXCEPTION_VALUE_IN_REF": 0, diff --git a/template.env b/template.env index e5b923ff3..4de3fa585 100644 --- a/template.env +++ b/template.env @@ -105,7 +105,7 @@ DISABLE_SHOW_CURRENT_TIME=false ACCEPT_INVALID_ITEMS_OVERPAY=false ACCEPT_OVERSTOCKED_OVERPAY=false -DISABLE_AUTOMATIC_DECLINE_ONLY_INVALID_VALUE_THAT_DID_NOT_MATCHED_EXCEPTION_VALUE_TRADE=true +DISABLE_AUTOMATIC_DECLINE_ONLY_INVALID_VALUE=true INVALID_VALUE_EXCEPTION_SKUS=[";5;u", ";11;australium"] INVALID_VALUE_EXCEPTION_VALUE_IN_REF=0 From dfd625ae3e0bbb9a364c509b2a30c24439d8276c Mon Sep 17 00:00:00 2001 From: idinium96 Date: Sat, 18 Jul 2020 18:01:38 +0800 Subject: [PATCH 19/31] change the newly added variables name --- README.md | 4 ++-- src/classes/MyHandler.ts | 6 ++++-- template.ecosystem.json | 4 ++-- template.env | 4 ++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 718d1ef01..990795cd6 100644 --- a/README.md +++ b/README.md @@ -299,8 +299,8 @@ Time will be use in "!time" command and - `DISABLE_REVIEW_OFFER_NOTE`: [true|false] - If set to false, it will show note on [each error](https://github.com/idinium96/tf2autobot/blob/master/src/classes/MyHandler.ts#L1140-L1264) - `DISABLE_SHOW_CURRENT_TIME`: [true|false] - If set to false, it will show owner time on offer review notification that trade partner will received. -- `ACCEPT_INVALID_ITEMS_OVERPAY`: [true|false] - Default: false. Set to true if you want your bot to accept a trade with INVALID_ITEMS but with their value more or equal to our value. -- `ACCEPT_OVERSTOCKED_OVERPAY`: [true|false] - Default: false. Set to true if you want your bot to accept a trade with OVERSTOCKED but with their value more or equal to our value. +- `DISABLE_ACCEPT_INVALID_ITEMS_OVERPAY`: [true|false] - Default: false. Set to true if you want your bot to accept a trade with INVALID_ITEMS but with their value more or equal to our value. +- `DISABLE_ACCEPT_OVERSTOCKED_OVERPAY`: [true|false] - Default: false. Set to true if you want your bot to accept a trade with OVERSTOCKED but with their value more or equal to our value. - `DISABLE_AUTOMATIC_DECLINE_ONLY_INVALID_VALUE`: [true|false]: Default: false. Set to true if you want to automatically decline trade with **ONLY** `INVALID_VALUE` and did not match the exception sku(s) and exception value. - `INVALID_VALUE_EXCEPTION_SKUS` [StringArray] - An array of sku that will skip Invalid value if the difference between our and their value is not more than exception value in ref. Let say you want to trade an unusual, but then someone sent an offer with 0.11 ref less, but you want your bot to accept it anyway if it's less than 10 ref, so the trade will be accepted. By default, it will check only for any unusual and australium: `[";5;u", ";11;australium"]`, you can also leave it empty (`[""]`) so all with invalid value will be notified. diff --git a/src/classes/MyHandler.ts b/src/classes/MyHandler.ts index 6dcece145..83c2625b7 100644 --- a/src/classes/MyHandler.ts +++ b/src/classes/MyHandler.ts @@ -1040,8 +1040,10 @@ export = class MyHandler extends Handler { // } if ( - ((uniqueReasons.includes('🟨INVALID_ITEMS') && process.env.ACCEPT_INVALID_ITEMS_OVERPAY === 'true') || - (uniqueReasons.includes('🟦OVERSTOCKED') && process.env.ACCEPT_OVERSTOCKED_OVERPAY === 'true')) && + ((uniqueReasons.includes('🟨INVALID_ITEMS') && + process.env.DISABLE_ACCEPT_INVALID_ITEMS_OVERPAY !== 'true') || + (uniqueReasons.includes('🟦OVERSTOCKED') && + process.env.DISABLE_ACCEPT_OVERSTOCKED_OVERPAY !== 'true')) && !( uniqueReasons.includes('🟥INVALID_VALUE') || uniqueReasons.includes('🟫DUPED_ITEMS') || diff --git a/template.ecosystem.json b/template.ecosystem.json index 64b194f64..b22177e69 100644 --- a/template.ecosystem.json +++ b/template.ecosystem.json @@ -116,8 +116,8 @@ "DISABLE_REVIEW_OFFER_NOTE": false, "DISABLE_SHOW_CURRENT_TIME": false, - "ACCEPT_INVALID_ITEMS_OVERPAY": false, - "ACCEPT_OVERSTOCKED_OVERPAY": false, + "DISABLE_ACCEPT_INVALID_ITEMS_OVERPAY": false, + "DISABLE_ACCEPT_OVERSTOCKED_OVERPAY": false, "DISABLE_AUTOMATIC_DECLINE_ONLY_INVALID_VALUE": true, "INVALID_VALUE_EXCEPTION_SKUS": [";5;u", ";11;australium"], diff --git a/template.env b/template.env index 4de3fa585..2ff484f6b 100644 --- a/template.env +++ b/template.env @@ -103,8 +103,8 @@ DISABLE_SHOW_REVIEW_OFFER_SUMMARY=false DISABLE_REVIEW_OFFER_NOTE=false DISABLE_SHOW_CURRENT_TIME=false -ACCEPT_INVALID_ITEMS_OVERPAY=false -ACCEPT_OVERSTOCKED_OVERPAY=false +DISABLE_ACCEPT_INVALID_ITEMS_OVERPAY=false +DISABLE_ACCEPT_OVERSTOCKED_OVERPAY=false DISABLE_AUTOMATIC_DECLINE_ONLY_INVALID_VALUE=true INVALID_VALUE_EXCEPTION_SKUS=[";5;u", ";11;australium"] From 1a4da926a49ccebb8ddf2fba1afc0a1cc8bca13b Mon Sep 17 00:00:00 2001 From: idinium96 Date: Sat, 18 Jul 2020 18:56:36 +0800 Subject: [PATCH 20/31] update a variable name --- README.md | 2 +- src/classes/MyHandler.ts | 2 +- template.ecosystem.json | 2 +- template.env | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 990795cd6..b9432835c 100644 --- a/README.md +++ b/README.md @@ -301,7 +301,7 @@ Time will be use in "!time" command and - `DISABLE_ACCEPT_INVALID_ITEMS_OVERPAY`: [true|false] - Default: false. Set to true if you want your bot to accept a trade with INVALID_ITEMS but with their value more or equal to our value. - `DISABLE_ACCEPT_OVERSTOCKED_OVERPAY`: [true|false] - Default: false. Set to true if you want your bot to accept a trade with OVERSTOCKED but with their value more or equal to our value. -- `DISABLE_AUTOMATIC_DECLINE_ONLY_INVALID_VALUE`: [true|false]: Default: false. Set to true if you want to automatically decline trade with **ONLY** `INVALID_VALUE` and did not match the exception sku(s) and exception value. +- `DISABLE_AUTO_DECLINE_INVALID_VALUE`: [true|false]: Default: false. Set to true if you want to automatically decline trade with **ONLY** `INVALID_VALUE` and did not match the exception sku(s) and exception value. - `INVALID_VALUE_EXCEPTION_SKUS` [StringArray] - An array of sku that will skip Invalid value if the difference between our and their value is not more than exception value in ref. Let say you want to trade an unusual, but then someone sent an offer with 0.11 ref less, but you want your bot to accept it anyway if it's less than 10 ref, so the trade will be accepted. By default, it will check only for any unusual and australium: `[";5;u", ";11;australium"]`, you can also leave it empty (`[""]`) so all with invalid value will be notified. - `INVALID_VALUE_EXCEPTION_VALUE_IN_REF` [Number] - Exception value for the sku(s) that you set above. Default is `0` (no exception). diff --git a/src/classes/MyHandler.ts b/src/classes/MyHandler.ts index 83c2625b7..97fce415a 100644 --- a/src/classes/MyHandler.ts +++ b/src/classes/MyHandler.ts @@ -1060,7 +1060,7 @@ export = class MyHandler extends Handler { return { action: 'accept', reason: 'VALID' }; } else if ( // If only INVALID_VALUE and did not matched exception value, will just decline the trade. - process.env.DISABLE_AUTOMATIC_DECLINE_ONLY_INVALID_VALUE !== 'true' && + process.env.DISABLE_AUTO_DECLINE_INVALID_VALUE !== 'true' && uniqueReasons.includes('🟥INVALID_VALUE') && !( uniqueReasons.includes('🟨INVALID_ITEMS') || diff --git a/template.ecosystem.json b/template.ecosystem.json index b22177e69..079c1a393 100644 --- a/template.ecosystem.json +++ b/template.ecosystem.json @@ -118,7 +118,7 @@ "DISABLE_ACCEPT_INVALID_ITEMS_OVERPAY": false, "DISABLE_ACCEPT_OVERSTOCKED_OVERPAY": false, - "DISABLE_AUTOMATIC_DECLINE_ONLY_INVALID_VALUE": true, + "DISABLE_AUTO_DECLINE_INVALID_VALUE": true, "INVALID_VALUE_EXCEPTION_SKUS": [";5;u", ";11;australium"], "INVALID_VALUE_EXCEPTION_VALUE_IN_REF": 0, diff --git a/template.env b/template.env index 2ff484f6b..a814db652 100644 --- a/template.env +++ b/template.env @@ -105,7 +105,7 @@ DISABLE_SHOW_CURRENT_TIME=false DISABLE_ACCEPT_INVALID_ITEMS_OVERPAY=false DISABLE_ACCEPT_OVERSTOCKED_OVERPAY=false -DISABLE_AUTOMATIC_DECLINE_ONLY_INVALID_VALUE=true +DISABLE_AUTO_DECLINE_INVALID_VALUE=true INVALID_VALUE_EXCEPTION_SKUS=[";5;u", ";11;australium"] INVALID_VALUE_EXCEPTION_VALUE_IN_REF=0 From dd73aa1b738be97474cd0cba583fe634721fcd5e Mon Sep 17 00:00:00 2001 From: idinium96 Date: Sat, 18 Jul 2020 19:18:52 +0800 Subject: [PATCH 21/31] add a missing invalid_value exception condition --- src/classes/MyHandler.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/classes/MyHandler.ts b/src/classes/MyHandler.ts index 97fce415a..c4f338e85 100644 --- a/src/classes/MyHandler.ts +++ b/src/classes/MyHandler.ts @@ -89,6 +89,8 @@ export = class MyHandler extends Handler { private autoRelistNotBuyingKeys = 0; + private hasInvalidValueException = false; + private customGameName: string; recentlySentMessage: UnknownDictionary = {}; @@ -870,6 +872,7 @@ export = class MyHandler extends Handler { const exceptionValue = this.invalidValueException; let hasInvalidValue = false; + this.hasInvalidValueException = false; if (exchange.our.value > exchange.their.value) { if (!isExcept || (isExcept && exchange.our.value - exchange.their.value >= exceptionValue)) { // Check if the values are correct and is not include the exception sku @@ -888,6 +891,7 @@ export = class MyHandler extends Handler { exceptionValue )} ref. Accepting/checking for other reasons...` ); + this.hasInvalidValueException = true; } } @@ -1067,7 +1071,8 @@ export = class MyHandler extends Handler { uniqueReasons.includes('🟦OVERSTOCKED') || uniqueReasons.includes('🟫DUPED_ITEMS') || uniqueReasons.includes('🟪DUPE_CHECK_FAILED') - ) + ) && + this.hasInvalidValueException === false ) { return { action: 'decline', reason: 'ONLY_INVALID_VALUE' }; } else { From 069da3ec25ed210c6bd89d5a7a3b162ac1a6ce1d Mon Sep 17 00:00:00 2001 From: idinium96 Date: Sat, 18 Jul 2020 19:23:41 +0800 Subject: [PATCH 22/31] fix wrong position --- src/classes/MyHandler.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/classes/MyHandler.ts b/src/classes/MyHandler.ts index c4f338e85..2d0899b0b 100644 --- a/src/classes/MyHandler.ts +++ b/src/classes/MyHandler.ts @@ -872,12 +872,12 @@ export = class MyHandler extends Handler { const exceptionValue = this.invalidValueException; let hasInvalidValue = false; - this.hasInvalidValueException = false; if (exchange.our.value > exchange.their.value) { if (!isExcept || (isExcept && exchange.our.value - exchange.their.value >= exceptionValue)) { // Check if the values are correct and is not include the exception sku // OR include the exception sku but the invalid value is more than or equal to exception value hasInvalidValue = true; + this.hasInvalidValueException = false; wrongAboutOffer.push({ reason: '🟥INVALID_VALUE', our: exchange.our.value, From c549b66d2da57e57e34f31140be474fdc91d157e Mon Sep 17 00:00:00 2001 From: idinium96 Date: Sat, 18 Jul 2020 19:30:20 +0800 Subject: [PATCH 23/31] fix not matched with README --- template.ecosystem.json | 2 +- template.env | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/template.ecosystem.json b/template.ecosystem.json index 079c1a393..ad0fde80a 100644 --- a/template.ecosystem.json +++ b/template.ecosystem.json @@ -118,7 +118,7 @@ "DISABLE_ACCEPT_INVALID_ITEMS_OVERPAY": false, "DISABLE_ACCEPT_OVERSTOCKED_OVERPAY": false, - "DISABLE_AUTO_DECLINE_INVALID_VALUE": true, + "DISABLE_AUTO_DECLINE_INVALID_VALUE": false, "INVALID_VALUE_EXCEPTION_SKUS": [";5;u", ";11;australium"], "INVALID_VALUE_EXCEPTION_VALUE_IN_REF": 0, diff --git a/template.env b/template.env index a814db652..8c4bcd2de 100644 --- a/template.env +++ b/template.env @@ -105,7 +105,7 @@ DISABLE_SHOW_CURRENT_TIME=false DISABLE_ACCEPT_INVALID_ITEMS_OVERPAY=false DISABLE_ACCEPT_OVERSTOCKED_OVERPAY=false -DISABLE_AUTO_DECLINE_INVALID_VALUE=true +DISABLE_AUTO_DECLINE_INVALID_VALUE=false INVALID_VALUE_EXCEPTION_SKUS=[";5;u", ";11;australium"] INVALID_VALUE_EXCEPTION_VALUE_IN_REF=0 From b944df519b59886e2f177612d88ce4a921201954 Mon Sep 17 00:00:00 2001 From: idinium96 Date: Sat, 18 Jul 2020 19:33:38 +0800 Subject: [PATCH 24/31] add ecosystem.json templates for multiple bots --- template-three-bots.ecosystem.json | 430 +++++++++++++++++++++++++++++ template-two-bots.ecosystem.json | 288 +++++++++++++++++++ template.ecosystem.json | 2 +- 3 files changed, 719 insertions(+), 1 deletion(-) create mode 100644 template-three-bots.ecosystem.json create mode 100644 template-two-bots.ecosystem.json diff --git a/template-three-bots.ecosystem.json b/template-three-bots.ecosystem.json new file mode 100644 index 000000000..3b2f028b4 --- /dev/null +++ b/template-three-bots.ecosystem.json @@ -0,0 +1,430 @@ +{ + "apps": [ + { + "name": "tf2autobot-1", + "script": "dist/app.js", + "exec_mode": "fork", + "exp_backoff_restart_delay": 1000, + "shutdown_with_message": false, + "kill_timeout": 30000, + "out_file": "NULL", + "error_file": "NULL", + "env": { + "NODE_ENV": "production", + + "STEAM_ACCOUNT_NAME": "", + "STEAM_PASSWORD": "", + "STEAM_SHARED_SECRET": "", + "STEAM_IDENTITY_SECRET": "", + + "PRICESTF_API_TOKEN": "", + "BPTF_ACCESS_TOKEN": "", + "BPTF_API_KEY": "", + + "AUTOBUMP": true, + + "MINIMUM_SCRAP": 9, + "MINIMUM_RECLAIMED": 9, + "METAL_THRESHOLD": 9, + + "ENABLE_AUTO_SELL_AND_BUY_KEYS": false, + "ENABLE_AUTO_KEY_BANKING": false, + "MINIMUM_KEYS": 3, + "MAXIMUM_KEYS": 15, + "MINIMUM_REFINED_TO_START_SELL_KEYS": 30, + "MAXIMUM_REFINED_TO_STOP_SELL_KEYS": 150, + + "DISABLE_INVENTORY_SORT": false, + "DISABLE_LISTINGS": false, + "DISABLE_CRAFTING": false, + "DISABLE_CRAFTING_WEAPONS": false, + "DISABLE_MESSAGES": false, + "DISABLE_SOMETHING_WRONG_ALERT": false, + "DISABLE_CRAFTWEAPON_AS_CURRENCY": false, + "DISABLE_ADD_FRIENDS": false, + "DISABLE_CHECK_USES_DUELING_MINI_GAME": false, + "DISABLE_CHECK_USES_NOISE_MAKER": false, + + "TRADES_MADE_STARTER_VALUE": 0, + "LAST_TOTAL_TRADES": 0, + "TRADING_STARTING_TIME_UNIX": 0, + + "ENABLE_SHOW_ONLY_METAL": true, + "ENABLE_DUPE_CHECK": true, + "DECLINE_DUPES": false, + "MINIMUM_KEYS_DUPE_CHECK": 10, + + "SKIP_BPTF_TRADEOFFERURL": true, + "SKIP_ACCOUNT_LIMITATIONS": true, + "SKIP_UPDATE_PROFILE_SETTINGS": true, + + "TIMEZONE": "", + "CUSTOM_TIME_FORMAT": "", + "TIME_ADDITIONAL_NOTES": "", + + "ALLOW_ESCROW": false, + "ALLOW_OVERPAY": true, + "ALLOW_BANNED": false, + "MAX_PRICE_AGE": 28800, + + "ADMINS": [""], + "KEEP": [""], + "GROUPS": ["103582791464047777", "103582791462300957"], + "ALERTS": ["trade"], + + "DEBUG": true, + "DEBUG_FILE": true, + + "BPTF_DETAILS_BUY": "I am buying your %name% for %price%, I have %current_stock% / %max_stock%. %keyPrice%.", + "BPTF_DETAILS_SELL": "I am selling my %name% for %price%, I am selling %amount_trade%. %keyPrice%", + "OFFER_MESSAGE": "", + + "DISCORD_OWNER_ID": "", + "DISCORD_WEBHOOK_USERNAME": "", + "DISCORD_WEBHOOK_AVATAR_URL": "", + "DISCORD_WEBHOOK_EMBED_COLOR_IN_DECIMAL_INDEX": "9171753", + + "DISABLE_DISCORD_WEBHOOK_SOMETHING_WRONG_ALERT": false, + "DISCORD_WEBHOOK_SOMETHING_WRONG_ALERT_URL": "", + + "DISABLE_DISCORD_WEBHOOK_PRICE_UPDATE": false, + "DISCORD_WEBHOOK_PRICE_UPDATE_URL": "", + "DISCORD_WEBHOOK_PRICE_UPDATE_ADDITIONAL_DESCRIPTION_NOTE": "", + + "DISABLE_DISCORD_WEBHOOK_TRADE_SUMMARY": false, + "DISCORD_WEBHOOK_TRADE_SUMMARY_URL": "", + "DISCORD_WEBHOOK_TRADE_SUMMARY_SHOW_QUICK_LINKS": true, + "DISCORD_WEBHOOK_TRADE_SUMMARY_SHOW_KEY_RATE": true, + "DISCORD_WEBHOOK_TRADE_SUMMARY_SHOW_PURE_STOCK": true, + "DISCORD_WEBHOOK_TRADE_SUMMARY_ADDITIONAL_DESCRIPTION_NOTE": "", + "DISCORD_WEBHOOK_TRADE_SUMMARY_MENTION_OWNER": false, + "DISCORD_WEBHOOK_TRADE_SUMMARY_MENTION_OWNER_ONLY_ITEMS_SKU": [";"], + + "DISABLE_DISCORD_WEBHOOK_OFFER_REVIEW": false, + "DISCORD_WEBHOOK_REVIEW_OFFER_URL": "", + "DISCORD_WEBHOOK_REVIEW_OFFER_DISABLE_MENTION_INVALID_VALUE": false, + "DISCORD_WEBHOOK_REVIEW_OFFER_SHOW_QUICK_LINKS": true, + "DISCORD_WEBHOOK_REVIEW_OFFER_SHOW_KEY_RATE": true, + "DISCORD_WEBHOOK_REVIEW_OFFER_SHOW_PURE_STOCK": true, + + "DISABLE_DISCORD_WEBHOOK_MESSAGE_FROM_PARTNER": false, + "DISCORD_WEBHOOK_MESSAGE_FROM_PARTNER_URL": "", + "DISCORD_WEBHOOK_MESSAGE_FROM_PARTNER_SHOW_QUICK_LINKS": true, + + "ENABLE_MANUAL_REVIEW": true, + "DISABLE_SHOW_REVIEW_OFFER_SUMMARY": false, + "DISABLE_REVIEW_OFFER_NOTE": false, + "DISABLE_SHOW_CURRENT_TIME": false, + + "DISABLE_ACCEPT_INVALID_ITEMS_OVERPAY": false, + "DISABLE_ACCEPT_OVERSTOCKED_OVERPAY": false, + "DISABLE_AUTO_DECLINE_INVALID_VALUE": false, + + "INVALID_VALUE_EXCEPTION_SKUS": [";5;u", ";11;australium"], + "INVALID_VALUE_EXCEPTION_VALUE_IN_REF": 0, + + "INVALID_VALUE_NOTE": "", + "INVALID_ITEMS_NOTE": "", + "OVERSTOCKED_NOTE": "", + "DUPE_ITEMS_NOTE": "", + "DUPE_CHECK_FAILED_NOTE": "", + "ADDITIONAL_NOTE": "", + + "CUSTOM_PLAYING_GAME_NAME": "tf2-automatic", + + "CUSTOM_WELCOME_MESSAGE": "", + "CUSTOM_I_DONT_KNOW_WHAT_YOU_MEAN": "", + "CUSTOM_HOW2TRADE_MESSAGE": "", + + "CUSTOM_SUCCESS_MESSAGE": "", + "CUSTOM_DECLINED_MESSAGE": "", + "CUSTOM_TRADED_AWAY_MESSAGE": "", + "CUSTOM_CLEARING_FRIENDS_MESSAGE": "" + } + }, + { + "name": "tf2autobot-2", + "script": "dist/app.js", + "exec_mode": "fork", + "exp_backoff_restart_delay": 1000, + "shutdown_with_message": false, + "kill_timeout": 30000, + "out_file": "NULL", + "error_file": "NULL", + "env": { + "NODE_ENV": "production", + + "STEAM_ACCOUNT_NAME": "", + "STEAM_PASSWORD": "", + "STEAM_SHARED_SECRET": "", + "STEAM_IDENTITY_SECRET": "", + + "PRICESTF_API_TOKEN": "", + "BPTF_ACCESS_TOKEN": "", + "BPTF_API_KEY": "", + + "AUTOBUMP": true, + + "MINIMUM_SCRAP": 9, + "MINIMUM_RECLAIMED": 9, + "METAL_THRESHOLD": 9, + + "ENABLE_AUTO_SELL_AND_BUY_KEYS": false, + "ENABLE_AUTO_KEY_BANKING": false, + "MINIMUM_KEYS": 3, + "MAXIMUM_KEYS": 15, + "MINIMUM_REFINED_TO_START_SELL_KEYS": 30, + "MAXIMUM_REFINED_TO_STOP_SELL_KEYS": 150, + + "DISABLE_INVENTORY_SORT": false, + "DISABLE_LISTINGS": false, + "DISABLE_CRAFTING": false, + "DISABLE_CRAFTING_WEAPONS": false, + "DISABLE_MESSAGES": false, + "DISABLE_SOMETHING_WRONG_ALERT": false, + "DISABLE_CRAFTWEAPON_AS_CURRENCY": false, + "DISABLE_ADD_FRIENDS": false, + "DISABLE_CHECK_USES_DUELING_MINI_GAME": false, + "DISABLE_CHECK_USES_NOISE_MAKER": false, + + "TRADES_MADE_STARTER_VALUE": 0, + "LAST_TOTAL_TRADES": 0, + "TRADING_STARTING_TIME_UNIX": 0, + + "ENABLE_SHOW_ONLY_METAL": true, + "ENABLE_DUPE_CHECK": true, + "DECLINE_DUPES": false, + "MINIMUM_KEYS_DUPE_CHECK": 10, + + "SKIP_BPTF_TRADEOFFERURL": true, + "SKIP_ACCOUNT_LIMITATIONS": true, + "SKIP_UPDATE_PROFILE_SETTINGS": true, + + "TIMEZONE": "", + "CUSTOM_TIME_FORMAT": "", + "TIME_ADDITIONAL_NOTES": "", + + "ALLOW_ESCROW": false, + "ALLOW_OVERPAY": true, + "ALLOW_BANNED": false, + "MAX_PRICE_AGE": 28800, + + "ADMINS": [""], + "KEEP": [""], + "GROUPS": ["103582791464047777", "103582791462300957"], + "ALERTS": ["trade"], + + "DEBUG": true, + "DEBUG_FILE": true, + + "BPTF_DETAILS_BUY": "I am buying your %name% for %price%, I have %current_stock% / %max_stock%. %keyPrice%.", + "BPTF_DETAILS_SELL": "I am selling my %name% for %price%, I am selling %amount_trade%. %keyPrice%", + "OFFER_MESSAGE": "", + + "DISCORD_OWNER_ID": "", + "DISCORD_WEBHOOK_USERNAME": "", + "DISCORD_WEBHOOK_AVATAR_URL": "", + "DISCORD_WEBHOOK_EMBED_COLOR_IN_DECIMAL_INDEX": "9171753", + + "DISABLE_DISCORD_WEBHOOK_SOMETHING_WRONG_ALERT": false, + "DISCORD_WEBHOOK_SOMETHING_WRONG_ALERT_URL": "", + + "DISABLE_DISCORD_WEBHOOK_PRICE_UPDATE": false, + "DISCORD_WEBHOOK_PRICE_UPDATE_URL": "", + "DISCORD_WEBHOOK_PRICE_UPDATE_ADDITIONAL_DESCRIPTION_NOTE": "", + + "DISABLE_DISCORD_WEBHOOK_TRADE_SUMMARY": false, + "DISCORD_WEBHOOK_TRADE_SUMMARY_URL": "", + "DISCORD_WEBHOOK_TRADE_SUMMARY_SHOW_QUICK_LINKS": true, + "DISCORD_WEBHOOK_TRADE_SUMMARY_SHOW_KEY_RATE": true, + "DISCORD_WEBHOOK_TRADE_SUMMARY_SHOW_PURE_STOCK": true, + "DISCORD_WEBHOOK_TRADE_SUMMARY_ADDITIONAL_DESCRIPTION_NOTE": "", + "DISCORD_WEBHOOK_TRADE_SUMMARY_MENTION_OWNER": false, + "DISCORD_WEBHOOK_TRADE_SUMMARY_MENTION_OWNER_ONLY_ITEMS_SKU": [";"], + + "DISABLE_DISCORD_WEBHOOK_OFFER_REVIEW": false, + "DISCORD_WEBHOOK_REVIEW_OFFER_URL": "", + "DISCORD_WEBHOOK_REVIEW_OFFER_DISABLE_MENTION_INVALID_VALUE": false, + "DISCORD_WEBHOOK_REVIEW_OFFER_SHOW_QUICK_LINKS": true, + "DISCORD_WEBHOOK_REVIEW_OFFER_SHOW_KEY_RATE": true, + "DISCORD_WEBHOOK_REVIEW_OFFER_SHOW_PURE_STOCK": true, + + "DISABLE_DISCORD_WEBHOOK_MESSAGE_FROM_PARTNER": false, + "DISCORD_WEBHOOK_MESSAGE_FROM_PARTNER_URL": "", + "DISCORD_WEBHOOK_MESSAGE_FROM_PARTNER_SHOW_QUICK_LINKS": true, + + "ENABLE_MANUAL_REVIEW": true, + "DISABLE_SHOW_REVIEW_OFFER_SUMMARY": false, + "DISABLE_REVIEW_OFFER_NOTE": false, + "DISABLE_SHOW_CURRENT_TIME": false, + + "DISABLE_ACCEPT_INVALID_ITEMS_OVERPAY": false, + "DISABLE_ACCEPT_OVERSTOCKED_OVERPAY": false, + "DISABLE_AUTO_DECLINE_INVALID_VALUE": false, + + "INVALID_VALUE_EXCEPTION_SKUS": [";5;u", ";11;australium"], + "INVALID_VALUE_EXCEPTION_VALUE_IN_REF": 0, + + "INVALID_VALUE_NOTE": "", + "INVALID_ITEMS_NOTE": "", + "OVERSTOCKED_NOTE": "", + "DUPE_ITEMS_NOTE": "", + "DUPE_CHECK_FAILED_NOTE": "", + "ADDITIONAL_NOTE": "", + + "CUSTOM_PLAYING_GAME_NAME": "tf2-automatic", + + "CUSTOM_WELCOME_MESSAGE": "", + "CUSTOM_I_DONT_KNOW_WHAT_YOU_MEAN": "", + "CUSTOM_HOW2TRADE_MESSAGE": "", + + "CUSTOM_SUCCESS_MESSAGE": "", + "CUSTOM_DECLINED_MESSAGE": "", + "CUSTOM_TRADED_AWAY_MESSAGE": "", + "CUSTOM_CLEARING_FRIENDS_MESSAGE": "" + } + }, + { + "name": "tf2autobot-3", + "script": "dist/app.js", + "exec_mode": "fork", + "exp_backoff_restart_delay": 1000, + "shutdown_with_message": false, + "kill_timeout": 30000, + "out_file": "NULL", + "error_file": "NULL", + "env": { + "NODE_ENV": "production", + + "STEAM_ACCOUNT_NAME": "", + "STEAM_PASSWORD": "", + "STEAM_SHARED_SECRET": "", + "STEAM_IDENTITY_SECRET": "", + + "PRICESTF_API_TOKEN": "", + "BPTF_ACCESS_TOKEN": "", + "BPTF_API_KEY": "", + + "AUTOBUMP": true, + + "MINIMUM_SCRAP": 9, + "MINIMUM_RECLAIMED": 9, + "METAL_THRESHOLD": 9, + + "ENABLE_AUTO_SELL_AND_BUY_KEYS": false, + "ENABLE_AUTO_KEY_BANKING": false, + "MINIMUM_KEYS": 3, + "MAXIMUM_KEYS": 15, + "MINIMUM_REFINED_TO_START_SELL_KEYS": 30, + "MAXIMUM_REFINED_TO_STOP_SELL_KEYS": 150, + + "DISABLE_INVENTORY_SORT": false, + "DISABLE_LISTINGS": false, + "DISABLE_CRAFTING": false, + "DISABLE_CRAFTING_WEAPONS": false, + "DISABLE_MESSAGES": false, + "DISABLE_SOMETHING_WRONG_ALERT": false, + "DISABLE_CRAFTWEAPON_AS_CURRENCY": false, + "DISABLE_ADD_FRIENDS": false, + "DISABLE_CHECK_USES_DUELING_MINI_GAME": false, + "DISABLE_CHECK_USES_NOISE_MAKER": false, + + "TRADES_MADE_STARTER_VALUE": 0, + "LAST_TOTAL_TRADES": 0, + "TRADING_STARTING_TIME_UNIX": 0, + + "ENABLE_SHOW_ONLY_METAL": true, + "ENABLE_DUPE_CHECK": true, + "DECLINE_DUPES": false, + "MINIMUM_KEYS_DUPE_CHECK": 10, + + "SKIP_BPTF_TRADEOFFERURL": true, + "SKIP_ACCOUNT_LIMITATIONS": true, + "SKIP_UPDATE_PROFILE_SETTINGS": true, + + "TIMEZONE": "", + "CUSTOM_TIME_FORMAT": "", + "TIME_ADDITIONAL_NOTES": "", + + "ALLOW_ESCROW": false, + "ALLOW_OVERPAY": true, + "ALLOW_BANNED": false, + "MAX_PRICE_AGE": 28800, + + "ADMINS": [""], + "KEEP": [""], + "GROUPS": ["103582791464047777", "103582791462300957"], + "ALERTS": ["trade"], + + "DEBUG": true, + "DEBUG_FILE": true, + + "BPTF_DETAILS_BUY": "I am buying your %name% for %price%, I have %current_stock% / %max_stock%. %keyPrice%.", + "BPTF_DETAILS_SELL": "I am selling my %name% for %price%, I am selling %amount_trade%. %keyPrice%", + "OFFER_MESSAGE": "", + + "DISCORD_OWNER_ID": "", + "DISCORD_WEBHOOK_USERNAME": "", + "DISCORD_WEBHOOK_AVATAR_URL": "", + "DISCORD_WEBHOOK_EMBED_COLOR_IN_DECIMAL_INDEX": "9171753", + + "DISABLE_DISCORD_WEBHOOK_SOMETHING_WRONG_ALERT": false, + "DISCORD_WEBHOOK_SOMETHING_WRONG_ALERT_URL": "", + + "DISABLE_DISCORD_WEBHOOK_PRICE_UPDATE": false, + "DISCORD_WEBHOOK_PRICE_UPDATE_URL": "", + "DISCORD_WEBHOOK_PRICE_UPDATE_ADDITIONAL_DESCRIPTION_NOTE": "", + + "DISABLE_DISCORD_WEBHOOK_TRADE_SUMMARY": false, + "DISCORD_WEBHOOK_TRADE_SUMMARY_URL": "", + "DISCORD_WEBHOOK_TRADE_SUMMARY_SHOW_QUICK_LINKS": true, + "DISCORD_WEBHOOK_TRADE_SUMMARY_SHOW_KEY_RATE": true, + "DISCORD_WEBHOOK_TRADE_SUMMARY_SHOW_PURE_STOCK": true, + "DISCORD_WEBHOOK_TRADE_SUMMARY_ADDITIONAL_DESCRIPTION_NOTE": "", + "DISCORD_WEBHOOK_TRADE_SUMMARY_MENTION_OWNER": false, + "DISCORD_WEBHOOK_TRADE_SUMMARY_MENTION_OWNER_ONLY_ITEMS_SKU": [";"], + + "DISABLE_DISCORD_WEBHOOK_OFFER_REVIEW": false, + "DISCORD_WEBHOOK_REVIEW_OFFER_URL": "", + "DISCORD_WEBHOOK_REVIEW_OFFER_DISABLE_MENTION_INVALID_VALUE": false, + "DISCORD_WEBHOOK_REVIEW_OFFER_SHOW_QUICK_LINKS": true, + "DISCORD_WEBHOOK_REVIEW_OFFER_SHOW_KEY_RATE": true, + "DISCORD_WEBHOOK_REVIEW_OFFER_SHOW_PURE_STOCK": true, + + "DISABLE_DISCORD_WEBHOOK_MESSAGE_FROM_PARTNER": false, + "DISCORD_WEBHOOK_MESSAGE_FROM_PARTNER_URL": "", + "DISCORD_WEBHOOK_MESSAGE_FROM_PARTNER_SHOW_QUICK_LINKS": true, + + "ENABLE_MANUAL_REVIEW": true, + "DISABLE_SHOW_REVIEW_OFFER_SUMMARY": false, + "DISABLE_REVIEW_OFFER_NOTE": false, + "DISABLE_SHOW_CURRENT_TIME": false, + + "DISABLE_ACCEPT_INVALID_ITEMS_OVERPAY": false, + "DISABLE_ACCEPT_OVERSTOCKED_OVERPAY": false, + "DISABLE_AUTO_DECLINE_INVALID_VALUE": false, + + "INVALID_VALUE_EXCEPTION_SKUS": [";5;u", ";11;australium"], + "INVALID_VALUE_EXCEPTION_VALUE_IN_REF": 0, + + "INVALID_VALUE_NOTE": "", + "INVALID_ITEMS_NOTE": "", + "OVERSTOCKED_NOTE": "", + "DUPE_ITEMS_NOTE": "", + "DUPE_CHECK_FAILED_NOTE": "", + "ADDITIONAL_NOTE": "", + + "CUSTOM_PLAYING_GAME_NAME": "tf2-automatic", + + "CUSTOM_WELCOME_MESSAGE": "", + "CUSTOM_I_DONT_KNOW_WHAT_YOU_MEAN": "", + "CUSTOM_HOW2TRADE_MESSAGE": "", + + "CUSTOM_SUCCESS_MESSAGE": "", + "CUSTOM_DECLINED_MESSAGE": "", + "CUSTOM_TRADED_AWAY_MESSAGE": "", + "CUSTOM_CLEARING_FRIENDS_MESSAGE": "" + } + } + ] +} diff --git a/template-two-bots.ecosystem.json b/template-two-bots.ecosystem.json new file mode 100644 index 000000000..30a5fe22a --- /dev/null +++ b/template-two-bots.ecosystem.json @@ -0,0 +1,288 @@ +{ + "apps": [ + { + "name": "tf2autobot-1", + "script": "dist/app.js", + "exec_mode": "fork", + "exp_backoff_restart_delay": 1000, + "shutdown_with_message": false, + "kill_timeout": 30000, + "out_file": "NULL", + "error_file": "NULL", + "env": { + "NODE_ENV": "production", + + "STEAM_ACCOUNT_NAME": "", + "STEAM_PASSWORD": "", + "STEAM_SHARED_SECRET": "", + "STEAM_IDENTITY_SECRET": "", + + "PRICESTF_API_TOKEN": "", + "BPTF_ACCESS_TOKEN": "", + "BPTF_API_KEY": "", + + "AUTOBUMP": true, + + "MINIMUM_SCRAP": 9, + "MINIMUM_RECLAIMED": 9, + "METAL_THRESHOLD": 9, + + "ENABLE_AUTO_SELL_AND_BUY_KEYS": false, + "ENABLE_AUTO_KEY_BANKING": false, + "MINIMUM_KEYS": 3, + "MAXIMUM_KEYS": 15, + "MINIMUM_REFINED_TO_START_SELL_KEYS": 30, + "MAXIMUM_REFINED_TO_STOP_SELL_KEYS": 150, + + "DISABLE_INVENTORY_SORT": false, + "DISABLE_LISTINGS": false, + "DISABLE_CRAFTING": false, + "DISABLE_CRAFTING_WEAPONS": false, + "DISABLE_MESSAGES": false, + "DISABLE_SOMETHING_WRONG_ALERT": false, + "DISABLE_CRAFTWEAPON_AS_CURRENCY": false, + "DISABLE_ADD_FRIENDS": false, + "DISABLE_CHECK_USES_DUELING_MINI_GAME": false, + "DISABLE_CHECK_USES_NOISE_MAKER": false, + + "TRADES_MADE_STARTER_VALUE": 0, + "LAST_TOTAL_TRADES": 0, + "TRADING_STARTING_TIME_UNIX": 0, + + "ENABLE_SHOW_ONLY_METAL": true, + "ENABLE_DUPE_CHECK": true, + "DECLINE_DUPES": false, + "MINIMUM_KEYS_DUPE_CHECK": 10, + + "SKIP_BPTF_TRADEOFFERURL": true, + "SKIP_ACCOUNT_LIMITATIONS": true, + "SKIP_UPDATE_PROFILE_SETTINGS": true, + + "TIMEZONE": "", + "CUSTOM_TIME_FORMAT": "", + "TIME_ADDITIONAL_NOTES": "", + + "ALLOW_ESCROW": false, + "ALLOW_OVERPAY": true, + "ALLOW_BANNED": false, + "MAX_PRICE_AGE": 28800, + + "ADMINS": [""], + "KEEP": [""], + "GROUPS": ["103582791464047777", "103582791462300957"], + "ALERTS": ["trade"], + + "DEBUG": true, + "DEBUG_FILE": true, + + "BPTF_DETAILS_BUY": "I am buying your %name% for %price%, I have %current_stock% / %max_stock%. %keyPrice%.", + "BPTF_DETAILS_SELL": "I am selling my %name% for %price%, I am selling %amount_trade%. %keyPrice%", + "OFFER_MESSAGE": "", + + "DISCORD_OWNER_ID": "", + "DISCORD_WEBHOOK_USERNAME": "", + "DISCORD_WEBHOOK_AVATAR_URL": "", + "DISCORD_WEBHOOK_EMBED_COLOR_IN_DECIMAL_INDEX": "9171753", + + "DISABLE_DISCORD_WEBHOOK_SOMETHING_WRONG_ALERT": false, + "DISCORD_WEBHOOK_SOMETHING_WRONG_ALERT_URL": "", + + "DISABLE_DISCORD_WEBHOOK_PRICE_UPDATE": false, + "DISCORD_WEBHOOK_PRICE_UPDATE_URL": "", + "DISCORD_WEBHOOK_PRICE_UPDATE_ADDITIONAL_DESCRIPTION_NOTE": "", + + "DISABLE_DISCORD_WEBHOOK_TRADE_SUMMARY": false, + "DISCORD_WEBHOOK_TRADE_SUMMARY_URL": "", + "DISCORD_WEBHOOK_TRADE_SUMMARY_SHOW_QUICK_LINKS": true, + "DISCORD_WEBHOOK_TRADE_SUMMARY_SHOW_KEY_RATE": true, + "DISCORD_WEBHOOK_TRADE_SUMMARY_SHOW_PURE_STOCK": true, + "DISCORD_WEBHOOK_TRADE_SUMMARY_ADDITIONAL_DESCRIPTION_NOTE": "", + "DISCORD_WEBHOOK_TRADE_SUMMARY_MENTION_OWNER": false, + "DISCORD_WEBHOOK_TRADE_SUMMARY_MENTION_OWNER_ONLY_ITEMS_SKU": [";"], + + "DISABLE_DISCORD_WEBHOOK_OFFER_REVIEW": false, + "DISCORD_WEBHOOK_REVIEW_OFFER_URL": "", + "DISCORD_WEBHOOK_REVIEW_OFFER_DISABLE_MENTION_INVALID_VALUE": false, + "DISCORD_WEBHOOK_REVIEW_OFFER_SHOW_QUICK_LINKS": true, + "DISCORD_WEBHOOK_REVIEW_OFFER_SHOW_KEY_RATE": true, + "DISCORD_WEBHOOK_REVIEW_OFFER_SHOW_PURE_STOCK": true, + + "DISABLE_DISCORD_WEBHOOK_MESSAGE_FROM_PARTNER": false, + "DISCORD_WEBHOOK_MESSAGE_FROM_PARTNER_URL": "", + "DISCORD_WEBHOOK_MESSAGE_FROM_PARTNER_SHOW_QUICK_LINKS": true, + + "ENABLE_MANUAL_REVIEW": true, + "DISABLE_SHOW_REVIEW_OFFER_SUMMARY": false, + "DISABLE_REVIEW_OFFER_NOTE": false, + "DISABLE_SHOW_CURRENT_TIME": false, + + "DISABLE_ACCEPT_INVALID_ITEMS_OVERPAY": false, + "DISABLE_ACCEPT_OVERSTOCKED_OVERPAY": false, + "DISABLE_AUTO_DECLINE_INVALID_VALUE": false, + + "INVALID_VALUE_EXCEPTION_SKUS": [";5;u", ";11;australium"], + "INVALID_VALUE_EXCEPTION_VALUE_IN_REF": 0, + + "INVALID_VALUE_NOTE": "", + "INVALID_ITEMS_NOTE": "", + "OVERSTOCKED_NOTE": "", + "DUPE_ITEMS_NOTE": "", + "DUPE_CHECK_FAILED_NOTE": "", + "ADDITIONAL_NOTE": "", + + "CUSTOM_PLAYING_GAME_NAME": "tf2-automatic", + + "CUSTOM_WELCOME_MESSAGE": "", + "CUSTOM_I_DONT_KNOW_WHAT_YOU_MEAN": "", + "CUSTOM_HOW2TRADE_MESSAGE": "", + + "CUSTOM_SUCCESS_MESSAGE": "", + "CUSTOM_DECLINED_MESSAGE": "", + "CUSTOM_TRADED_AWAY_MESSAGE": "", + "CUSTOM_CLEARING_FRIENDS_MESSAGE": "" + } + }, + { + "name": "tf2autobot-2", + "script": "dist/app.js", + "exec_mode": "fork", + "exp_backoff_restart_delay": 1000, + "shutdown_with_message": false, + "kill_timeout": 30000, + "out_file": "NULL", + "error_file": "NULL", + "env": { + "NODE_ENV": "production", + + "STEAM_ACCOUNT_NAME": "", + "STEAM_PASSWORD": "", + "STEAM_SHARED_SECRET": "", + "STEAM_IDENTITY_SECRET": "", + + "PRICESTF_API_TOKEN": "", + "BPTF_ACCESS_TOKEN": "", + "BPTF_API_KEY": "", + + "AUTOBUMP": true, + + "MINIMUM_SCRAP": 9, + "MINIMUM_RECLAIMED": 9, + "METAL_THRESHOLD": 9, + + "ENABLE_AUTO_SELL_AND_BUY_KEYS": false, + "ENABLE_AUTO_KEY_BANKING": false, + "MINIMUM_KEYS": 3, + "MAXIMUM_KEYS": 15, + "MINIMUM_REFINED_TO_START_SELL_KEYS": 30, + "MAXIMUM_REFINED_TO_STOP_SELL_KEYS": 150, + + "DISABLE_INVENTORY_SORT": false, + "DISABLE_LISTINGS": false, + "DISABLE_CRAFTING": false, + "DISABLE_CRAFTING_WEAPONS": false, + "DISABLE_MESSAGES": false, + "DISABLE_SOMETHING_WRONG_ALERT": false, + "DISABLE_CRAFTWEAPON_AS_CURRENCY": false, + "DISABLE_ADD_FRIENDS": false, + "DISABLE_CHECK_USES_DUELING_MINI_GAME": false, + "DISABLE_CHECK_USES_NOISE_MAKER": false, + + "TRADES_MADE_STARTER_VALUE": 0, + "LAST_TOTAL_TRADES": 0, + "TRADING_STARTING_TIME_UNIX": 0, + + "ENABLE_SHOW_ONLY_METAL": true, + "ENABLE_DUPE_CHECK": true, + "DECLINE_DUPES": false, + "MINIMUM_KEYS_DUPE_CHECK": 10, + + "SKIP_BPTF_TRADEOFFERURL": true, + "SKIP_ACCOUNT_LIMITATIONS": true, + "SKIP_UPDATE_PROFILE_SETTINGS": true, + + "TIMEZONE": "", + "CUSTOM_TIME_FORMAT": "", + "TIME_ADDITIONAL_NOTES": "", + + "ALLOW_ESCROW": false, + "ALLOW_OVERPAY": true, + "ALLOW_BANNED": false, + "MAX_PRICE_AGE": 28800, + + "ADMINS": [""], + "KEEP": [""], + "GROUPS": ["103582791464047777", "103582791462300957"], + "ALERTS": ["trade"], + + "DEBUG": true, + "DEBUG_FILE": true, + + "BPTF_DETAILS_BUY": "I am buying your %name% for %price%, I have %current_stock% / %max_stock%. %keyPrice%.", + "BPTF_DETAILS_SELL": "I am selling my %name% for %price%, I am selling %amount_trade%. %keyPrice%", + "OFFER_MESSAGE": "", + + "DISCORD_OWNER_ID": "", + "DISCORD_WEBHOOK_USERNAME": "", + "DISCORD_WEBHOOK_AVATAR_URL": "", + "DISCORD_WEBHOOK_EMBED_COLOR_IN_DECIMAL_INDEX": "9171753", + + "DISABLE_DISCORD_WEBHOOK_SOMETHING_WRONG_ALERT": false, + "DISCORD_WEBHOOK_SOMETHING_WRONG_ALERT_URL": "", + + "DISABLE_DISCORD_WEBHOOK_PRICE_UPDATE": false, + "DISCORD_WEBHOOK_PRICE_UPDATE_URL": "", + "DISCORD_WEBHOOK_PRICE_UPDATE_ADDITIONAL_DESCRIPTION_NOTE": "", + + "DISABLE_DISCORD_WEBHOOK_TRADE_SUMMARY": false, + "DISCORD_WEBHOOK_TRADE_SUMMARY_URL": "", + "DISCORD_WEBHOOK_TRADE_SUMMARY_SHOW_QUICK_LINKS": true, + "DISCORD_WEBHOOK_TRADE_SUMMARY_SHOW_KEY_RATE": true, + "DISCORD_WEBHOOK_TRADE_SUMMARY_SHOW_PURE_STOCK": true, + "DISCORD_WEBHOOK_TRADE_SUMMARY_ADDITIONAL_DESCRIPTION_NOTE": "", + "DISCORD_WEBHOOK_TRADE_SUMMARY_MENTION_OWNER": false, + "DISCORD_WEBHOOK_TRADE_SUMMARY_MENTION_OWNER_ONLY_ITEMS_SKU": [";"], + + "DISABLE_DISCORD_WEBHOOK_OFFER_REVIEW": false, + "DISCORD_WEBHOOK_REVIEW_OFFER_URL": "", + "DISCORD_WEBHOOK_REVIEW_OFFER_DISABLE_MENTION_INVALID_VALUE": false, + "DISCORD_WEBHOOK_REVIEW_OFFER_SHOW_QUICK_LINKS": true, + "DISCORD_WEBHOOK_REVIEW_OFFER_SHOW_KEY_RATE": true, + "DISCORD_WEBHOOK_REVIEW_OFFER_SHOW_PURE_STOCK": true, + + "DISABLE_DISCORD_WEBHOOK_MESSAGE_FROM_PARTNER": false, + "DISCORD_WEBHOOK_MESSAGE_FROM_PARTNER_URL": "", + "DISCORD_WEBHOOK_MESSAGE_FROM_PARTNER_SHOW_QUICK_LINKS": true, + + "ENABLE_MANUAL_REVIEW": true, + "DISABLE_SHOW_REVIEW_OFFER_SUMMARY": false, + "DISABLE_REVIEW_OFFER_NOTE": false, + "DISABLE_SHOW_CURRENT_TIME": false, + + "DISABLE_ACCEPT_INVALID_ITEMS_OVERPAY": false, + "DISABLE_ACCEPT_OVERSTOCKED_OVERPAY": false, + "DISABLE_AUTO_DECLINE_INVALID_VALUE": false, + + "INVALID_VALUE_EXCEPTION_SKUS": [";5;u", ";11;australium"], + "INVALID_VALUE_EXCEPTION_VALUE_IN_REF": 0, + + "INVALID_VALUE_NOTE": "", + "INVALID_ITEMS_NOTE": "", + "OVERSTOCKED_NOTE": "", + "DUPE_ITEMS_NOTE": "", + "DUPE_CHECK_FAILED_NOTE": "", + "ADDITIONAL_NOTE": "", + + "CUSTOM_PLAYING_GAME_NAME": "tf2-automatic", + + "CUSTOM_WELCOME_MESSAGE": "", + "CUSTOM_I_DONT_KNOW_WHAT_YOU_MEAN": "", + "CUSTOM_HOW2TRADE_MESSAGE": "", + + "CUSTOM_SUCCESS_MESSAGE": "", + "CUSTOM_DECLINED_MESSAGE": "", + "CUSTOM_TRADED_AWAY_MESSAGE": "", + "CUSTOM_CLEARING_FRIENDS_MESSAGE": "" + } + } + ] +} diff --git a/template.ecosystem.json b/template.ecosystem.json index ad0fde80a..075bc07b1 100644 --- a/template.ecosystem.json +++ b/template.ecosystem.json @@ -5,7 +5,7 @@ "script": "dist/app.js", "exec_mode": "fork", "exp_backoff_restart_delay": 1000, - "shutdown_with_message": true, + "shutdown_with_message": false, "kill_timeout": 30000, "out_file": "NULL", "error_file": "NULL", From 1f1fa0241fdddaefa75db3171ccda8efc62e4889 Mon Sep 17 00:00:00 2001 From: idinium96 Date: Sat, 18 Jul 2020 20:11:44 +0800 Subject: [PATCH 25/31] update README --- README.md | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index b9432835c..7f6e5ce6f 100644 --- a/README.md +++ b/README.md @@ -40,22 +40,24 @@ The original tf2-automatic repository already have a lot of features, but some f - dupe check on items that are more than minimum keys (you set it yourself) ### tf2autobot version -- add an option to use Discord Webhook for your bot to send accepted trade summary/ offer review/ messages. -- add an option to disable show only metal in trade summary (it will show x keys, y ref, it will show only x ref on original version) -- add an option to enable Autokeys (to keep your refined metal stock) and key banking ([jump](https://github.com/idinium96/tf2autobot#autokeys-auto-buy-or-sell-keys-feature)) -- add an option to set your own custom greeting/success/failed messages and offer review notes +- added an option to use Discord Webhook for your bot to send accepted trade summary/ offer review/ messages. +- added an option to disable show only metal in trade summary (it will show x keys, y ref, it will show only x ref on original version) +- added an option to enable Autokeys (to keep your refined metal stock) and key banking ([jump](https://github.com/idinium96/tf2autobot#autokeys-auto-buy-or-sell-keys-feature)) +- added an option to set your own custom greeting/success/failed messages and offer review notes - send to trade partner a summary of their offer if need to be reviewed ([jump](https://github.com/idinium96/tf2autobot#offer-review-summary-on-trade-partner-side)) - alert admins when there's something wrong, like queue problem (which the original one is still not fixed yet, and I have no idea why) and when your bot is out of space or if your bot has less than minimum pure (must enable Autokeys feature) - automatically restart your bot on queue problem, and automatically relist if backpack.tf does not synchronized with your bot listings on Autokeys (sometimes it's set to automatically buy keys, but at backpack.tf, it's listed to sell.) - use emojis on almost all messages -- add an option to set all craft weapons as currency (0.05 ref) and automatically craft duplicate craftable weapons +- added an option to set all craft weapons as currency (0.05 ref) and automatically craft duplicate craftable weapons - INVALID_VALUE exception -- add an option to NOT mention (Discord Webhook) on an INVALID_VALUE offer +- added an option to automatically decline (skip manual review) **ONLY** INVALID_VALUE trade, if not within INVALID_VALUE exception sku and value range. +- added an option to accept (skip manual review) INVALID_ITEMS or OVERSTOCKED trades if the trade partner offer more than what they're taking (overpay). +- added an option to NOT mention (Discord Webhook) on an INVALID_VALUE offer - Mention every items on each offer review reasons - Dueling Mini-Game: Only accept 5 Uses! (option) - Noise Maker: Only accept 25 Uses! (option) - New added commands: "!pure", "!time", "!delete", "!check", "!block", "!unblock", "!autokeys", "!craftweapon" and "!uncraftweapon" commands -- add an option to disable acceptting friend request +- added an option to disable acceptting friend request - and more to come! ## Added features @@ -123,11 +125,11 @@ Some screenshots: ![autokeys3](https://user-images.githubusercontent.com/47635037/84581310-9c1cd100-ae12-11ea-80fa-085ad8bff73e.png) -You can see codes on how this feature works [here](https://github.com/idinium96/tf2autobot/blob/master/src/classes/MyHandler.ts#L1342-L1798). +You can see codes on how this feature works [here](https://github.com/idinium96/tf2autobot/blob/master/src/classes/MyHandler.ts#L1481-L1991). ### Emojis and more commands added -![commands](https://user-images.githubusercontent.com/47635037/84581311-9c1cd100-ae12-11ea-8aae-29733d9e0334.PNG) +![commands](https://user-images.githubusercontent.com/47635037/87851703-f76c4280-c92d-11ea-8bd4-60a79312929f.png) ### Offer review summary on trade partner side @@ -296,7 +298,7 @@ Time will be use in "!time" command and ### Manual Review settings - `ENABLE_MANUAL_REVIEW`: [true|false] - Set to true if you want any INVALID_VALUE/INVALID_ITEMS/OVERSTOCKED/DUPED_ITEMS/DUPE_CHECK_FAILED trades to be reviewed by you. - `DISABLE_SHOW_REVIEW_OFFER_SUMMARY`: [true|false] - set to true if you do not want your bot to show offer summary to trade partner, but it will only notify trade partner that their offer is being hold for a review. -- `DISABLE_REVIEW_OFFER_NOTE`: [true|false] - If set to false, it will show note on [each error](https://github.com/idinium96/tf2autobot/blob/master/src/classes/MyHandler.ts#L1140-L1264) +- `DISABLE_REVIEW_OFFER_NOTE`: [true|false] - If set to false, it will show note on [each error](https://github.com/idinium96/tf2autobot/blob/master/src/classes/MyHandler.ts#L1278-L1478) - `DISABLE_SHOW_CURRENT_TIME`: [true|false] - If set to false, it will show owner time on offer review notification that trade partner will received. - `DISABLE_ACCEPT_INVALID_ITEMS_OVERPAY`: [true|false] - Default: false. Set to true if you want your bot to accept a trade with INVALID_ITEMS but with their value more or equal to our value. From 7f72efd202a90ffc21b2c836c7de717dfa281d86 Mon Sep 17 00:00:00 2001 From: idinium96 Date: Sat, 18 Jul 2020 20:18:59 +0800 Subject: [PATCH 26/31] update README --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 7f6e5ce6f..d45c874fc 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,12 @@ A free and open source fully automated TF2 trading bot advertising on www.backpa [![Donate-paypal](https://img.shields.io/badge/donate-paypal-blue)](https://www.paypal.me/idinium) [![Donate-steam](https://img.shields.io/badge/donate-steam-lightgrey)](https://bit.ly/3gbldTM) +**tf2autobot made by IdiNium** +[![profile-Steam](https://img.shields.io/badge/Steam-profile-blue)](https://steamcommunity.com/profiles/76561198013127982/) +[![profile-bptf](https://img.shields.io/badge/Backpack.tf-profile-blue)](https://backpack.tf/profiles/76561198013127982) +![bptf-profile](https://user-images.githubusercontent.com/47635037/87852271-23d68d80-c933-11ea-84e4-a116d4163878.PNG) + + Before you install the bot, there are a few things you need to have taken care off before you will be able to run the bot. - You need a separate [Unlimited](https://support.steampowered.com/kb_article.php?ref=3330-IAGK-7663) Steam account with a mobile authenticator. I suggest using the [Steam Desktop Authenticator](https://github.com/Jessecar96/SteamDesktopAuthenticator) to authenticate the account and get the secret keys used to automate generating 2FA codes and managing mobile confirmations. From 811d6de2837d50e48b8d1550583d841bd4a7e15c Mon Sep 17 00:00:00 2001 From: idinium96 Date: Sat, 18 Jul 2020 20:22:37 +0800 Subject: [PATCH 27/31] redo --- README.md | 345 +----------------------------------------------------- 1 file changed, 1 insertion(+), 344 deletions(-) diff --git a/README.md b/README.md index d45c874fc..30d74d258 100644 --- a/README.md +++ b/README.md @@ -1,344 +1 @@ -# tf2autobot - -A free and open source fully automated TF2 trading bot advertising on www.backpack.tf using prices from www.prices.tf. -**tf2autobot** is an improved version of the original **tf2-automatic** made by [Nicklason](https://github.com/Nicklason). You can find out more about the original repository [here](https://github.com/Nicklason/tf2-automatic). - -![GitHub package version](https://img.shields.io/github/package-json/v/idinium96/tf2autobot.svg) -[![Build Status](https://img.shields.io/github/workflow/status/idinium96/tf2autobot/CI/development)](https://github.com/idinium96/tf2autobot/actions) -[![GitHub issues](https://img.shields.io/github/issues/idinium96/tf2autobot)](https://github.com/idinium96/tf2autobot/issues) -[![GitHub forks](https://img.shields.io/github/forks/idinium96/tf2autobot)](https://github.com/idinium96/tf2autobot/network/members) -[![GitHub stars](https://img.shields.io/github/stars/idinium96/tf2autobot)](https://github.com/idinium96/tf2autobot/stargazers) -[![Discord](https://img.shields.io/discord/664971400678998016.svg)](https://discord.gg/ZrVT7mc) -![License](https://img.shields.io/github/license/idinium96/tf2autobot) -[![Donate-paypal](https://img.shields.io/badge/donate-paypal-blue)](https://www.paypal.me/idinium) -[![Donate-steam](https://img.shields.io/badge/donate-steam-lightgrey)](https://bit.ly/3gbldTM) - -**tf2autobot made by IdiNium** -[![profile-Steam](https://img.shields.io/badge/Steam-profile-blue)](https://steamcommunity.com/profiles/76561198013127982/) -[![profile-bptf](https://img.shields.io/badge/Backpack.tf-profile-blue)](https://backpack.tf/profiles/76561198013127982) -![bptf-profile](https://user-images.githubusercontent.com/47635037/87852271-23d68d80-c933-11ea-84e4-a116d4163878.PNG) - - -Before you install the bot, there are a few things you need to have taken care off before you will be able to run the bot. - -- You need a separate [Unlimited](https://support.steampowered.com/kb_article.php?ref=3330-IAGK-7663) Steam account with a mobile authenticator. I suggest using the [Steam Desktop Authenticator](https://github.com/Jessecar96/SteamDesktopAuthenticator) to authenticate the account and get the secret keys used to automate generating 2FA codes and managing mobile confirmations. -- NodeJS version 8 or more -- Typescript 3.7 or above - -Please refer to the [wiki](https://github.com/idinium96/tf2autobot/wiki) for setting up the bot. For additional help and questions, please ask in the IdiNium's Trading Bot [Discord server](https://discord.gg/ZrVT7mc) or create an [issue](https://github.com/idinium96/tf2autobot/issues/new/choose). - -## Download and installation - -You can clone or download the bot by clicking on the green button in the top right, follow the [installation guide](https://github.com/idinium96/tf2autobot/wiki/a.-Installation) for more instructions. - -## Configuration - -Once you have downloaded the source and installed the necessary packages, you can move on to configuring the bot. Follow the [configuration guide](https://github.com/idinium96/tf2autobot/wiki/b.-Configuration). - -## Difference between tf2autobot and tf2-automatic - -The original tf2-automatic repository already have a lot of features, but some features in this version have their own advantages. Let me list out what features that worth mentioning, which already exist and what features that have been added into this version: - -### Original tf2-automatic -- free autoprice (use prices from [prices.tf](https://prices.tf/)) and unlimited listings (depends on your backpack.tf listings cap) -- automatically craft/smelt pure metals (for currency changes) -- offer review (on invalid value/item or overstocked or duped items) -- dupe check on items that are more than minimum keys (you set it yourself) - -### tf2autobot version -- added an option to use Discord Webhook for your bot to send accepted trade summary/ offer review/ messages. -- added an option to disable show only metal in trade summary (it will show x keys, y ref, it will show only x ref on original version) -- added an option to enable Autokeys (to keep your refined metal stock) and key banking ([jump](https://github.com/idinium96/tf2autobot#autokeys-auto-buy-or-sell-keys-feature)) -- added an option to set your own custom greeting/success/failed messages and offer review notes -- send to trade partner a summary of their offer if need to be reviewed ([jump](https://github.com/idinium96/tf2autobot#offer-review-summary-on-trade-partner-side)) -- alert admins when there's something wrong, like queue problem (which the original one is still not fixed yet, and I have no idea why) and when your bot is out of space or if your bot has less than minimum pure (must enable Autokeys feature) -- automatically restart your bot on queue problem, and automatically relist if backpack.tf does not synchronized with your bot listings on Autokeys (sometimes it's set to automatically buy keys, but at backpack.tf, it's listed to sell.) -- use emojis on almost all messages -- added an option to set all craft weapons as currency (0.05 ref) and automatically craft duplicate craftable weapons -- INVALID_VALUE exception -- added an option to automatically decline (skip manual review) **ONLY** INVALID_VALUE trade, if not within INVALID_VALUE exception sku and value range. -- added an option to accept (skip manual review) INVALID_ITEMS or OVERSTOCKED trades if the trade partner offer more than what they're taking (overpay). -- added an option to NOT mention (Discord Webhook) on an INVALID_VALUE offer -- Mention every items on each offer review reasons -- Dueling Mini-Game: Only accept 5 Uses! (option) -- Noise Maker: Only accept 25 Uses! (option) -- New added commands: "!pure", "!time", "!delete", "!check", "!block", "!unblock", "!autokeys", "!craftweapon" and "!uncraftweapon" commands -- added an option to disable acceptting friend request -- and more to come! - -## Added features - -### Discord Webhook feature - -Instead of the bot sending trade summary, review offer and messages to you via Steam Chat, this version will let your bot to send it to a different channels in your discord server. -If you want to use Offer Review and Messages as Discord Webhook, you can not reply to the message sent by your Discord Webhook bot, unless you have [tf2-autocord](https://github.com/idinium96/tf2-autocord) installed. - -Screenshots: -- Trade summary (or live-trades) - - -![trade-summary](https://user-images.githubusercontent.com/47635037/84581315-9de69480-ae12-11ea-806f-2408bfb4b5b9.PNG) - -- Offer review (when trade partner sent wrong value/overstocked/etc) - - -![Offer-review](https://user-images.githubusercontent.com/47635037/85020166-80168800-b1a2-11ea-99f2-04766677fdf7.PNG) - -- Messages (when trade partner send "!message" command - - -![Messages](https://user-images.githubusercontent.com/47635037/84581313-9cb56780-ae12-11ea-9dcf-2d660d8ae184.PNG) - -- Price update (Discord Only) - Show price change for every items that are on your pricelist - - -![price-update](https://user-images.githubusercontent.com/47635037/83712639-cc1ce500-a658-11ea-855d-5de43b39ff2f.png) - -You can also only set it to send only trade summary, but the others like Offer review and Messages will be sent to you via Steam Chat. - -Note that, it's an option to show key rate/ pure stock/ quick links on each feature. - -If you want to use this feature, you must use [ecosystem.template.json](https://github.com/idinium96/tf2autobot/blob/master/template.ecosystem.json) from this version, which contains much more variables for you to fill in. - -### Autokeys (auto buy or sell keys) feature - -This feature when enabled, your bot will automatically buy or sell keys based on your bot pure availability and your settings on this feature. You'll need to set your minimum/maximum keys and minimum/maximum refined metals in your ecosystem.json - more explaination can be found [here](https://github.com/idinium96/tf2autobot#your-bot-settings) starting on `ENABLE_AUTO_SELL_AND_BUY_KEYS` until `MAXIMUM_REFINED_TO_STOP_SELL_KEYS`. - -``` -.____________________________________________________________. ._______________________________. -| **Buying Keys** | **Selling Keys** | | **Banking Keys** | -| *************** | **************** | | **************** | -| <———————————○ | ○————————————> | | ○————————————> | -| Keys -----|--------|-----> | Keys -----|--------|-----> | | Keys -----|--------|-----> |_______________________________. -| ○———> | <——○ | | ○————————○ | **Disabled** | -| Refs -----|--------|-----> | Refs -----|--------|-----> | | Refs -----|--------|-----> | ************ | -| min max | min max | | min max | <——● | -|_____________________________|______________________________| |______________________________.| Keys -----|--------|-----> | - | **Disabled** | | **Buying when more ref** | <———————————● | - | ************ | | ************ | Refs -----|--------|-----> | - | <——●————————●···> | | <——● | min max | - | Keys -----|--------|-----> | | Keys -----|--------|-----> |_______________________________| - | ●————————●···> | | ○————————————> | - | Refs -----|--------|-----> | | Refs -----|--------|-----> | - | min max | | min max | - |_____________________________| |_______________________________| -``` - -Some screenshots: -- When your bot have enough key to sell to get more ref (if your ref is less than minimum) OR enough ref to buy more keys (when your ref > maximum and keys < max) - -![autokeys1](https://user-images.githubusercontent.com/47635037/84581306-9a530d80-ae12-11ea-9bd5-3a988ac447d9.png) -![autokeys2](https://user-images.githubusercontent.com/47635037/84581309-9b843a80-ae12-11ea-8374-0f7d3c631fa6.png) - - -- When your bot don't have enough of what I've said before: - -![autokeys3](https://user-images.githubusercontent.com/47635037/84581310-9c1cd100-ae12-11ea-80fa-085ad8bff73e.png) - -You can see codes on how this feature works [here](https://github.com/idinium96/tf2autobot/blob/master/src/classes/MyHandler.ts#L1481-L1991). - -### Emojis and more commands added - -![commands](https://user-images.githubusercontent.com/47635037/87851703-f76c4280-c92d-11ea-8bd4-60a79312929f.png) - -### Offer review summary on trade partner side - -![review-note-trade-partner](https://user-images.githubusercontent.com/47635037/85020170-8147b500-b1a2-11ea-96b5-1805ad8cc31c.PNG) - -### INVALID_VALUE exception - -Let say you want to trade an unusual OR an australium, which the value as we know is huge (more than 5 keys), and then someone sent a trade offer with 0.11 ref less, your bot will skip this offer and send you notification to do review on this offer. With this exception, your bot will accept the trade as long as it's less than the exception value in ref that you've set. To use this feature, you'll need to set it on both `INVALID_VALUE_EXCEPTION_SKUS` and `INVALID_VALUE_EXCEPTION_VALUE_IN_REF`. See [here](https://github.com/idinium96/tf2autobot#manual-review-settings). - -![Invalid_value_exception1](https://user-images.githubusercontent.com/47635037/84966884-38adde80-b145-11ea-9aac-d28daf9a74e6.PNG) - -![Invalid_value_exception2](https://user-images.githubusercontent.com/47635037/84966887-39df0b80-b145-11ea-9d81-021d302e7cf0.PNG) - - -## Variables in ecosystem.json summary - -### Your bot credentials -- `STEAM_ACCOUNT_NAME`: username that is used to login (preferably your bot/alt Steam account). -- `STEAM_PASSWORD`: your bot Steam account password. -- `STEAM_SHARED_SECRET`: you can found this in `.maFile` inside ~/SDA/maFiles (named `shared_secret`). -- `STEAM_IDENTITY_SECRET`: same as above (named `identity_secret`). - -### Prices.TF token -- `PRICESTF_API_TOKEN`: You can leave this empty. No need at all. - -### Backpack.tf token and API Key -You can run your bot without this first, which then on the first run, it will print out your bot backpack.tf access token and apiKey. You'll need to copy and paste it into your ecosystem.json or .env file, [see this image](https://cdn.discordapp.com/attachments/697415702637838366/697820077248086126/bptf-api-token.png), BUT if you want to find it yourself, then, -- `BPTF_ACCESS_TOKEN`: https://backpack.tf/connections and click on `Show Token` under User Token. -- `BPTF_API_KEY`: https://backpack.tf/developer/apikey/view - fill in site URL (`http://localhost:4566/tasks`) and comments (`Check if a user is banned on backpack.tf`). - -### Your bot settings -- `AUTOBUMP`: If you don't have backpack.tf premium, then your bot will re-list all listings every 30 minutes. - -- `MINIMUM_SCRAP`: [Number] Default is 9 scraps. If it has less, it will smelt reclaimed metal so your bot will have more than minimum scraps. -- `MINIMUM_RECLAIMED`: [Number] Default is 9 Reclaimed. Explained above. -- `METAL_THRESHOLD`: [Number] Default is 9, if scraps/reclaimed metal reached minimum + threshold (max), it will combine the metal. - -#### Autokeys feature -- `ENABLE_AUTO_SELL_AND_BUY_KEYS`: [true|false] Default is false. If you set to true, the bot will automatically sell/buy keys based on the availability of the refined metals and keys in your bot inventory. Set it to false if you want to custom price your key. -- `ENABLE_AUTO_KEY_BANKING`: [true|false] Default is false. If set to true, it will do key banking (must also set **ENABLE_AUTO_SELL_AND_BUY_KEYS** to true and for banking, meaning if current ref is in between min and max and keys > min, it will do key banking). -- `MINIMUM_KEYS`: [Number] When current keys > minimum keys, it will start selling keys (with when current ref < minimum ref), else it will stop selling keys. -- `MAXIMUM_KEYS`: [Number] When current keys < maximum keys, it will start buying keys (with when current ref > maximum ref), else it will stop buying keys. -- `MINIMUM_REFINED_TO_START_SELL_KEYS`: [Number] - Already explained. -- `MAXIMUM_REFINED_TO_STOP_SELL_KEYS`: [Number] - Already explained. - -**This feature is meant to make your bot to have enough pure in their inventory. Enabling Autokeys - Banking might cause your bot to not function as intended. - -#### Set to true if want to disable -- `DISABLE_INVENTORY_SORT`: [true|false] Default: true. Sort your bot inventory. -- `DISABLE_LISTINGS`: [true|false] Default: false. This is used if you want to temporarily disable trading while your bot is alive. -- `DISABLE_CRAFTING`: [true|false] Default: false. **NOT RECOMMENDED** to set is as true, as it cause bot and trade partner to not be able to trade because of missing pure changes. -- `DISABLE_CRAFTING_WEAPONS`: [true|false] Default: false. Set to **true if you DO NOT** want your bot to automatically craft any duplicated craftable weapons. -- `DISABLE_MESSAGES`: [true|false] Default: false. When true, people (that are friend with your bot) will be unable send messages to you with "!message" command. -- `DISABLE_SOMETHING_WRONG_ALERT`: [true|false] - Default: false. My custom - Used to notify owner if your bot has a queue problem/full inventory/low in pure (if Autokeys is on). -- `DISABLE_CRAFTWEAPON_AS_CURRENCY`: [true|false] - Default: false. Set it as true if you don't want to set craft weapons as currency (0.05 ref). -- `DISABLE_ADD_FRIENDS`: [true|false] - Default: false. Set to true if you don't want people to add your bot (not recommended). -- `DISABLE_CHECK_USES_DUELING_MINI_GAME`: [true|false] - Default: false. Set to true if you want your bot to buy Dueling Mini-Game of regardless of how many uses left. -- `DISABLE_CHECK_USES_NOISE_MAKER`: [true|false] - Default: false. Set to true if you want your bot to accept Noise Maker that is not 25 Uses. - -#### Misc feature -- `TRADES_MADE_STARTER_VALUE`: [Number] - Used mainly for displaying your bot total trades made, found in your bot Steam Profile page (leave it 0 if you don't care about it, used for discord webhook). -- `LAST_TOTAL_TRADES`: [Number] - Used if your polldata.json is getting bigger which consumed a lot of RAM, but you want to keep total successful trades that your bot has made (leave it 0 if you don't care about it). -- `TRADING_STARTING_TIME_UNIX`: [Number - Unix format] - Also same as LAST_TOTAL_TRADES, but this one is the latest time (leave it 0 if you don't care about it). You can read more on my [Discord server post](https://discordapp.com/channels/664971400678998016/666909518604533760/707706994932449410). - -#### Duped unusual check feature -- `ENABLE_SHOW_ONLY_METAL`: [true|false] - Default: true. My custom - If set to false, it will show [x keys, y ref]. -- `ENABLE_DUPE_CHECK`: [true|false] - Default: true. Used to enable/disable check on duped unusuals -- `DECLINE_DUPES`: [true|false] - Default: false. Explained itself. -- `MINIMUM_KEYS_DUPE_CHECK`: [Number] - Default: 10. Explained itself. - -#### Set to true if want to skip -- `SKIP_BPTF_TRADEOFFERURL`: [true|false] - Default: true. Not sure why this thing might not work. Please add trade offer URL by yourself [here](https://backpack.tf/settings##general) (login as your bot Steam account). -- `SKIP_ACCOUNT_LIMITATIONS`: [true|false] - Default: false. Used to check your account limitation. It's better to set to true if your bot Steam account already a [premium account](https://support.steampowered.com/kb_article.php?ref=3330-IAGK-7663). -- `SKIP_UPDATE_PROFILE_SETTINGS`: [true|false] - Default: false. This is just set your bot profile to public, so backpack.tf can load your bot inventory and etc correctly. If you already set all to public, just set this to true. - -#### Your time -Time will be use in "!time" command and -- `TIMEZONE` - Please only use these [Timezone Format](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones), for example "Asia/Kuala_Lumpur". -- `CUSTOM_TIME_FORMAT` - Please refer [this article](https://www.tutorialspoint.com/momentjs/momentjs_format.htm). Default is `MMMM Do YYYY, HH:mm:ss ZZ`. -- `TIME_ADDITIONAL_NOTES` - Your additional note when the bot show your current time, such as your active hours, etc. - -#### Set to true if want to allow -- `ALLOW_ESCROW`: [true|false] - Default: false. Escrow = trade hold -- `ALLOW_OVERPAY`: [true|false] - Default: true. If people give an overpay, your bot will accept. Set it to false if you don't want. -- `ALLOW_BANNED`: [true|false] - Default: false. I think it's better to set as false. - -#### Set time for price to be updated in seconds -- `MAX_PRICE_AGE`: [Number - in seconds] - Default: 28800 - If the time recorded in your pricelist reach/more than this, it will triggered to check with prices.tf. - -#### Compulsory variables -- `ADMINS`: [Array] - Put your main SteamID64. Example - `["76561198013127982"]`, if you have multiple, `["76561198013127982", "76561198077208792"]` -- `KEEP`: [Array] - Same as ADMINS, you must fill in BOTH. -- `GROUPS`: [Array] - If you have Steam group, find your group ID and paste it here. -- `ALERTS`: [Array] - If you set to `["trade"]`, your bot will send message/discord webhook every time a successful trades were made, other option is `["none"]`. - -#### Set to true if want to enable debugging notes in console -- `DEBUG`: [true|false] - Used to debug if any problem occured. -- `DEBUG_FILE`: [true|false] - Same as above, but this will create a file which can be sent to [issue](https://github.com/idinium96/tf2autobot/issues/new/choose). - -#### Backpack.tf sell or buy order listings note on all items in pricelist -- `BPTF_DETAILS_BUY`: [string] - Your buy order message. -- `BPTF_DETAILS_SELL` [string] - Your sell order message. - -**Parameters:** -- `%name%` - display an item name -- `%price%` - display item's buying/selling price -- `%current_stock%` - display item's current stock (by default this is used in `BPTF_DETAILS_BUY`) -- `%max_stock%` - display item's maximum stock (by default this is used in `BPTF_DETAILS_BUY`) -- `%amount_trade%` - display amount that can be traded (between minimum and maximum stock, use it on `BPTF_DETAILS_SELL`) -- `%amount_can_buy%` - display the amount that the bot can buy (use it on `BPTF_DETAILS_BUY`) -- `%keyPrice%` - display current key rate (selling price), it will show as `Key rate: x ref/key` only if the item price include x key, otherwise, it will show as ✨ -- `%dueling%` - will display `(𝗢𝗡𝗟𝗬 𝗪𝗜𝗧𝗛 𝟱x 𝗨𝗦𝗘𝗦)` on only Dueling Mini-Game listing - prefer to only place this on `BPTF_DETAILS_BUY`, on other item will show as ✨ - -**Usage example:** -![listings](https://user-images.githubusercontent.com/47635037/85929261-f3787200-b8e5-11ea-9ba8-b1acb12a5aad.PNG) - -#### Custom offer message -- `OFFER_MESSAGE`: [string] - Message that will appear when bot sends offer to trade partner. If leave empty (""), it will print *Powered by tf2-automatic* by default. - -### Discord Webhook Configuration -#### Basic configuration on your embed preferences/appearances -- `DISCORD_OWNER_ID` - Right click on yourself and click `Copy ID` and paste here. Make sure to enable developer mode on your Discord settings > Appearance > Advanced. -- `DISCORD_WEBHOOK_USERNAME` - Your Discord Webhook name, example: ※Fumino⚡ -- `DISCORD_WEBHOOK_AVATAR_URL` - Your Discord Webhook Avatar, must be in URL form. Example: https://gyazo.com/421792b5ea817c36054c7991fb18cdbc -- `DISCORD_WEBHOOK_EMBED_COLOR_IN_DECIMAL_INDEX` - Embed color, you can found yours at [spycolor.com](https://www.spycolor.com/) and copy the one that said "has decimal index of: `take the value here`". Example: "9171753" for #8bf329 color. - -**Note on How to get DISCORD_WEBHOOK_X_URL** - See this: https://gyazo.com/539739f0bab50636e20a0fb76e9f1720 (settings in your respective channels) -#### Queue alert -- `DISABLE_DISCORD_WEBHOOK_SOMETHING_WRONG_ALERT`: [true|false] - Same as `DISABLE_SOMETHING_WROMG_ALERT`, but if set to false, it will be sent to Discord Webhook instead of Steam Chat. -- `DISCORD_WEBHOOK_SOMETHING_WRONG_ALERT_URL` - Discord Webhook URL for SOMETHING_WROMG_ALERT. - -#### Pricelist update -- `DISABLE_DISCORD_WEBHOOK_PRICE_UPDATE`: [true|false] - Used to display price updates on the items that are in your pricelist. -- `DISCORD_WEBHOOK_PRICE_UPDATE_URL` - Discord Webhook URL for PRICE_UPDATE. -- `DISCORD_WEBHOOK_PRICE_UPDATE_ADDITIONAL_DESCRIPTION_NOTE` - You can add note there, or just leave it empty. - -#### Successful trade summary -- `DISABLE_DISCORD_WEBHOOK_TRADE_SUMMARY`: [true|false] - Used to display every successful trade summary on your trade summary/live-trades channel. If set to false, it will send to your Steam Chat. -- `DISCORD_WEBHOOK_TRADE_SUMMARY_URL` - Discord Webhook URL for TRADE_SUMMARY. -- `DISCORD_WEBHOOK_TRADE_SUMMARY_SHOW_QUICK_LINKS`: [true|false] - Show trade partner quick links to their Steam profile, backpack.tf and SteamREP pages. -- `DISCORD_WEBHOOK_TRADE_SUMMARY_SHOW_KEY_RATE`: [true|false] - self explained. -- `DISCORD_WEBHOOK_TRADE_SUMMARY_SHOW_PURE_STOCK`: [true|false] - self explained. -- `DISCORD_WEBHOOK_TRADE_SUMMARY_ADDITIONAL_DESCRIPTION_NOTE` - Notes. -- `DISCORD_WEBHOOK_TRADE_SUMMARY_MENTION_OWNER` [true|false] - Set it to true if you want your bot to mention on every successful trades. -- `DISCORD_WEBHOOK_TRADE_SUMMARY_MENTION_OWNER_ONLY_ITEMS_SKU` [StringArray] - Support multiple items sku, let say you want to be mentioned on every unusual and australium trades, just do `[";5;u", ";11;australium"]`, or if you want to mention on specific item, just fill in the full item sku like `["725;6;uncraftable"]`, then to add more, just separate it with a comma between each sku string. - -![trade-summary-full](https://user-images.githubusercontent.com/47635037/86468435-ffdb4f80-bd69-11ea-9ab6-a7f5be2c22f0.PNG) - -![trade-summary-full2](https://user-images.githubusercontent.com/47635037/86468438-0073e600-bd6a-11ea-8bc0-040229c997d5.PNG) - -#### Offer review summary -- `DISABLE_DISCORD_WEBHOOK_OFFER_REVIEW`: [true|false] - Used to alert you on the trade that needs for offer review via Discord Webhook. If set to false, it will send to your Steam Chat. -- `DISCORD_WEBHOOK_REVIEW_OFFER_URL` - Discord Webhook URL for REVIEW_OFFER. -- `DISCORD_WEBHOOK_REVIEW_OFFER_SHOW_QUICK_LINKS`: [true|false] - Show trade partner quick links to their Steam profile, backpack.tf and SteamREP pages. -- `DISCORD_WEBHOOK_REVIEW_OFFER_DISABLE_MENTION_INVALID_VALUE`: [true|false] - Set to true if you want your bot to not mention on only INVALID_VALUE offer. -- `DISCORD_WEBHOOK_REVIEW_OFFER_SHOW_KEY_RATE`: [true|false] - self explained. -- `DISCORD_WEBHOOK_REVIEW_OFFER_SHOW_PURE_STOCK`: [true|false] - self explained. - -![only non-invalid-value2](https://user-images.githubusercontent.com/47635037/86468430-feaa2280-bd69-11ea-8f25-26a7a430b2e1.PNG) - -#### Messages -- `DISABLE_DISCORD_WEBHOOK_MESSAGE_FROM_PARTNER`: [true|false] - Used to alert you on any messages sent from trade partner. If set to false, it will send to your Steam Chat. -- `DISCORD_WEBHOOK_MESSAGE_FROM_PARTNER_URL` - Discord Webhook URL for MESSAGE_FROM_PARTNER. -- `DISCORD_WEBHOOK_MESSAGE_FROM_PARTNER_SHOW_QUICK_LINKS`: [true|false] - Show trade partner quick links to their Steam profile, backpack.tf and SteamREP pages. - -### Manual Review settings -- `ENABLE_MANUAL_REVIEW`: [true|false] - Set to true if you want any INVALID_VALUE/INVALID_ITEMS/OVERSTOCKED/DUPED_ITEMS/DUPE_CHECK_FAILED trades to be reviewed by you. -- `DISABLE_SHOW_REVIEW_OFFER_SUMMARY`: [true|false] - set to true if you do not want your bot to show offer summary to trade partner, but it will only notify trade partner that their offer is being hold for a review. -- `DISABLE_REVIEW_OFFER_NOTE`: [true|false] - If set to false, it will show note on [each error](https://github.com/idinium96/tf2autobot/blob/master/src/classes/MyHandler.ts#L1278-L1478) -- `DISABLE_SHOW_CURRENT_TIME`: [true|false] - If set to false, it will show owner time on offer review notification that trade partner will received. - -- `DISABLE_ACCEPT_INVALID_ITEMS_OVERPAY`: [true|false] - Default: false. Set to true if you want your bot to accept a trade with INVALID_ITEMS but with their value more or equal to our value. -- `DISABLE_ACCEPT_OVERSTOCKED_OVERPAY`: [true|false] - Default: false. Set to true if you want your bot to accept a trade with OVERSTOCKED but with their value more or equal to our value. -- `DISABLE_AUTO_DECLINE_INVALID_VALUE`: [true|false]: Default: false. Set to true if you want to automatically decline trade with **ONLY** `INVALID_VALUE` and did not match the exception sku(s) and exception value. - -- `INVALID_VALUE_EXCEPTION_SKUS` [StringArray] - An array of sku that will skip Invalid value if the difference between our and their value is not more than exception value in ref. Let say you want to trade an unusual, but then someone sent an offer with 0.11 ref less, but you want your bot to accept it anyway if it's less than 10 ref, so the trade will be accepted. By default, it will check only for any unusual and australium: `[";5;u", ";11;australium"]`, you can also leave it empty (`[""]`) so all with invalid value will be notified. -- `INVALID_VALUE_EXCEPTION_VALUE_IN_REF` [Number] - Exception value for the sku(s) that you set above. Default is `0` (no exception). - -- `INVALID_VALUE_NOTE` - Your custom INVALID_VALUE note. -- *`INVALID_ITEMS_NOTE` - Your custom INVALID_ITEMS note. -- *`OVERSTOCKED_NOTE` - Your custom OVERSTOCKED note. -- *`DUPE_ITEMS_NOTE` - Your custom DUPE_ITEMS note. -- *`DUPE_CHECK_FAILED_NOTE` - Your custom DUPE_CHECK_FAILED note. -- `ADDITIONAL_NOTE` - Your custom ADDITIONAL note. - -**Notes:** -On each reasons **except INVALID_VALUE**, you can put `%name%` to list all the items that are on that reason, and `%isName%` for plural of "is", where if %name% is just 1 item, it will use "is", else if more then one item, it will use "are". - -Example: -Let say the trade contains items with `INVALID_ITEMS`. The items are: Dueling Mini-Game, Secret Saxton. - -You use custom `INVALID_ITEMS` note as: "%name% %isName% not in my pricelist. Please wait for my owner to check it." -What the trade partner will received: "Dueling Mini-Game, Secret Saxton are not in my pricelist. Please wait for my owner to check it." - - -### Others -- `CUSTOM_PLAYING_GAME_NAME` - Custom name of the game your bot is playing. Limited to only 45 characters. Example: https://gyazo.com/308e4e05bf4c49929520df4e0064864c (you do not need to include that `- tf2-automatic`, just your custom game name but not more than 45 characters.) - -- `CUSTOM_WELCOME_MESSAGE` - Your custom WELCOME_MESSAGE note. Two parameters: `%name%` (display trade partner name) and `%admin%` (if admin, it will use "!help", else "!how2trade"). -- `CUSTOM_I_DONT_KNOW_WHAT_YOU_MEAN` - Your custom note when people sends wrong command. -- `CUSTOM_HOW2TRADE_MESSAGE` - Your custom HOW2TRADE note. - -- `CUSTOM_SUCCESS_MESSAGE` - Your custom SUCCESS note. -- `CUSTOM_DECLINED_MESSAGE` - Your custom DECLINED note. -- `CUSTOM_TRADED_AWAY_MESSAGE` - Your custom note when the bot failed to trade because the item is traded away. -- `CUSTOM_CLEARING_FRIENDS_MESSAGE` - Your custom note when the bot is removing friend to add someone else. +test \ No newline at end of file From ed495ff68b4fc7b0863778516d1f8f1df8d44e93 Mon Sep 17 00:00:00 2001 From: idinium96 Date: Sat, 18 Jul 2020 20:23:04 +0800 Subject: [PATCH 28/31] redo README --- README.md | 345 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 344 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 30d74d258..d45c874fc 100644 --- a/README.md +++ b/README.md @@ -1 +1,344 @@ -test \ No newline at end of file +# tf2autobot + +A free and open source fully automated TF2 trading bot advertising on www.backpack.tf using prices from www.prices.tf. +**tf2autobot** is an improved version of the original **tf2-automatic** made by [Nicklason](https://github.com/Nicklason). You can find out more about the original repository [here](https://github.com/Nicklason/tf2-automatic). + +![GitHub package version](https://img.shields.io/github/package-json/v/idinium96/tf2autobot.svg) +[![Build Status](https://img.shields.io/github/workflow/status/idinium96/tf2autobot/CI/development)](https://github.com/idinium96/tf2autobot/actions) +[![GitHub issues](https://img.shields.io/github/issues/idinium96/tf2autobot)](https://github.com/idinium96/tf2autobot/issues) +[![GitHub forks](https://img.shields.io/github/forks/idinium96/tf2autobot)](https://github.com/idinium96/tf2autobot/network/members) +[![GitHub stars](https://img.shields.io/github/stars/idinium96/tf2autobot)](https://github.com/idinium96/tf2autobot/stargazers) +[![Discord](https://img.shields.io/discord/664971400678998016.svg)](https://discord.gg/ZrVT7mc) +![License](https://img.shields.io/github/license/idinium96/tf2autobot) +[![Donate-paypal](https://img.shields.io/badge/donate-paypal-blue)](https://www.paypal.me/idinium) +[![Donate-steam](https://img.shields.io/badge/donate-steam-lightgrey)](https://bit.ly/3gbldTM) + +**tf2autobot made by IdiNium** +[![profile-Steam](https://img.shields.io/badge/Steam-profile-blue)](https://steamcommunity.com/profiles/76561198013127982/) +[![profile-bptf](https://img.shields.io/badge/Backpack.tf-profile-blue)](https://backpack.tf/profiles/76561198013127982) +![bptf-profile](https://user-images.githubusercontent.com/47635037/87852271-23d68d80-c933-11ea-84e4-a116d4163878.PNG) + + +Before you install the bot, there are a few things you need to have taken care off before you will be able to run the bot. + +- You need a separate [Unlimited](https://support.steampowered.com/kb_article.php?ref=3330-IAGK-7663) Steam account with a mobile authenticator. I suggest using the [Steam Desktop Authenticator](https://github.com/Jessecar96/SteamDesktopAuthenticator) to authenticate the account and get the secret keys used to automate generating 2FA codes and managing mobile confirmations. +- NodeJS version 8 or more +- Typescript 3.7 or above + +Please refer to the [wiki](https://github.com/idinium96/tf2autobot/wiki) for setting up the bot. For additional help and questions, please ask in the IdiNium's Trading Bot [Discord server](https://discord.gg/ZrVT7mc) or create an [issue](https://github.com/idinium96/tf2autobot/issues/new/choose). + +## Download and installation + +You can clone or download the bot by clicking on the green button in the top right, follow the [installation guide](https://github.com/idinium96/tf2autobot/wiki/a.-Installation) for more instructions. + +## Configuration + +Once you have downloaded the source and installed the necessary packages, you can move on to configuring the bot. Follow the [configuration guide](https://github.com/idinium96/tf2autobot/wiki/b.-Configuration). + +## Difference between tf2autobot and tf2-automatic + +The original tf2-automatic repository already have a lot of features, but some features in this version have their own advantages. Let me list out what features that worth mentioning, which already exist and what features that have been added into this version: + +### Original tf2-automatic +- free autoprice (use prices from [prices.tf](https://prices.tf/)) and unlimited listings (depends on your backpack.tf listings cap) +- automatically craft/smelt pure metals (for currency changes) +- offer review (on invalid value/item or overstocked or duped items) +- dupe check on items that are more than minimum keys (you set it yourself) + +### tf2autobot version +- added an option to use Discord Webhook for your bot to send accepted trade summary/ offer review/ messages. +- added an option to disable show only metal in trade summary (it will show x keys, y ref, it will show only x ref on original version) +- added an option to enable Autokeys (to keep your refined metal stock) and key banking ([jump](https://github.com/idinium96/tf2autobot#autokeys-auto-buy-or-sell-keys-feature)) +- added an option to set your own custom greeting/success/failed messages and offer review notes +- send to trade partner a summary of their offer if need to be reviewed ([jump](https://github.com/idinium96/tf2autobot#offer-review-summary-on-trade-partner-side)) +- alert admins when there's something wrong, like queue problem (which the original one is still not fixed yet, and I have no idea why) and when your bot is out of space or if your bot has less than minimum pure (must enable Autokeys feature) +- automatically restart your bot on queue problem, and automatically relist if backpack.tf does not synchronized with your bot listings on Autokeys (sometimes it's set to automatically buy keys, but at backpack.tf, it's listed to sell.) +- use emojis on almost all messages +- added an option to set all craft weapons as currency (0.05 ref) and automatically craft duplicate craftable weapons +- INVALID_VALUE exception +- added an option to automatically decline (skip manual review) **ONLY** INVALID_VALUE trade, if not within INVALID_VALUE exception sku and value range. +- added an option to accept (skip manual review) INVALID_ITEMS or OVERSTOCKED trades if the trade partner offer more than what they're taking (overpay). +- added an option to NOT mention (Discord Webhook) on an INVALID_VALUE offer +- Mention every items on each offer review reasons +- Dueling Mini-Game: Only accept 5 Uses! (option) +- Noise Maker: Only accept 25 Uses! (option) +- New added commands: "!pure", "!time", "!delete", "!check", "!block", "!unblock", "!autokeys", "!craftweapon" and "!uncraftweapon" commands +- added an option to disable acceptting friend request +- and more to come! + +## Added features + +### Discord Webhook feature + +Instead of the bot sending trade summary, review offer and messages to you via Steam Chat, this version will let your bot to send it to a different channels in your discord server. +If you want to use Offer Review and Messages as Discord Webhook, you can not reply to the message sent by your Discord Webhook bot, unless you have [tf2-autocord](https://github.com/idinium96/tf2-autocord) installed. + +Screenshots: +- Trade summary (or live-trades) - + +![trade-summary](https://user-images.githubusercontent.com/47635037/84581315-9de69480-ae12-11ea-806f-2408bfb4b5b9.PNG) + +- Offer review (when trade partner sent wrong value/overstocked/etc) - + +![Offer-review](https://user-images.githubusercontent.com/47635037/85020166-80168800-b1a2-11ea-99f2-04766677fdf7.PNG) + +- Messages (when trade partner send "!message" command - + +![Messages](https://user-images.githubusercontent.com/47635037/84581313-9cb56780-ae12-11ea-9dcf-2d660d8ae184.PNG) + +- Price update (Discord Only) - Show price change for every items that are on your pricelist - + +![price-update](https://user-images.githubusercontent.com/47635037/83712639-cc1ce500-a658-11ea-855d-5de43b39ff2f.png) + +You can also only set it to send only trade summary, but the others like Offer review and Messages will be sent to you via Steam Chat. + +Note that, it's an option to show key rate/ pure stock/ quick links on each feature. + +If you want to use this feature, you must use [ecosystem.template.json](https://github.com/idinium96/tf2autobot/blob/master/template.ecosystem.json) from this version, which contains much more variables for you to fill in. + +### Autokeys (auto buy or sell keys) feature + +This feature when enabled, your bot will automatically buy or sell keys based on your bot pure availability and your settings on this feature. You'll need to set your minimum/maximum keys and minimum/maximum refined metals in your ecosystem.json - more explaination can be found [here](https://github.com/idinium96/tf2autobot#your-bot-settings) starting on `ENABLE_AUTO_SELL_AND_BUY_KEYS` until `MAXIMUM_REFINED_TO_STOP_SELL_KEYS`. + +``` +.____________________________________________________________. ._______________________________. +| **Buying Keys** | **Selling Keys** | | **Banking Keys** | +| *************** | **************** | | **************** | +| <———————————○ | ○————————————> | | ○————————————> | +| Keys -----|--------|-----> | Keys -----|--------|-----> | | Keys -----|--------|-----> |_______________________________. +| ○———> | <——○ | | ○————————○ | **Disabled** | +| Refs -----|--------|-----> | Refs -----|--------|-----> | | Refs -----|--------|-----> | ************ | +| min max | min max | | min max | <——● | +|_____________________________|______________________________| |______________________________.| Keys -----|--------|-----> | + | **Disabled** | | **Buying when more ref** | <———————————● | + | ************ | | ************ | Refs -----|--------|-----> | + | <——●————————●···> | | <——● | min max | + | Keys -----|--------|-----> | | Keys -----|--------|-----> |_______________________________| + | ●————————●···> | | ○————————————> | + | Refs -----|--------|-----> | | Refs -----|--------|-----> | + | min max | | min max | + |_____________________________| |_______________________________| +``` + +Some screenshots: +- When your bot have enough key to sell to get more ref (if your ref is less than minimum) OR enough ref to buy more keys (when your ref > maximum and keys < max) + +![autokeys1](https://user-images.githubusercontent.com/47635037/84581306-9a530d80-ae12-11ea-9bd5-3a988ac447d9.png) +![autokeys2](https://user-images.githubusercontent.com/47635037/84581309-9b843a80-ae12-11ea-8374-0f7d3c631fa6.png) + + +- When your bot don't have enough of what I've said before: + +![autokeys3](https://user-images.githubusercontent.com/47635037/84581310-9c1cd100-ae12-11ea-80fa-085ad8bff73e.png) + +You can see codes on how this feature works [here](https://github.com/idinium96/tf2autobot/blob/master/src/classes/MyHandler.ts#L1481-L1991). + +### Emojis and more commands added + +![commands](https://user-images.githubusercontent.com/47635037/87851703-f76c4280-c92d-11ea-8bd4-60a79312929f.png) + +### Offer review summary on trade partner side + +![review-note-trade-partner](https://user-images.githubusercontent.com/47635037/85020170-8147b500-b1a2-11ea-96b5-1805ad8cc31c.PNG) + +### INVALID_VALUE exception + +Let say you want to trade an unusual OR an australium, which the value as we know is huge (more than 5 keys), and then someone sent a trade offer with 0.11 ref less, your bot will skip this offer and send you notification to do review on this offer. With this exception, your bot will accept the trade as long as it's less than the exception value in ref that you've set. To use this feature, you'll need to set it on both `INVALID_VALUE_EXCEPTION_SKUS` and `INVALID_VALUE_EXCEPTION_VALUE_IN_REF`. See [here](https://github.com/idinium96/tf2autobot#manual-review-settings). + +![Invalid_value_exception1](https://user-images.githubusercontent.com/47635037/84966884-38adde80-b145-11ea-9aac-d28daf9a74e6.PNG) + +![Invalid_value_exception2](https://user-images.githubusercontent.com/47635037/84966887-39df0b80-b145-11ea-9d81-021d302e7cf0.PNG) + + +## Variables in ecosystem.json summary + +### Your bot credentials +- `STEAM_ACCOUNT_NAME`: username that is used to login (preferably your bot/alt Steam account). +- `STEAM_PASSWORD`: your bot Steam account password. +- `STEAM_SHARED_SECRET`: you can found this in `.maFile` inside ~/SDA/maFiles (named `shared_secret`). +- `STEAM_IDENTITY_SECRET`: same as above (named `identity_secret`). + +### Prices.TF token +- `PRICESTF_API_TOKEN`: You can leave this empty. No need at all. + +### Backpack.tf token and API Key +You can run your bot without this first, which then on the first run, it will print out your bot backpack.tf access token and apiKey. You'll need to copy and paste it into your ecosystem.json or .env file, [see this image](https://cdn.discordapp.com/attachments/697415702637838366/697820077248086126/bptf-api-token.png), BUT if you want to find it yourself, then, +- `BPTF_ACCESS_TOKEN`: https://backpack.tf/connections and click on `Show Token` under User Token. +- `BPTF_API_KEY`: https://backpack.tf/developer/apikey/view - fill in site URL (`http://localhost:4566/tasks`) and comments (`Check if a user is banned on backpack.tf`). + +### Your bot settings +- `AUTOBUMP`: If you don't have backpack.tf premium, then your bot will re-list all listings every 30 minutes. + +- `MINIMUM_SCRAP`: [Number] Default is 9 scraps. If it has less, it will smelt reclaimed metal so your bot will have more than minimum scraps. +- `MINIMUM_RECLAIMED`: [Number] Default is 9 Reclaimed. Explained above. +- `METAL_THRESHOLD`: [Number] Default is 9, if scraps/reclaimed metal reached minimum + threshold (max), it will combine the metal. + +#### Autokeys feature +- `ENABLE_AUTO_SELL_AND_BUY_KEYS`: [true|false] Default is false. If you set to true, the bot will automatically sell/buy keys based on the availability of the refined metals and keys in your bot inventory. Set it to false if you want to custom price your key. +- `ENABLE_AUTO_KEY_BANKING`: [true|false] Default is false. If set to true, it will do key banking (must also set **ENABLE_AUTO_SELL_AND_BUY_KEYS** to true and for banking, meaning if current ref is in between min and max and keys > min, it will do key banking). +- `MINIMUM_KEYS`: [Number] When current keys > minimum keys, it will start selling keys (with when current ref < minimum ref), else it will stop selling keys. +- `MAXIMUM_KEYS`: [Number] When current keys < maximum keys, it will start buying keys (with when current ref > maximum ref), else it will stop buying keys. +- `MINIMUM_REFINED_TO_START_SELL_KEYS`: [Number] - Already explained. +- `MAXIMUM_REFINED_TO_STOP_SELL_KEYS`: [Number] - Already explained. + +**This feature is meant to make your bot to have enough pure in their inventory. Enabling Autokeys - Banking might cause your bot to not function as intended. + +#### Set to true if want to disable +- `DISABLE_INVENTORY_SORT`: [true|false] Default: true. Sort your bot inventory. +- `DISABLE_LISTINGS`: [true|false] Default: false. This is used if you want to temporarily disable trading while your bot is alive. +- `DISABLE_CRAFTING`: [true|false] Default: false. **NOT RECOMMENDED** to set is as true, as it cause bot and trade partner to not be able to trade because of missing pure changes. +- `DISABLE_CRAFTING_WEAPONS`: [true|false] Default: false. Set to **true if you DO NOT** want your bot to automatically craft any duplicated craftable weapons. +- `DISABLE_MESSAGES`: [true|false] Default: false. When true, people (that are friend with your bot) will be unable send messages to you with "!message" command. +- `DISABLE_SOMETHING_WRONG_ALERT`: [true|false] - Default: false. My custom - Used to notify owner if your bot has a queue problem/full inventory/low in pure (if Autokeys is on). +- `DISABLE_CRAFTWEAPON_AS_CURRENCY`: [true|false] - Default: false. Set it as true if you don't want to set craft weapons as currency (0.05 ref). +- `DISABLE_ADD_FRIENDS`: [true|false] - Default: false. Set to true if you don't want people to add your bot (not recommended). +- `DISABLE_CHECK_USES_DUELING_MINI_GAME`: [true|false] - Default: false. Set to true if you want your bot to buy Dueling Mini-Game of regardless of how many uses left. +- `DISABLE_CHECK_USES_NOISE_MAKER`: [true|false] - Default: false. Set to true if you want your bot to accept Noise Maker that is not 25 Uses. + +#### Misc feature +- `TRADES_MADE_STARTER_VALUE`: [Number] - Used mainly for displaying your bot total trades made, found in your bot Steam Profile page (leave it 0 if you don't care about it, used for discord webhook). +- `LAST_TOTAL_TRADES`: [Number] - Used if your polldata.json is getting bigger which consumed a lot of RAM, but you want to keep total successful trades that your bot has made (leave it 0 if you don't care about it). +- `TRADING_STARTING_TIME_UNIX`: [Number - Unix format] - Also same as LAST_TOTAL_TRADES, but this one is the latest time (leave it 0 if you don't care about it). You can read more on my [Discord server post](https://discordapp.com/channels/664971400678998016/666909518604533760/707706994932449410). + +#### Duped unusual check feature +- `ENABLE_SHOW_ONLY_METAL`: [true|false] - Default: true. My custom - If set to false, it will show [x keys, y ref]. +- `ENABLE_DUPE_CHECK`: [true|false] - Default: true. Used to enable/disable check on duped unusuals +- `DECLINE_DUPES`: [true|false] - Default: false. Explained itself. +- `MINIMUM_KEYS_DUPE_CHECK`: [Number] - Default: 10. Explained itself. + +#### Set to true if want to skip +- `SKIP_BPTF_TRADEOFFERURL`: [true|false] - Default: true. Not sure why this thing might not work. Please add trade offer URL by yourself [here](https://backpack.tf/settings##general) (login as your bot Steam account). +- `SKIP_ACCOUNT_LIMITATIONS`: [true|false] - Default: false. Used to check your account limitation. It's better to set to true if your bot Steam account already a [premium account](https://support.steampowered.com/kb_article.php?ref=3330-IAGK-7663). +- `SKIP_UPDATE_PROFILE_SETTINGS`: [true|false] - Default: false. This is just set your bot profile to public, so backpack.tf can load your bot inventory and etc correctly. If you already set all to public, just set this to true. + +#### Your time +Time will be use in "!time" command and +- `TIMEZONE` - Please only use these [Timezone Format](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones), for example "Asia/Kuala_Lumpur". +- `CUSTOM_TIME_FORMAT` - Please refer [this article](https://www.tutorialspoint.com/momentjs/momentjs_format.htm). Default is `MMMM Do YYYY, HH:mm:ss ZZ`. +- `TIME_ADDITIONAL_NOTES` - Your additional note when the bot show your current time, such as your active hours, etc. + +#### Set to true if want to allow +- `ALLOW_ESCROW`: [true|false] - Default: false. Escrow = trade hold +- `ALLOW_OVERPAY`: [true|false] - Default: true. If people give an overpay, your bot will accept. Set it to false if you don't want. +- `ALLOW_BANNED`: [true|false] - Default: false. I think it's better to set as false. + +#### Set time for price to be updated in seconds +- `MAX_PRICE_AGE`: [Number - in seconds] - Default: 28800 - If the time recorded in your pricelist reach/more than this, it will triggered to check with prices.tf. + +#### Compulsory variables +- `ADMINS`: [Array] - Put your main SteamID64. Example - `["76561198013127982"]`, if you have multiple, `["76561198013127982", "76561198077208792"]` +- `KEEP`: [Array] - Same as ADMINS, you must fill in BOTH. +- `GROUPS`: [Array] - If you have Steam group, find your group ID and paste it here. +- `ALERTS`: [Array] - If you set to `["trade"]`, your bot will send message/discord webhook every time a successful trades were made, other option is `["none"]`. + +#### Set to true if want to enable debugging notes in console +- `DEBUG`: [true|false] - Used to debug if any problem occured. +- `DEBUG_FILE`: [true|false] - Same as above, but this will create a file which can be sent to [issue](https://github.com/idinium96/tf2autobot/issues/new/choose). + +#### Backpack.tf sell or buy order listings note on all items in pricelist +- `BPTF_DETAILS_BUY`: [string] - Your buy order message. +- `BPTF_DETAILS_SELL` [string] - Your sell order message. + +**Parameters:** +- `%name%` - display an item name +- `%price%` - display item's buying/selling price +- `%current_stock%` - display item's current stock (by default this is used in `BPTF_DETAILS_BUY`) +- `%max_stock%` - display item's maximum stock (by default this is used in `BPTF_DETAILS_BUY`) +- `%amount_trade%` - display amount that can be traded (between minimum and maximum stock, use it on `BPTF_DETAILS_SELL`) +- `%amount_can_buy%` - display the amount that the bot can buy (use it on `BPTF_DETAILS_BUY`) +- `%keyPrice%` - display current key rate (selling price), it will show as `Key rate: x ref/key` only if the item price include x key, otherwise, it will show as ✨ +- `%dueling%` - will display `(𝗢𝗡𝗟𝗬 𝗪𝗜𝗧𝗛 𝟱x 𝗨𝗦𝗘𝗦)` on only Dueling Mini-Game listing - prefer to only place this on `BPTF_DETAILS_BUY`, on other item will show as ✨ + +**Usage example:** +![listings](https://user-images.githubusercontent.com/47635037/85929261-f3787200-b8e5-11ea-9ba8-b1acb12a5aad.PNG) + +#### Custom offer message +- `OFFER_MESSAGE`: [string] - Message that will appear when bot sends offer to trade partner. If leave empty (""), it will print *Powered by tf2-automatic* by default. + +### Discord Webhook Configuration +#### Basic configuration on your embed preferences/appearances +- `DISCORD_OWNER_ID` - Right click on yourself and click `Copy ID` and paste here. Make sure to enable developer mode on your Discord settings > Appearance > Advanced. +- `DISCORD_WEBHOOK_USERNAME` - Your Discord Webhook name, example: ※Fumino⚡ +- `DISCORD_WEBHOOK_AVATAR_URL` - Your Discord Webhook Avatar, must be in URL form. Example: https://gyazo.com/421792b5ea817c36054c7991fb18cdbc +- `DISCORD_WEBHOOK_EMBED_COLOR_IN_DECIMAL_INDEX` - Embed color, you can found yours at [spycolor.com](https://www.spycolor.com/) and copy the one that said "has decimal index of: `take the value here`". Example: "9171753" for #8bf329 color. + +**Note on How to get DISCORD_WEBHOOK_X_URL** - See this: https://gyazo.com/539739f0bab50636e20a0fb76e9f1720 (settings in your respective channels) +#### Queue alert +- `DISABLE_DISCORD_WEBHOOK_SOMETHING_WRONG_ALERT`: [true|false] - Same as `DISABLE_SOMETHING_WROMG_ALERT`, but if set to false, it will be sent to Discord Webhook instead of Steam Chat. +- `DISCORD_WEBHOOK_SOMETHING_WRONG_ALERT_URL` - Discord Webhook URL for SOMETHING_WROMG_ALERT. + +#### Pricelist update +- `DISABLE_DISCORD_WEBHOOK_PRICE_UPDATE`: [true|false] - Used to display price updates on the items that are in your pricelist. +- `DISCORD_WEBHOOK_PRICE_UPDATE_URL` - Discord Webhook URL for PRICE_UPDATE. +- `DISCORD_WEBHOOK_PRICE_UPDATE_ADDITIONAL_DESCRIPTION_NOTE` - You can add note there, or just leave it empty. + +#### Successful trade summary +- `DISABLE_DISCORD_WEBHOOK_TRADE_SUMMARY`: [true|false] - Used to display every successful trade summary on your trade summary/live-trades channel. If set to false, it will send to your Steam Chat. +- `DISCORD_WEBHOOK_TRADE_SUMMARY_URL` - Discord Webhook URL for TRADE_SUMMARY. +- `DISCORD_WEBHOOK_TRADE_SUMMARY_SHOW_QUICK_LINKS`: [true|false] - Show trade partner quick links to their Steam profile, backpack.tf and SteamREP pages. +- `DISCORD_WEBHOOK_TRADE_SUMMARY_SHOW_KEY_RATE`: [true|false] - self explained. +- `DISCORD_WEBHOOK_TRADE_SUMMARY_SHOW_PURE_STOCK`: [true|false] - self explained. +- `DISCORD_WEBHOOK_TRADE_SUMMARY_ADDITIONAL_DESCRIPTION_NOTE` - Notes. +- `DISCORD_WEBHOOK_TRADE_SUMMARY_MENTION_OWNER` [true|false] - Set it to true if you want your bot to mention on every successful trades. +- `DISCORD_WEBHOOK_TRADE_SUMMARY_MENTION_OWNER_ONLY_ITEMS_SKU` [StringArray] - Support multiple items sku, let say you want to be mentioned on every unusual and australium trades, just do `[";5;u", ";11;australium"]`, or if you want to mention on specific item, just fill in the full item sku like `["725;6;uncraftable"]`, then to add more, just separate it with a comma between each sku string. + +![trade-summary-full](https://user-images.githubusercontent.com/47635037/86468435-ffdb4f80-bd69-11ea-9ab6-a7f5be2c22f0.PNG) + +![trade-summary-full2](https://user-images.githubusercontent.com/47635037/86468438-0073e600-bd6a-11ea-8bc0-040229c997d5.PNG) + +#### Offer review summary +- `DISABLE_DISCORD_WEBHOOK_OFFER_REVIEW`: [true|false] - Used to alert you on the trade that needs for offer review via Discord Webhook. If set to false, it will send to your Steam Chat. +- `DISCORD_WEBHOOK_REVIEW_OFFER_URL` - Discord Webhook URL for REVIEW_OFFER. +- `DISCORD_WEBHOOK_REVIEW_OFFER_SHOW_QUICK_LINKS`: [true|false] - Show trade partner quick links to their Steam profile, backpack.tf and SteamREP pages. +- `DISCORD_WEBHOOK_REVIEW_OFFER_DISABLE_MENTION_INVALID_VALUE`: [true|false] - Set to true if you want your bot to not mention on only INVALID_VALUE offer. +- `DISCORD_WEBHOOK_REVIEW_OFFER_SHOW_KEY_RATE`: [true|false] - self explained. +- `DISCORD_WEBHOOK_REVIEW_OFFER_SHOW_PURE_STOCK`: [true|false] - self explained. + +![only non-invalid-value2](https://user-images.githubusercontent.com/47635037/86468430-feaa2280-bd69-11ea-8f25-26a7a430b2e1.PNG) + +#### Messages +- `DISABLE_DISCORD_WEBHOOK_MESSAGE_FROM_PARTNER`: [true|false] - Used to alert you on any messages sent from trade partner. If set to false, it will send to your Steam Chat. +- `DISCORD_WEBHOOK_MESSAGE_FROM_PARTNER_URL` - Discord Webhook URL for MESSAGE_FROM_PARTNER. +- `DISCORD_WEBHOOK_MESSAGE_FROM_PARTNER_SHOW_QUICK_LINKS`: [true|false] - Show trade partner quick links to their Steam profile, backpack.tf and SteamREP pages. + +### Manual Review settings +- `ENABLE_MANUAL_REVIEW`: [true|false] - Set to true if you want any INVALID_VALUE/INVALID_ITEMS/OVERSTOCKED/DUPED_ITEMS/DUPE_CHECK_FAILED trades to be reviewed by you. +- `DISABLE_SHOW_REVIEW_OFFER_SUMMARY`: [true|false] - set to true if you do not want your bot to show offer summary to trade partner, but it will only notify trade partner that their offer is being hold for a review. +- `DISABLE_REVIEW_OFFER_NOTE`: [true|false] - If set to false, it will show note on [each error](https://github.com/idinium96/tf2autobot/blob/master/src/classes/MyHandler.ts#L1278-L1478) +- `DISABLE_SHOW_CURRENT_TIME`: [true|false] - If set to false, it will show owner time on offer review notification that trade partner will received. + +- `DISABLE_ACCEPT_INVALID_ITEMS_OVERPAY`: [true|false] - Default: false. Set to true if you want your bot to accept a trade with INVALID_ITEMS but with their value more or equal to our value. +- `DISABLE_ACCEPT_OVERSTOCKED_OVERPAY`: [true|false] - Default: false. Set to true if you want your bot to accept a trade with OVERSTOCKED but with their value more or equal to our value. +- `DISABLE_AUTO_DECLINE_INVALID_VALUE`: [true|false]: Default: false. Set to true if you want to automatically decline trade with **ONLY** `INVALID_VALUE` and did not match the exception sku(s) and exception value. + +- `INVALID_VALUE_EXCEPTION_SKUS` [StringArray] - An array of sku that will skip Invalid value if the difference between our and their value is not more than exception value in ref. Let say you want to trade an unusual, but then someone sent an offer with 0.11 ref less, but you want your bot to accept it anyway if it's less than 10 ref, so the trade will be accepted. By default, it will check only for any unusual and australium: `[";5;u", ";11;australium"]`, you can also leave it empty (`[""]`) so all with invalid value will be notified. +- `INVALID_VALUE_EXCEPTION_VALUE_IN_REF` [Number] - Exception value for the sku(s) that you set above. Default is `0` (no exception). + +- `INVALID_VALUE_NOTE` - Your custom INVALID_VALUE note. +- *`INVALID_ITEMS_NOTE` - Your custom INVALID_ITEMS note. +- *`OVERSTOCKED_NOTE` - Your custom OVERSTOCKED note. +- *`DUPE_ITEMS_NOTE` - Your custom DUPE_ITEMS note. +- *`DUPE_CHECK_FAILED_NOTE` - Your custom DUPE_CHECK_FAILED note. +- `ADDITIONAL_NOTE` - Your custom ADDITIONAL note. + +**Notes:** +On each reasons **except INVALID_VALUE**, you can put `%name%` to list all the items that are on that reason, and `%isName%` for plural of "is", where if %name% is just 1 item, it will use "is", else if more then one item, it will use "are". + +Example: +Let say the trade contains items with `INVALID_ITEMS`. The items are: Dueling Mini-Game, Secret Saxton. + +You use custom `INVALID_ITEMS` note as: "%name% %isName% not in my pricelist. Please wait for my owner to check it." +What the trade partner will received: "Dueling Mini-Game, Secret Saxton are not in my pricelist. Please wait for my owner to check it." + + +### Others +- `CUSTOM_PLAYING_GAME_NAME` - Custom name of the game your bot is playing. Limited to only 45 characters. Example: https://gyazo.com/308e4e05bf4c49929520df4e0064864c (you do not need to include that `- tf2-automatic`, just your custom game name but not more than 45 characters.) + +- `CUSTOM_WELCOME_MESSAGE` - Your custom WELCOME_MESSAGE note. Two parameters: `%name%` (display trade partner name) and `%admin%` (if admin, it will use "!help", else "!how2trade"). +- `CUSTOM_I_DONT_KNOW_WHAT_YOU_MEAN` - Your custom note when people sends wrong command. +- `CUSTOM_HOW2TRADE_MESSAGE` - Your custom HOW2TRADE note. + +- `CUSTOM_SUCCESS_MESSAGE` - Your custom SUCCESS note. +- `CUSTOM_DECLINED_MESSAGE` - Your custom DECLINED note. +- `CUSTOM_TRADED_AWAY_MESSAGE` - Your custom note when the bot failed to trade because the item is traded away. +- `CUSTOM_CLEARING_FRIENDS_MESSAGE` - Your custom note when the bot is removing friend to add someone else. From 06ac14ec0d134be4680d1a08e7626cef1a33532f Mon Sep 17 00:00:00 2001 From: idinium96 Date: Sat, 18 Jul 2020 20:51:30 +0800 Subject: [PATCH 29/31] apply some improvements --- src/classes/Commands.ts | 41 +++++++++++++++-------------------------- 1 file changed, 15 insertions(+), 26 deletions(-) diff --git a/src/classes/Commands.ts b/src/classes/Commands.ts index 9a6ece8b3..c485b9abe 100644 --- a/src/classes/Commands.ts +++ b/src/classes/Commands.ts @@ -1673,26 +1673,20 @@ export = class Commands { return; } - let uncraft = false; - if (params.sku.includes('uncraftable')) { - params.sku = params.sku.replace(';uncraftable', ''); - uncraft = true; - } + const uncraft = params.sku.includes(';uncraftable'); + params.sku = params.sku.replace(';uncraftable', ''); - let untrade = false; - if (params.sku.includes('untradable')) { - params.sku = params.sku.replace(';untradable', ''); - untrade = true; - } + const untrade = params.sku.includes(';untradable'); + params.sku = params.sku.replace(';untradable', ''); const item = SKU.fromString(params.sku); if (uncraft) { - item.craftable = false; + item.craftable = !uncraft; } if (untrade) { - item.tradable = false; + item.tradable = !untrade; } const assetids = this.bot.inventoryManager.getInventory().findBySKU(SKU.fromObject(item), false); @@ -2403,32 +2397,27 @@ export = class Commands { if (params.craftable !== undefined) { if (typeof params.craftable !== 'boolean') { - this.bot.sendMessage(steamID, `❌ Craftable must be "true" or "false" only.`); + this.bot.sendMessage(steamID, `Craftable must be "true" or "false" only.`); return null; } - if (params.craftable === false) { - item.craftable = false; - } else { - item.craftable = true; - } + item.craftable = params.craftable; } if (params.australium !== undefined) { if (typeof params.australium !== 'boolean') { - this.bot.sendMessage(steamID, `❌ Australium must be "true" or "false" only.`); + this.bot.sendMessage(steamID, `Australium must be "true" or "false" only.`); return null; } - if (params.australium === false) { - item.australium = false; - } else { - item.australium = true; - } + item.australium = params.australium; } if (params.killstreak !== undefined) { const killstreak = parseInt(params.killstreak); - if (isNaN(killstreak) || killstreak > 3) { - this.bot.sendMessage(steamID, `❌ Unknown killstreak "${params.killstreak}".`); + if (isNaN(killstreak) || killstreak < 1 || killstreak > 3) { + this.bot.sendMessage( + steamID, + `Unknown killstreak "${params.killstreak}", it must be between 1 (Basic KS), 2 (Spec KS) or 3 (Pro KS) only.` + ); return null; } item.killstreak = killstreak; From 0ae8228a098cb1b4c56cf8457d3a5c55bf49db1a Mon Sep 17 00:00:00 2001 From: idinium96 Date: Sat, 18 Jul 2020 20:51:41 +0800 Subject: [PATCH 30/31] update dependencies --- package-lock.json | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 341507a3f..60995778f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5200,9 +5200,9 @@ } }, "typescript": { - "version": "3.9.6", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.6.tgz", - "integrity": "sha512-Pspx3oKAPJtjNwE92YS05HQoY7z2SFyOpHo9MqJor3BXAGNaPUs83CuVp9VISFkSjyRfiTpmKuAYGJB7S7hOxw==", + "version": "3.9.7", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.7.tgz", + "integrity": "sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw==", "dev": true }, "undefsafe": { diff --git a/package.json b/package.json index 813b269ab..02c54ad36 100644 --- a/package.json +++ b/package.json @@ -80,7 +80,7 @@ "eslint-plugin-tsdoc": "^0.2.5", "nodemon": "^2.0.4", "prettier": "^1.19.1", - "typescript": "^3.9.6" + "typescript": "^3.9.7" }, "private": true } From 076ba98a889cfc4607f9c34c8486e18e71a71c5a Mon Sep 17 00:00:00 2001 From: idinium96 Date: Sat, 18 Jul 2020 20:54:02 +0800 Subject: [PATCH 31/31] do CI build check for node v14.x --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6618d2daf..81a78390f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ jobs: strategy: matrix: - node-version: [8.x, 10.x, 12.x] + node-version: [8.x, 10.x, 12.x, 14.x] steps: - uses: actions/checkout@master