switched to new way :)
This commit is contained in:
parent
b03a2a25f1
commit
f22d182c8f
30 changed files with 0 additions and 0 deletions
55
src-old/index.ts
Normal file
55
src-old/index.ts
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
import { Command } from 'commander';
|
||||
import { loadConfig } from './config.js';
|
||||
import { Bot } from './bot/Bot.js';
|
||||
import { Server } from './server/Server.js';
|
||||
import { ConfigStore } from './bot/ConfigStore.js';
|
||||
import { logger } from './util/logger.js';
|
||||
|
||||
const program = new Command();
|
||||
|
||||
program
|
||||
.name('poe2trade')
|
||||
.description('POE2 automated trade bot')
|
||||
.option('-u, --url <urls...>', 'Trade search URLs to monitor')
|
||||
.option('--log-path <path>', 'Path to POE2 Client.txt')
|
||||
.option('-p, --port <number>', 'Dashboard port')
|
||||
.option('-c, --config <path>', 'Path to config.json', 'config.json')
|
||||
.action(async (options) => {
|
||||
const store = new ConfigStore(options.config);
|
||||
const saved = store.settings;
|
||||
|
||||
const envConfig = loadConfig(options.url);
|
||||
if (options.logPath) envConfig.poe2LogPath = options.logPath;
|
||||
|
||||
const config = {
|
||||
...envConfig,
|
||||
poe2LogPath: options.logPath || saved.poe2LogPath,
|
||||
poe2WindowTitle: saved.poe2WindowTitle,
|
||||
browserUserDataDir: saved.browserUserDataDir,
|
||||
travelTimeoutMs: saved.travelTimeoutMs,
|
||||
stashScanTimeoutMs: saved.stashScanTimeoutMs,
|
||||
waitForMoreItemsMs: saved.waitForMoreItemsMs,
|
||||
betweenTradesDelayMs: saved.betweenTradesDelayMs,
|
||||
};
|
||||
|
||||
const port = parseInt(options.port, 10) || saved.dashboardPort;
|
||||
|
||||
const bot = new Bot(store, config);
|
||||
const server = new Server(bot, port);
|
||||
await server.start();
|
||||
await bot.start(config.tradeUrls, port);
|
||||
|
||||
const shutdown = async () => {
|
||||
logger.info('Shutting down...');
|
||||
await bot.stop();
|
||||
await server.stop();
|
||||
process.exit(0);
|
||||
};
|
||||
|
||||
process.on('SIGINT', shutdown);
|
||||
process.on('SIGTERM', shutdown);
|
||||
|
||||
logger.info(`Dashboard: http://localhost:${port}`);
|
||||
});
|
||||
|
||||
program.parse();
|
||||
Loading…
Add table
Add a link
Reference in a new issue