refactor: make a single MessageBuilder (#5548)
This commit is contained in:
+10
-17
@@ -42,7 +42,6 @@
|
||||
#include "providers/twitch/PubSubMessages.hpp"
|
||||
#include "providers/twitch/TwitchChannel.hpp"
|
||||
#include "providers/twitch/TwitchIrcServer.hpp"
|
||||
#include "providers/twitch/TwitchMessageBuilder.hpp"
|
||||
#include "singletons/CrashHandler.hpp"
|
||||
#include "singletons/Emotes.hpp"
|
||||
#include "singletons/Fonts.hpp"
|
||||
@@ -738,11 +737,9 @@ void Application::initPubSub()
|
||||
return;
|
||||
}
|
||||
|
||||
MessageBuilder msg;
|
||||
TwitchMessageBuilder::deletionMessage(action, &msg);
|
||||
msg->flags.set(MessageFlag::PubSub);
|
||||
auto msg = MessageBuilder::makeDeletionMessageFromPubSub(action);
|
||||
|
||||
postToThread([chan, msg = msg.release()] {
|
||||
postToThread([chan, msg] {
|
||||
auto replaced = false;
|
||||
LimitedQueueSnapshot<MessagePtr> snapshot =
|
||||
chan->getMessageSnapshot();
|
||||
@@ -827,10 +824,8 @@ void Application::initPubSub()
|
||||
}
|
||||
|
||||
postToThread([twitchChannel, action] {
|
||||
const auto p =
|
||||
TwitchMessageBuilder::makeLowTrustUserMessage(
|
||||
action, twitchChannel->getName(),
|
||||
twitchChannel.get());
|
||||
const auto p = MessageBuilder::makeLowTrustUserMessage(
|
||||
action, twitchChannel->getName(), twitchChannel.get());
|
||||
twitchChannel->addMessage(p.first,
|
||||
MessageContext::Original);
|
||||
twitchChannel->addMessage(p.second,
|
||||
@@ -871,7 +866,7 @@ void Application::initPubSub()
|
||||
|
||||
postToThread([chan, action] {
|
||||
auto msg =
|
||||
TwitchMessageBuilder::makeLowTrustUpdateMessage(action);
|
||||
MessageBuilder::makeLowTrustUpdateMessage(action);
|
||||
chan->addMessage(msg, MessageContext::Original);
|
||||
});
|
||||
});
|
||||
@@ -951,9 +946,8 @@ void Application::initPubSub()
|
||||
ActionUser{msg.senderUserID, msg.senderUserLogin,
|
||||
senderDisplayName, senderColor};
|
||||
postToThread([chan, action] {
|
||||
const auto p =
|
||||
TwitchMessageBuilder::makeAutomodMessage(
|
||||
action, chan->getName());
|
||||
const auto p = MessageBuilder::makeAutomodMessage(
|
||||
action, chan->getName());
|
||||
chan->addMessage(p.first, MessageContext::Original);
|
||||
chan->addMessage(p.second,
|
||||
MessageContext::Original);
|
||||
@@ -1004,8 +998,8 @@ void Application::initPubSub()
|
||||
}
|
||||
|
||||
postToThread([chan, action] {
|
||||
const auto p = TwitchMessageBuilder::makeAutomodMessage(
|
||||
action, chan->getName());
|
||||
const auto p =
|
||||
MessageBuilder::makeAutomodMessage(action, chan->getName());
|
||||
chan->addMessage(p.first, MessageContext::Original);
|
||||
chan->addMessage(p.second, MessageContext::Original);
|
||||
});
|
||||
@@ -1043,8 +1037,7 @@ void Application::initPubSub()
|
||||
}
|
||||
|
||||
postToThread([chan, action] {
|
||||
const auto p =
|
||||
TwitchMessageBuilder::makeAutomodInfoMessage(action);
|
||||
const auto p = MessageBuilder::makeAutomodInfoMessage(action);
|
||||
chan->addMessage(p, MessageContext::Original);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user