2024-12-31 02:20:56 +05:00
|
|
|
#ifndef API_CHANNEL_HPP_
|
|
|
|
#define API_CHANNEL_HPP_
|
2025-01-15 13:34:41 +05:00
|
|
|
#include <includes.h>
|
|
|
|
#include <net.h>
|
|
|
|
using std::string, std::cout, std::endl, nlohmann::json;
|
2024-12-31 02:20:56 +05:00
|
|
|
class Channel {
|
|
|
|
private:
|
|
|
|
json data;
|
|
|
|
WebSocket& web;
|
|
|
|
NetworkManager& req;
|
|
|
|
public:
|
2025-01-13 22:30:24 +05:00
|
|
|
Channel(const json& data = "") : data(data), web(WebSocket::getInstance()), req(NetworkManager::getInstance()) {}
|
|
|
|
string send(const json& msg) {
|
2024-12-31 05:58:15 +05:00
|
|
|
return req.request("POST", dapi + "/channels/" + data["d"]["channel_id"].get<string>() + "/messages", msg.dump());
|
2024-12-31 02:20:56 +05:00
|
|
|
}
|
|
|
|
};
|
|
|
|
#endif
|