forked from rcxpony/sparkle
16 lines
557 B
C++
16 lines
557 B
C++
#ifndef API_CHANNEL_HPP_
|
|
#define API_CHANNEL_HPP_
|
|
#include <includes.hpp>
|
|
#include <net.hpp>
|
|
class Channel {
|
|
private:
|
|
nlohmann::json data;
|
|
WebSocket& web;
|
|
NetworkManager& req;
|
|
public:
|
|
Channel(const nlohmann::json& data = "") : data(data), web(WebSocket::getInstance()), req(NetworkManager::getInstance()) {}
|
|
std::string send(const nlohmann::json& msg) {
|
|
return req.request(HttpMethods::POST, DiscordEndpoints::details::latest + "/channels/" + data["d"]["channel_id"].get<std::string>() + "/messages", msg.dump());
|
|
}
|
|
};
|
|
#endif |