index.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #!/usr/bin/env node
  2. import { CONFIG } from './src/config/index.js';
  3. import { setLogLevel } from './src/utils/index.js';
  4. import { startSniper, showStatus, clearCache } from './src/commands/index.js';
  5. // Set log level
  6. setLogLevel(CONFIG.LOG_LEVEL);
  7. // Parse command line arguments
  8. const args = process.argv.slice(2);
  9. const command = args[0] || 'start';
  10. switch (command) {
  11. case 'start':
  12. case 'sniper':
  13. case 'run':
  14. startSniper().catch(error => {
  15. console.error('Fatal error:', error);
  16. process.exit(1);
  17. });
  18. break;
  19. case 'status':
  20. case 'st':
  21. showStatus();
  22. break;
  23. case 'clear':
  24. case 'clean':
  25. clearCache();
  26. break;
  27. case 'help':
  28. case '--help':
  29. case '-h':
  30. console.log(`
  31. Byreal Sniper Bot - Automated LP Position Sniper
  32. Usage:
  33. node index.js [command]
  34. Commands:
  35. start, sniper, run Start the sniper bot (default)
  36. status, st Show current copied and closed positions
  37. clear, clean Clear all position caches
  38. help Show this help message
  39. Configuration:
  40. Edit .env file to configure:
  41. - PRIVATE_KEY: Your wallet private key
  42. - COPY_MULTIPLIER: Copy multiplier (default: 1.5)
  43. - MAX_USD_VALUE: Maximum position size
  44. - POLL_INTERVAL_MS: Polling interval
  45. `);
  46. break;
  47. default:
  48. console.log(`Unknown command: ${command}`);
  49. console.log('Run "node index.js help" for usage information');
  50. process.exit(1);
  51. }