Files
2026-08-09 16:51:01 -05:00

37 lines
1.5 KiB
C++

#pragma once
#include <string>
#include <vector>
#include <optional>
// Per-watched-link settings (mirrors the Python `link_configs` dicts).
struct LinkConfig {
std::string url;
std::string label;
std::optional<double> min_price;
std::optional<double> max_price;
std::vector<std::string> keywords;
bool paused = false;
};
// Whole-application configuration, loaded from / saved to a JSON file on disk
// so the bot remembers its watch list and settings between restarts.
struct AppConfig {
std::string discord_bot_token; // required: bot token for the control bot
std::string discord_channel_id; // channel the bot posts stock alerts to
std::string discord_webhook_url; // optional legacy fallback (like the python script)
std::string command_guild_id; // optional: register slash commands to one guild (instant sync while testing)
std::string cookie_header; // optional "Cookie: ..." value for authenticated scraping
std::string user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) LZTSniperCpp/1.0";
int interval_seconds = 180;
bool autostart = false; // start monitoring immediately on launch
std::vector<LinkConfig> links;
// Loads config from `path`. Returns a default-constructed AppConfig (with
// an empty token) if the file does not exist yet.
static AppConfig load(const std::string& path);
// Persists the current config (including live link list / pause state)
// back to `path` as pretty-printed JSON.
void save(const std::string& path) const;
};