first commit
This commit is contained in:
commit
7349b743e3
21 files changed
+1527
No files matched your search
@@ -0,0 +1,34 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <optional>
|
||||
|
||||
// Builds and sends the same "stock update" embed the python script sent via
|
||||
// webhook, but preferring the bot's own REST API (POST /channels/{id}/messages)
|
||||
// since we now have a real bot token. Falls back to a legacy webhook URL if
|
||||
// no channel id is configured.
|
||||
class DiscordNotifier {
|
||||
public:
|
||||
DiscordNotifier(std::string bot_token, std::string channel_id, std::string webhook_url);
|
||||
|
||||
void sendStockUpdate(const std::string& url,
|
||||
const std::vector<std::string>& offers,
|
||||
const std::string& change_text,
|
||||
bool ping,
|
||||
std::optional<double> min_price,
|
||||
std::optional<double> max_price,
|
||||
const std::vector<std::string>& keywords);
|
||||
|
||||
private:
|
||||
std::string bot_token_;
|
||||
std::string channel_id_;
|
||||
std::string webhook_url_;
|
||||
|
||||
std::string buildPayload(const std::string& url,
|
||||
const std::vector<std::string>& offers,
|
||||
const std::string& change_text,
|
||||
bool ping,
|
||||
std::optional<double> min_price,
|
||||
std::optional<double> max_price,
|
||||
const std::vector<std::string>& keywords) const;
|
||||
};
|
||||
Reference in new issue
Block a user