sparkle/libs/api/Channel.hpp

23 lines
638 B
C++
Raw Normal View History

2024-12-31 02:20:56 +05:00
#ifndef API_CHANNEL_HPP_
#define API_CHANNEL_HPP_
#include <string>
#include <iostream>
2025-01-13 14:40:21 +05:00
#include <tls/Network.hpp>
2025-01-13 22:30:24 +05:00
#include <api/Author.hpp>
2025-01-13 14:40:21 +05:00
#include <gateway/Websocket.hpp>
2024-12-31 02:20:56 +05:00
#include <utils/types.hpp>
using std::string;
using std::cout;
using std::endl;
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