A Discord bot that monitors Nintendo Store (Germany) products for stock availability and sends notifications when products come back in stock.
- 🔍 Real-time Monitoring: Continuously monitors Nintendo Store products for stock changes
- 🤖 Discord Integration: Sends embed notifications to Discord when products become available
- 📊 Database Storage: Tracks product information and stock status in PostgreSQL
- ⚡ Slash Commands: Easy to use Discord commands for managing monitored products
- 🛡️ Error Handling: Robust error handling with automatic restart capabilities
- ⏰ Configurable Intervals: Adjustable monitoring intervals for different scenarios
- Node.js (v18 or higher)
- PostgreSQL database
- Discord Bot Token and Application
-
Clone the repository
git clone https://github.com/yourusername/nintendo-product-monitor.git cd nintendo-product-monitor
-
Install dependencies
npm install
-
Set up the database
# Create PostgreSQL database and run the schema psql -U your_username -d postgres -f database.sql
-
Configure environment variables
cp .env.example .env
Edit
.env
with your configuration:DB_USER=your_db_user DB_PASSWORD=your_db_password DB_HOST=localhost DB_PORT=5432 DB_NAME=nintendomonitor DISCORD_BOT_TOKEN=your_bot_token DISCORD_APPLICATION_ID=your_application_id DISCORD_GUILD_ID=your_guild_id DISCORD_CHANNEL_ID=your_channel_id
-
Deploy Discord commands
node src/deploy-commands.js
-
Start the monitor
node src/monitor.js
Command | Description | Parameters |
---|---|---|
/addproduct |
Add a product to monitoring | product : Nintendo product ID |
/removeproduct |
Remove a product from monitoring | product : Nintendo product ID |
/showproducts |
Display all monitored products | None |
You can adjust monitoring intervals in src/monitor.js
:
const delay_mid = 300000; // 5 minutes
const delay_short = 5000; // 5 seconds
const delay_normal = 180000; // 3 minutes (default)
The application uses a single table monitor_products
:
CREATE TABLE monitor_products (
id SERIAL PRIMARY KEY,
product_id VARCHAR(50) UNIQUE NOT NULL,
product_name VARCHAR(250) NOT NULL,
product_price VARCHAR(50),
product_path VARCHAR(500),
product_img VARCHAR(500),
is_instock BOOLEAN DEFAULT FALSE,
added_at TIMESTAMP DEFAULT NOW()
);
- Product Monitoring: The bot fetches product data from Nintendo Store API using product IDs
- Stock Detection: Compares current stock status with stored database status
- Discord Notifications: Sends embed messages when products go from out-of-stock to in-stock
- Database Updates: Updates stock status in the database for future comparisons
To monitor a product, you need its Nintendo Store product ID:
- Visit the Nintendo Store Germany website
- Navigate to the product page
- The product ID can be found in the URL or by inspecting network requests
- Examples:
- Nintendo Switch 2:
000000000010015151
- Mario Kart World:
70010000096802
- Nintendo Switch 2:
The application includes comprehensive error handling:
- API Timeouts: 10 second timeout for Nintendo Store API requests
- Database Errors: Graceful handling of database connection issues
- Discord Errors: Continues monitoring even if Discord notifications fail
- Automatic Restart: Monitor automatically restarts after errors
- Heartbeat Logging: Regular status updates every 5 minutes
For production use, consider using a process manager like PM2:
npm install -g pm2
pm2 start src/monitor.js --name nintendo-monitor
pm2 startup
pm2 save
nintendo-product-monitor/
├── src/
│ ├── commands/
│ │ ├── addProductCommand.js
│ │ ├── removeProductCommand.js
│ │ └── showAllProductsCommand.js
│ ├── db.js
│ ├── deploy-commands.js
│ ├── manageProducts.js
│ └── monitor.js
├── database.sql
├── package.json
├── .env.example
└── README.md


- discord.js: Discord API wrapper
- axios: HTTP client for Nintendo Store API
- pg: PostgreSQL client
- dotenv: Environment variable management
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the ISC License.
This bot is for educational purposes only. Please respect Nintendo's terms of service and rate limits when using this application.