Skip to content

Commit d575d55

Browse files
committed
Merge branch 'master' into IPC
2 parents b040d0e + 432af6b commit d575d55

38 files changed

+279
-156
lines changed

.example/options.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@
117117
},
118118
"priceAge": {
119119
"maxInSeconds": 28800
120+
},
121+
"rewriteFile": {
122+
"count": 1
120123
}
121124
},
122125
"bypass": {

package-lock.json

Lines changed: 40 additions & 33 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tf2autobot",
3-
"version": "5.8.4",
3+
"version": "5.9.0",
44
"description": "Fully automated TF2 trading bot advertising on www.backpack.tf using prices from www.prices.tf, Originally made by Nicklason.",
55
"main": "dist/app.js",
66
"scripts": {
@@ -30,12 +30,12 @@
3030
"@tf2autobot/bptf-login": "^2.3.6",
3131
"@tf2autobot/filter-axios-error": "^1.5.2",
3232
"@tf2autobot/jsonlint": "^1.0.0",
33-
"@tf2autobot/steamcommunity": "^3.47.0",
33+
"@tf2autobot/steamcommunity": "^3.47.2",
3434
"@tf2autobot/tf2": "^1.3.5",
3535
"@tf2autobot/tf2-currencies": "^2.0.1",
3636
"@tf2autobot/tf2-schema": "^4.2.15",
3737
"@tf2autobot/tf2-sku": "^2.0.4",
38-
"@tf2autobot/tradeoffer-manager": "^2.15.0",
38+
"@tf2autobot/tradeoffer-manager": "^2.15.2",
3939
"async": "^3.2.4",
4040
"axios": "^1.4.0",
4141
"bluebird": "^3.7.2",
@@ -65,9 +65,9 @@
6565
"retry": "^0.13.1",
6666
"semver": "^7.5.4",
6767
"socket.io-client": "^4.7.1",
68-
"steam-session": "^1.4.1",
68+
"steam-session": "^1.7.1",
6969
"steam-totp": "^2.1.2",
70-
"steam-user": "^5.0.1",
70+
"steam-user": "^5.0.2",
7171
"steamid": "^2.0.0",
7272
"url": "^0.11.1",
7373
"valid-url": "^1.0.9",

src/app.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ const botManager = new BotManager(
6767

6868
import ON_DEATH from 'death';
6969
import * as inspect from 'util';
70-
import { Webhook } from './lib/DiscordWebhook/interfaces';
70+
import { Webhook } from './classes/DiscordWebhook/interfaces';
7171
import axios, { AxiosError } from 'axios';
7272
import { uptime } from './lib/tools/time';
7373
import filterAxiosError from '@tf2autobot/filter-axios-error';

src/classes/Autokeys/Autokeys.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Bot from '../Bot';
44
import { EntryData, KeyPrices, PricelistChangedSource } from '../Pricelist';
55
import log from '../../lib/logger';
66
import { currPure } from '../../lib/tools/pure';
7-
import sendAlert from '../../lib/DiscordWebhook/sendAlert';
7+
import sendAlert from '../DiscordWebhook/sendAlert';
88

99
export interface OverallStatus {
1010
isBuyingKeys: boolean;

src/classes/Bot.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import Groups from './Groups';
3939

4040
import log from '../lib/logger';
4141
import Bans, { IsBanned } from '../lib/bans';
42-
import { sendStats } from '../lib/DiscordWebhook/export';
42+
import { sendStats } from './DiscordWebhook/export';
4343

4444
import Options from './Options';
4545
import IPricer from './IPricer';

src/classes/Carts/Cart.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import Bot from '../Bot';
99
import Pricelist from '../Pricelist';
1010
import { BPTFGetUserInfo } from '../MyHandler/interfaces';
1111
import log from '../../lib/logger';
12-
import { sendAlert } from '../../lib/DiscordWebhook/export';
12+
import { sendAlert } from '../DiscordWebhook/export';
1313
import filterAxiosError from '@tf2autobot/filter-axios-error';
1414

1515
/**

src/classes/Carts/CartQueue.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import pluralize from 'pluralize';
55
import Cart from './Cart';
66
import Bot from '../Bot';
77
import log from '../../lib/logger';
8-
import { sendAlert } from '../../lib/DiscordWebhook/export';
8+
import { sendAlert } from '../DiscordWebhook/export';
99
import { uptime } from '../../lib/tools/export';
1010
import { isBptfBanned } from '../../lib/bans';
1111

src/classes/Carts/UserCart.ts

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -514,15 +514,34 @@ export default class UserCart extends Cart {
514514
};
515515

516516
// Add their items
517-
for (const sku in this.their) {
517+
for (let sku in this.their) {
518518
if (!Object.prototype.hasOwnProperty.call(this.their, sku)) {
519519
continue;
520520
}
521521

522-
let alteredMessage: string;
522+
let findByPartialSku = false;
523+
let elevatedStrange = false;
524+
const item_object = SKU.fromString(sku);
525+
if (item_object.quality == 5 && !item_object.effect) {
526+
log.debug('Generic Unusual in their cart, finding by partial sku');
527+
findByPartialSku = true;
528+
if (item_object.quality2 == 11) {
529+
elevatedStrange = true;
530+
}
531+
}
523532

533+
let theirAssetids: string[];
524534
let amount = this.getTheirCount(sku);
525-
const theirAssetids = theirInventory.findBySKU(sku, true);
535+
if (findByPartialSku) {
536+
theirAssetids = theirInventory.findByPartialSku(sku, elevatedStrange);
537+
if (theirAssetids.length > 0) {
538+
sku = theirInventory.findByAssetid(theirAssetids[0]);
539+
}
540+
} else {
541+
theirAssetids = theirInventory.findBySKU(sku, true);
542+
}
543+
544+
let alteredMessage: string;
526545
const theirAssetidsCount = theirAssetids.length;
527546

528547
if (amount > theirAssetidsCount) {
@@ -745,8 +764,23 @@ export default class UserCart extends Cart {
745764
continue;
746765
}
747766

767+
const item_object = SKU.fromString(sku);
768+
let findByPartialSku = false;
769+
let elevatedStrange = false;
770+
if (item_object.quality == 5 && !item_object.effect) {
771+
findByPartialSku = true;
772+
if (item_object.quality2 == 11) {
773+
elevatedStrange = true;
774+
}
775+
}
776+
777+
let assetids: string[];
748778
const amount = this.their[sku];
749-
let assetids = theirInventory.findBySKU(sku, true);
779+
if (findByPartialSku) {
780+
assetids = theirInventory.findByPartialSku(sku, elevatedStrange);
781+
} else {
782+
assetids = theirInventory.findBySKU(sku, true);
783+
}
750784

751785
const addToDupeCheckList =
752786
this.bot.pricelist

src/classes/Commands/sub-classes/Manager.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -969,11 +969,7 @@ export default class ManagerCommands {
969969
);
970970

971971
this.bot.sendMessage(steamID, '⌛ Installing packages...');
972-
await exec(
973-
`npm install${
974-
process.env.RUN_ON_ANDROID === 'true' ? ' --no-bin-links --force' : ''
975-
} --no-audit`
976-
);
972+
await exec(`npm install${process.env.RUN_ON_ANDROID === 'true' ? ' --no-bin-links --force' : ''}`);
977973

978974
this.bot.sendMessage(steamID, '⌛ Compiling TypeScript codes into JavaScript...');
979975
await exec('npm run build');

src/classes/Commands/sub-classes/Message.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Bot from '../../Bot';
33
import CommandParser from '../../CommandParser';
44
import log from '../../../lib/logger';
55
import { generateLinks, timeNow } from '../../../lib/tools/export';
6-
import { sendPartnerMessage, sendAdminMessage } from '../../../lib/DiscordWebhook/export';
6+
import { sendPartnerMessage, sendAdminMessage } from '../../DiscordWebhook/export';
77

88
export default class MessageCommand {
99
constructor(private readonly bot: Bot) {

src/classes/Commands/sub-classes/Status.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import * as timersPromises from 'timers/promises';
66
import Bot from '../../Bot';
77
import CommandParser from '../../CommandParser';
88
import { stats, profit, itemStats, testPriceKey } from '../../../lib/tools/export';
9-
import { sendStats } from '../../../lib/DiscordWebhook/export';
9+
import { sendStats } from '../../DiscordWebhook/export';
1010
import loadPollData, { deletePollData } from '../../../lib/tools/polldata';
1111
import SteamTradeOfferManager from '@tf2autobot/tradeoffer-manager';
1212

src/lib/DiscordWebhook/pricelistUpdate.ts renamed to src/classes/DiscordWebhook/pricelistUpdate.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ import * as timersPromises from 'timers/promises';
55
import { UnknownDictionary } from '../../types/common';
66
import { Webhook, sendWebhook } from './export';
77

8-
import log from '../logger';
9-
import { BuyAndSell } from '../../classes/Pricelist';
10-
import Options from '../../classes/Options';
8+
import log from '../../lib/logger';
9+
import { BuyAndSell } from '../Pricelist';
10+
import Options from '../Options';
1111
import { WebhookError } from './utils';
12+
import { BotInfo } from '../MyHandler/MyHandler';
1213

1314
const australiumImageURL: { [defindex: number]: string } = {
1415
// Australium Ambassador
@@ -1789,7 +1790,8 @@ export default function sendWebHookPriceUpdateV1(
17891790
conversion: number,
17901791
buyChangesValue: number | null,
17911792
sellChangesValue: number | null,
1792-
isCustomPricer: boolean
1793+
isCustomPricer: boolean,
1794+
botInfo: BotInfo
17931795
): void {
17941796
const baseItemData = schema.getItemBySKU(sku);
17951797
const item = SKU.fromString(sku);
@@ -1884,8 +1886,8 @@ export default function sendWebHookPriceUpdateV1(
18841886

18851887
const opt = options.discordWebhook;
18861888
const priceUpdate: Webhook = {
1887-
username: opt.displayName,
1888-
avatar_url: opt.avatarURL,
1889+
username: opt.displayName || botInfo.name,
1890+
avatar_url: opt.avatarURL || botInfo.avatarURL,
18891891
content: '',
18901892
embeds: [
18911893
{

0 commit comments

Comments
 (0)