How jdnick27/x-bot works
Project type and purpose
• This is a small Node.js bot (an automation/tool) that periodically pulls Pokémon TCG card data from the Pokémon TCG API, downloads the card images, and posts them to an X (formerly Twitter) account.
File structure
• Top-level scripts:
• index.js – entry point, drives the workflow
• fetchPokemonData.js – handles API calls to the Pokémon TCG service
• twitterClient.js – wraps the X API posting logic
• utilities.js – helper functions (e.g., parsing, file operations)
• fetchPokemonData.js & twitterClient.js both rely on environment variables (.env)
• Configuration/data files:
• pokemon_card_sets.txt – list of set IDs to fetch
• package.json / package-lock.json – dependencies (axios, node-fs, dotenv, twitter-api-v2, etc.)
• Artifacts/storage:
• images/ – local folder where card images are saved
• banner.png, profilepic.jpg – static assets for the X profile
README for additional insights
• Workflow:
1. Read set IDs from pokemon_card_sets.txt
2. Call Pokémon TCG API → retrieve card metadata (including image URL)
3. Download the card image to images/
4. Post the image + caption to X via twitterClient.js
• Configuration: environment variables for both APIs stored in .env