feat: include more data when copying messages as JSON (#5600)

This commit is contained in:
nerix
2024-09-28 12:40:15 +02:00
committed by GitHub
parent edf18a7a0f
commit e149be3820
16 changed files with 504 additions and 33 deletions
@@ -1,5 +1,6 @@
#include "providers/twitch/ChannelPointReward.hpp"
#include "common/Literals.hpp"
#include "messages/Image.hpp"
#include <QStringBuilder>
@@ -15,6 +16,8 @@ QString twitchChannelPointRewardUrl(const QString &file)
namespace chatterino {
using namespace literals;
ChannelPointReward::ChannelPointReward(const QJsonObject &redemption)
{
auto reward = redemption.value("reward").toObject();
@@ -113,4 +116,25 @@ ChannelPointReward::ChannelPointReward(const QJsonObject &redemption)
}
}
QJsonObject ChannelPointReward::toJson() const
{
return {
{"id"_L1, this->id},
{"channelId"_L1, this->channelId},
{"title"_L1, this->title},
{"cost"_L1, this->cost},
{"image"_L1, this->image.toJson()},
{"isUserInputRequired"_L1, this->isUserInputRequired},
{"isBits"_L1, this->isBits},
{"emoteId"_L1, this->emoteId},
{"emoteName"_L1, this->emoteName},
{"user"_L1,
{{
{"id"_L1, this->user.id},
{"login"_L1, this->user.login},
{"displayName"_L1, this->user.displayName},
}}},
};
}
} // namespace chatterino
@@ -24,6 +24,8 @@ struct ChannelPointReward {
QString login;
QString displayName;
} user;
QJsonObject toJson() const;
};
} // namespace chatterino