Skip to content

Commit

Permalink
🔀 Merge pull request #1680 from TF2Autobot/development
Browse files Browse the repository at this point in the history
v5.9.0
  • Loading branch information
idinium96 authored Nov 6, 2023
2 parents 6cf2d8b + 1ff27bd commit dc99830
Show file tree
Hide file tree
Showing 37 changed files with 273 additions and 153 deletions.
69 changes: 38 additions & 31 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@
"@tf2autobot/bptf-login": "^2.3.6",
"@tf2autobot/filter-axios-error": "^1.5.2",
"@tf2autobot/jsonlint": "^1.0.0",
"@tf2autobot/steamcommunity": "^3.47.0",
"@tf2autobot/steamcommunity": "^3.47.2",
"@tf2autobot/tf2": "^1.3.5",
"@tf2autobot/tf2-currencies": "^2.0.1",
"@tf2autobot/tf2-schema": "^4.2.15",
"@tf2autobot/tf2-sku": "^2.0.4",
"@tf2autobot/tradeoffer-manager": "^2.15.0",
"@tf2autobot/tradeoffer-manager": "^2.15.2",
"async": "^3.2.4",
"axios": "^1.4.0",
"bluebird": "^3.7.2",
Expand Down Expand Up @@ -63,9 +63,9 @@
"retry": "^0.13.1",
"semver": "^7.5.4",
"socket.io-client": "^4.7.1",
"steam-session": "^1.4.1",
"steam-session": "^1.7.1",
"steam-totp": "^2.1.2",
"steam-user": "^5.0.1",
"steam-user": "^5.0.2",
"steamid": "^2.0.0",
"url": "^0.11.1",
"valid-url": "^1.0.9",
Expand Down
2 changes: 1 addition & 1 deletion src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const botManager = new BotManager(

import ON_DEATH from 'death';
import * as inspect from 'util';
import { Webhook } from './lib/DiscordWebhook/interfaces';
import { Webhook } from './classes/DiscordWebhook/interfaces';
import axios, { AxiosError } from 'axios';
import { uptime } from './lib/tools/time';
import filterAxiosError from '@tf2autobot/filter-axios-error';
Expand Down
2 changes: 1 addition & 1 deletion src/classes/Autokeys/Autokeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Bot from '../Bot';
import { EntryData, KeyPrices, PricelistChangedSource } from '../Pricelist';
import log from '../../lib/logger';
import { currPure } from '../../lib/tools/pure';
import sendAlert from '../../lib/DiscordWebhook/sendAlert';
import sendAlert from '../DiscordWebhook/sendAlert';

export interface OverallStatus {
isBuyingKeys: boolean;
Expand Down
2 changes: 1 addition & 1 deletion src/classes/Bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import Groups from './Groups';

import log from '../lib/logger';
import Bans, { IsBanned } from '../lib/bans';
import { sendStats } from '../lib/DiscordWebhook/export';
import { sendStats } from './DiscordWebhook/export';

import Options from './Options';
import IPricer from './IPricer';
Expand Down
2 changes: 1 addition & 1 deletion src/classes/Carts/Cart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Bot from '../Bot';
import Pricelist from '../Pricelist';
import { BPTFGetUserInfo } from '../MyHandler/interfaces';
import log from '../../lib/logger';
import { sendAlert } from '../../lib/DiscordWebhook/export';
import { sendAlert } from '../DiscordWebhook/export';
import filterAxiosError from '@tf2autobot/filter-axios-error';

/**
Expand Down
2 changes: 1 addition & 1 deletion src/classes/Carts/CartQueue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import pluralize from 'pluralize';
import Cart from './Cart';
import Bot from '../Bot';
import log from '../../lib/logger';
import { sendAlert } from '../../lib/DiscordWebhook/export';
import { sendAlert } from '../DiscordWebhook/export';
import { uptime } from '../../lib/tools/export';
import { isBptfBanned } from '../../lib/bans';

Expand Down
42 changes: 38 additions & 4 deletions src/classes/Carts/UserCart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -514,15 +514,34 @@ export default class UserCart extends Cart {
};

// Add their items
for (const sku in this.their) {
for (let sku in this.their) {
if (!Object.prototype.hasOwnProperty.call(this.their, sku)) {
continue;
}

let alteredMessage: string;
let findByPartialSku = false;
let elevatedStrange = false;
const item_object = SKU.fromString(sku);
if (item_object.quality == 5 && !item_object.effect) {
log.debug('Generic Unusual in their cart, finding by partial sku');
findByPartialSku = true;
if (item_object.quality2 == 11) {
elevatedStrange = true;
}
}

let theirAssetids: string[];
let amount = this.getTheirCount(sku);
const theirAssetids = theirInventory.findBySKU(sku, true);
if (findByPartialSku) {
theirAssetids = theirInventory.findByPartialSku(sku, elevatedStrange);
if (theirAssetids.length > 0) {
sku = theirInventory.findByAssetid(theirAssetids[0]);
}
} else {
theirAssetids = theirInventory.findBySKU(sku, true);
}

let alteredMessage: string;
const theirAssetidsCount = theirAssetids.length;

if (amount > theirAssetidsCount) {
Expand Down Expand Up @@ -745,8 +764,23 @@ export default class UserCart extends Cart {
continue;
}

const item_object = SKU.fromString(sku);
let findByPartialSku = false;
let elevatedStrange = false;
if (item_object.quality == 5 && !item_object.effect) {
findByPartialSku = true;
if (item_object.quality2 == 11) {
elevatedStrange = true;
}
}

let assetids: string[];
const amount = this.their[sku];
let assetids = theirInventory.findBySKU(sku, true);
if (findByPartialSku) {
assetids = theirInventory.findByPartialSku(sku, elevatedStrange);
} else {
assetids = theirInventory.findBySKU(sku, true);
}

const addToDupeCheckList =
this.bot.pricelist
Expand Down
6 changes: 1 addition & 5 deletions src/classes/Commands/sub-classes/Manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -969,11 +969,7 @@ export default class ManagerCommands {
);

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

this.bot.sendMessage(steamID, '⌛ Compiling TypeScript codes into JavaScript...');
await exec('npm run build');
Expand Down
2 changes: 1 addition & 1 deletion src/classes/Commands/sub-classes/Message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Bot from '../../Bot';
import CommandParser from '../../CommandParser';
import log from '../../../lib/logger';
import { generateLinks, timeNow } from '../../../lib/tools/export';
import { sendPartnerMessage, sendAdminMessage } from '../../../lib/DiscordWebhook/export';
import { sendPartnerMessage, sendAdminMessage } from '../../DiscordWebhook/export';

export default class MessageCommand {
constructor(private readonly bot: Bot) {
Expand Down
2 changes: 1 addition & 1 deletion src/classes/Commands/sub-classes/Status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import * as timersPromises from 'timers/promises';
import Bot from '../../Bot';
import CommandParser from '../../CommandParser';
import { stats, profit, itemStats, testPriceKey } from '../../../lib/tools/export';
import { sendStats } from '../../../lib/DiscordWebhook/export';
import { sendStats } from '../../DiscordWebhook/export';
import loadPollData, { deletePollData } from '../../../lib/tools/polldata';
import SteamTradeOfferManager from '@tf2autobot/tradeoffer-manager';

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import * as timersPromises from 'timers/promises';
import { UnknownDictionary } from '../../types/common';
import { Webhook, sendWebhook } from './export';

import log from '../logger';
import { BuyAndSell } from '../../classes/Pricelist';
import Options from '../../classes/Options';
import log from '../../lib/logger';
import { BuyAndSell } from '../Pricelist';
import Options from '../Options';
import { WebhookError } from './utils';
import { BotInfo } from '../MyHandler/MyHandler';

const australiumImageURL: { [defindex: number]: string } = {
// Australium Ambassador
Expand Down Expand Up @@ -1789,7 +1790,8 @@ export default function sendWebHookPriceUpdateV1(
conversion: number,
buyChangesValue: number | null,
sellChangesValue: number | null,
isCustomPricer: boolean
isCustomPricer: boolean,
botInfo: BotInfo
): void {
const baseItemData = schema.getItemBySKU(sku);
const item = SKU.fromString(sku);
Expand Down Expand Up @@ -1884,8 +1886,8 @@ export default function sendWebHookPriceUpdateV1(

const opt = options.discordWebhook;
const priceUpdate: Webhook = {
username: opt.displayName,
avatar_url: opt.avatarURL,
username: opt.displayName || botInfo.name,
avatar_url: opt.avatarURL || botInfo.avatarURL,
content: '',
embeds: [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
import { sendWebhook } from './utils';
import { Webhook } from './interfaces';
import log from '../logger';
import { GetItemPriceResponse } from '../../classes/IPricer';
import log from '../../lib/logger';
import { GetItemPriceResponse } from '../IPricer';
import * as timersPromises from 'timers/promises';
import { UnknownDictionary } from '../../types/common';
import Options from '../../classes/Options';
import Options from '../Options';
import { BotInfo } from '../MyHandler/MyHandler';

export default function sendFailedPriceUpdate(
data: GetItemPriceResponse,
err: Error,
isCustomPricer: boolean,
options: Options
options: Options,
botInfo: BotInfo
): void {
const opt = options.discordWebhook;
const priceUpdate: Webhook = {
username: opt.displayName,
avatar_url: opt.avatarURL,
username: opt.displayName || botInfo.name,
avatar_url: opt.avatarURL || botInfo.avatarURL,
content: '',
embeds: [
{
Expand Down
Loading

0 comments on commit dc99830

Please sign in to comment.