feat(eventsub): Add support for channel.moderate Warn (#5932)
* fix(eventsub): Be less strict with strings & vectors
String foo from `{"foo":null}` is now accepted, and returns an empty string
std::vector<String> foo from `{"foo":null}` is now accepted, and returns an empty array
This commit is contained in:
@@ -164,12 +164,12 @@ void Connection::onChannelModerate(
|
||||
const auto now = QDateTime::currentDateTime();
|
||||
|
||||
std::visit(
|
||||
[&](auto &&oAction) {
|
||||
using Action = std::remove_cvref_t<decltype(oAction)>;
|
||||
[&](auto &&action) {
|
||||
using Action = std::remove_cvref_t<decltype(action)>;
|
||||
if constexpr (std::is_same_v<
|
||||
Action, lib::payload::channel_moderate::v2::Vip>)
|
||||
{
|
||||
auto msg = makeVipMessage(channel, now, payload.event, oAction);
|
||||
auto msg = makeVipMessage(channel, now, payload.event, action);
|
||||
runInGuiThread([channel, msg] {
|
||||
channel->addMessage(msg, MessageContext::Original);
|
||||
});
|
||||
@@ -179,7 +179,16 @@ void Connection::onChannelModerate(
|
||||
lib::payload::channel_moderate::v2::Unvip>)
|
||||
{
|
||||
auto msg =
|
||||
makeUnvipMessage(channel, now, payload.event, oAction);
|
||||
makeUnvipMessage(channel, now, payload.event, action);
|
||||
runInGuiThread([channel, msg] {
|
||||
channel->addMessage(msg, MessageContext::Original);
|
||||
});
|
||||
}
|
||||
else if constexpr (std::is_same_v<
|
||||
Action,
|
||||
lib::payload::channel_moderate::v2::Warn>)
|
||||
{
|
||||
auto msg = makeWarnMessage(channel, now, payload.event, action);
|
||||
runInGuiThread([channel, msg] {
|
||||
channel->addMessage(msg, MessageContext::Original);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user