2024-12-31 02:20:56 +05:00
|
|
|
#ifndef API_EMBED_HPP_
|
|
|
|
#define API_EMBED_HPP_
|
2025-01-15 13:34:41 +05:00
|
|
|
#include <includes.h>
|
|
|
|
using std::string, std::cout, std::endl, nlohmann::json;
|
2024-12-31 02:20:56 +05:00
|
|
|
class EmbedBuilder {
|
|
|
|
private:
|
|
|
|
json embed = {
|
|
|
|
{"content", ""},
|
|
|
|
{"tts", false},
|
|
|
|
{"embeds", json::array()}
|
|
|
|
}, data;
|
|
|
|
public:
|
|
|
|
EmbedBuilder(const json& data) : data(data) {
|
|
|
|
embed = {
|
|
|
|
{"content", ""},
|
|
|
|
{"tts", false},
|
|
|
|
{"embeds", json::array()}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
EmbedBuilder& addTitle(const string& title) {
|
|
|
|
if (embed["embeds"].size() == 0) {
|
|
|
|
embed["embeds"].push_back(json::object());
|
|
|
|
}
|
|
|
|
embed["embeds"].back()["title"] = title;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
EmbedBuilder& addDescription(const string& desc) {
|
|
|
|
if (embed["embeds"].size() == 0) {
|
|
|
|
embed["embeds"].push_back(json::object());
|
|
|
|
}
|
|
|
|
embed["embeds"].back()["description"] = desc;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
EmbedBuilder& addColor(const string& color) {
|
|
|
|
if (embed["embeds"].size() == 0) {
|
|
|
|
embed["embeds"].push_back(json::object());
|
|
|
|
}
|
|
|
|
embed["embeds"].back()["color"] = color;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
EmbedBuilder& addUrl(const string& url) {
|
|
|
|
if (embed["embeds"].size() == 0) {
|
|
|
|
embed["embeds"].push_back(json::object());
|
|
|
|
}
|
|
|
|
embed["embeds"].back()["url"] = url;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
EmbedBuilder& addImage(const string& imageurl) {
|
|
|
|
if (embed["embeds"].size() == 0) {
|
|
|
|
embed["embeds"].push_back(json::object());
|
|
|
|
}
|
|
|
|
embed["embeds"].back()["image"] = { {"url", imageurl} };
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
json getEmbed() const {
|
|
|
|
return embed;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
#endif
|