feat(eventsub): implement clearchat (#5981)

This commit is contained in:
nerix
2025-02-23 21:28:26 +01:00
committed by GitHub
parent c67801eca5
commit 5fca241188
8 changed files with 199 additions and 7 deletions
@@ -0,0 +1,29 @@
#include "providers/twitch/eventsub/MessageHandlers.hpp"
#include "Application.hpp"
#include "messages/MessageBuilder.hpp"
#include "providers/twitch/TwitchChannel.hpp"
#include "singletons/Settings.hpp"
#include "singletons/WindowManager.hpp"
#include "util/PostToThread.hpp"
namespace chatterino::eventsub {
void handleModerateMessage(
TwitchChannel *chan, const QDateTime &time,
const lib::payload::channel_moderate::v2::Event &event,
const lib::payload::channel_moderate::v2::Clear & /*action*/)
{
runInGuiThread([chan, actor{event.moderatorUserLogin.qt()}, time] {
chan->addOrReplaceClearChat(
MessageBuilder::makeClearChatMessage(time, actor), time);
if (getSettings()->hideModerated)
{
// XXX: This is expensive. We could use a layout request if the layout
// would store the previous message flags.
getApp()->getWindows()->forceLayoutChannelViews();
}
});
}
} // namespace chatterino::eventsub