From 1edcfe52192d44b6bbd080962856d9b4d9172cf4 Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Sun, 22 Apr 2018 15:47:39 +0200 Subject: [PATCH] Add a scrappy timeout message from pubsub in channels now Progress on #323 --- src/application.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/application.cpp b/src/application.cpp index 925b3c67f..f75408b89 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -65,6 +65,23 @@ Application::Application() }); pubsub.sig.moderation.userTimedOut.connect([&](const auto &action) { + auto &server = providers::twitch::TwitchServer::getInstance(); + auto chan = server.getChannelOrEmptyByID(action.roomID); + + if (chan->isEmpty()) { + return; + } + + auto msg = messages::Message::createSystemMessage( + QString("User %1(%2) was timed out by %3 for %4 seconds with reason: '%5'") + .arg(action.target.name) + .arg(action.target.id) + .arg(action.source.name) + .arg(action.duration) + .arg(action.reason)); + + chan->addMessage(msg); + debug::Log("User {}({}) was timed out by {} for {} seconds with reason: '{}'", action.target.name, action.target.id, action.source.name, action.duration, action.reason);