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

17 lines
570 B
C++
Raw 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>
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) {
2025-01-19 04:35:20 +05:00
return req.request(HttpMethods::POST, DiscordEndpoints::details::latest + "/channels/" + data["d"]["channel_id"].get<string>() + "/messages", msg.dump());
2024-12-31 02:20:56 +05:00
}
};
#endif