Skip to content

Commit

Permalink
Revert "Easy copy paste implementation"
Browse files Browse the repository at this point in the history
  • Loading branch information
Dex-Spirit authored Aug 3, 2024
1 parent b21c038 commit a1e22fe
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 66 deletions.
4 changes: 0 additions & 4 deletions package-lock.json

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

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
"discord.js": "^14.14.1",
"dot-prop": "^6.0.1",
"dotenv": "^16.4.5",
"easycopypaste": "github:TryHardDo/EasyCopyPaste",
"express": "^4.19.2",
"isobject": "^4.0.0",
"js-levenshtein": "^1.1.6",
Expand Down
15 changes: 0 additions & 15 deletions src/classes/Bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ import ipcHandler from './IPC';
import filterAxiosError from '@tf2autobot/filter-axios-error';
import { axiosAbortSignal } from '../lib/helpers';
import { apiRequest } from '../lib/apiRequest';
import EasyCopyPaste from 'easycopypaste';

export interface SteamTokens {
refreshToken: string;
Expand Down Expand Up @@ -176,8 +175,6 @@ export default class Bot {

public periodicCheckAdmin: NodeJS.Timeout;

readonly ecp: EasyCopyPaste;

constructor(public readonly botManager: BotManager, public options: Options, readonly priceSource: IPricer) {
this.botManager = botManager;

Expand All @@ -194,23 +191,11 @@ export default class Bot {
globalAssetCache: true,
assetCacheMaxItems: 50
});

// ECP --START--
this.ecp = new EasyCopyPaste();
const ecpSettings = options.miscSettings.ecp;

if (ecpSettings) {
this.ecp.useBoldChars = ecpSettings.useBoldChars ?? false;
this.ecp.useWordSwap = ecpSettings.useWordSwap ?? true;
}
// ECP --END--

this.bptf = new BptfLogin();
this.tf2 = new TF2(this.client);
this.friends = new Friends(this);
this.groups = new Groups(this);
this.trades = new Trades(this);

this.listings = new Listings(this);
this.tf2gc = new TF2GC(this);

Expand Down
23 changes: 2 additions & 21 deletions src/classes/Commands/Commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,25 +298,6 @@ export default class Commands {
custom ? custom.replace('%command%', command) : `❌ Command "${command}" not found!`
);
}
} else {
if (message.includes('_')) {
const intentDescriptor = this.bot.ecp.reverseEcpStr(message);

if (intentDescriptor === undefined) {
return this.bot.sendMessage(
steamID,
'Item could not be decoded. Please use the standard !buy or !sell command!'
);
}

this.buyOrSellCommand(
steamID,
intentDescriptor.originalItemName,
intentDescriptor.decodedIntent as Instant,
null,
true
);
}
}
}

Expand Down Expand Up @@ -459,7 +440,7 @@ export default class Commands {

// Instant item trade

private buyOrSellCommand(steamID: SteamID, message: string, command: Instant, prefix: string, ecp = false): void {
private buyOrSellCommand(steamID: SteamID, message: string, command: Instant, prefix: string): void {
const opt = this.bot.options.commands[command === 'b' ? 'buy' : command === 's' ? 'sell' : command];

if (!opt.enable) {
Expand All @@ -471,7 +452,7 @@ export default class Commands {

const info = getItemAndAmount(
steamID,
ecp ? message : CommandParser.removeCommand(message),
CommandParser.removeCommand(message),
this.bot,
prefix,
command === 'b' ? 'buy' : command === 's' ? 'sell' : command
Expand Down
3 changes: 0 additions & 3 deletions src/classes/Listings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -695,12 +695,9 @@ export default class Listings {
.toString();
const amountTrade = amountCanTrade.toString();

const ecpString = this.bot.ecp.toEcpStr(entry.id ?? entry.name, key);

return details
.replace(/%price%/g, isShowBoldOnPrice ? boldDetails(price, style) : price)
.replace(/%name%/g, entry.id ?? entry.name)
.replace(/%ecp_item%/g, ecpString)
.replace(/%max_stock%/g, isShowBoldOnMaxStock ? boldDetails(maxStock, style) : maxStock)
.replace(/%current_stock%/g, isShowBoldOnCurrentStock ? boldDetails(currentStock, style) : currentStock)
.replace(/%amount_trade%/g, isShowBoldOnAmount ? boldDetails(amountTrade, style) : amountTrade);
Expand Down
10 changes: 0 additions & 10 deletions src/classes/Options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,6 @@ export const DEFAULTS: JsonOptions = {
prefixes: {
steam: '!',
discord: '!'
},
ecp: {
useBoldChars: false,
useWordSwap: true
}
},

Expand Down Expand Up @@ -1224,19 +1220,13 @@ interface MiscSettings {
reputationCheck?: ReputationCheck;
pricecheckAfterTrade?: OnlyEnable;
prefixes?: Prefixes;
ecp?: EcpSettings;
}

interface Prefixes {
steam?: string;
discord?: string;
}

interface EcpSettings {
useBoldChars?: boolean;
useWordSwap?: boolean;
}

export interface ReputationCheck {
checkMptfBanned?: boolean;
}
Expand Down
12 changes: 0 additions & 12 deletions src/schemas/options-json/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -503,18 +503,6 @@ export const optionsSchema: jsonschema.Schema = {
}
},
additionalProperties: false
},
ecp: {
type: 'object',
properties: {
useBoldChars: {
type: 'boolean'
},
useWordSwap: {
type: 'boolean'
}
},
additionalProperties: false
}
},
required: [
Expand Down

0 comments on commit a1e22fe

Please sign in to comment.