#include "message.h" #include "client.h" namespace SleepyDiscord { Message::Message(json::Value& json) : Message(json::fromJSON(json)) {} bool Message::startsWith(const std::string& test) { return content.compare(0, test.length(), test) == 0; } std::size_t Message::length() { return content.length(); } bool Message::isMentioned(Snowflake userID) { std::size_t size = mentions.size(); for (std::size_t i = 0; i < size; i++) if (mentions[i].ID == userID) return true; return false; } bool Message::isMentioned(User& _user) { return isMentioned(_user.ID); } Message Message::send(BaseDiscordClient* client) { return client->sendMessage(channelID, content, embeds, messageReference, static_cast(tts)); } Message Message::reply(BaseDiscordClient * client, std::string message, Embed embed) { return client->sendMessage(channelID, message, { embed }); } Message::Interaction::Interaction(const json::Value& json) : Interaction(json::fromJSON(json)) {} Emoji::~Emoji() { } Emoji::Emoji(const json::Value& json) : Emoji(json::fromJSON(json)) { } Reaction::~Reaction() { } Reaction::Reaction(const json::Value& json) : Reaction(json::fromJSON(json)) { } StickerPack::~StickerPack() {} StickerPack::StickerPack(const json::Value & json): StickerPack(json::fromJSON(json)) {} Sticker::~Sticker() {} Sticker::Sticker(const json::Value & json): Sticker(json::fromJSON(json)) {} MessageReference::MessageReference(const json::Value & json): MessageReference(json::fromJSON(json)) {} AllowedMentions::AllowedMentions(const json::Value & json): AllowedMentions(json::fromJSON(json)) {} ActionRow::ActionRow(json::Value& json) : ActionRow(json::fromJSON(json)) {} Button::Button(const json::Value& json) : Button(json::fromJSON