This repository has been archived on 2025-03-15. You can view files and clone it, but cannot push or open issues or pull requests.
sparkle/libs/api/Channel.hpp

16 lines
553 B
C++
Raw Permalink Normal View History

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>
2024-12-31 02:20:56 +05:00
class Channel {
private:
2025-01-20 16:07:42 +05:00
nlohmann::json data;
2024-12-31 02:20:56 +05:00
WebSocket& web;
NetworkManager& req;
public:
2025-01-20 16:07:42 +05:00
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());
2024-12-31 02:20:56 +05:00
}
};
#endif