sparkle/libs/api/Channel.hpp
2025-01-15 13:34:41 +05:00

17 lines
530 B
C++

#ifndef API_CHANNEL_HPP_
#define API_CHANNEL_HPP_
#include <includes.h>
#include <net.h>
using std::string, std::cout, std::endl, nlohmann::json;
class Channel {
private:
json data;
WebSocket& web;
NetworkManager& req;
public:
Channel(const json& data = "") : data(data), web(WebSocket::getInstance()), req(NetworkManager::getInstance()) {}
string send(const json& msg) {
return req.request("POST", dapi + "/channels/" + data["d"]["channel_id"].get<string>() + "/messages", msg.dump());
}
};
#endif