refactor: make a single MessageBuilder (#5548)
This commit is contained in:
@@ -6,7 +6,6 @@
|
||||
#include "providers/twitch/api/Helix.hpp"
|
||||
#include "providers/twitch/TwitchAccount.hpp"
|
||||
#include "providers/twitch/TwitchChannel.hpp"
|
||||
#include "providers/twitch/TwitchMessageBuilder.hpp"
|
||||
#include "util/Twitch.hpp"
|
||||
|
||||
namespace chatterino::commands {
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include "providers/twitch/api/Helix.hpp"
|
||||
#include "providers/twitch/TwitchAccount.hpp"
|
||||
#include "providers/twitch/TwitchChannel.hpp"
|
||||
#include "providers/twitch/TwitchMessageBuilder.hpp"
|
||||
#include "util/Twitch.hpp"
|
||||
|
||||
namespace chatterino::commands {
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include "providers/twitch/api/Helix.hpp"
|
||||
#include "providers/twitch/TwitchAccount.hpp"
|
||||
#include "providers/twitch/TwitchChannel.hpp"
|
||||
#include "providers/twitch/TwitchMessageBuilder.hpp"
|
||||
#include "singletons/Theme.hpp"
|
||||
|
||||
#include <QApplication>
|
||||
@@ -125,11 +124,9 @@ QString testChatters(const CommandContext &ctx)
|
||||
prefix += QString("(%1):").arg(result.total);
|
||||
}
|
||||
|
||||
MessageBuilder builder;
|
||||
TwitchMessageBuilder::listOfUsersSystemMessage(
|
||||
prefix, entries, twitchChannel, &builder);
|
||||
|
||||
channel->addMessage(builder.release(), MessageContext::Original);
|
||||
channel->addMessage(MessageBuilder::makeListOfUsersMessage(
|
||||
prefix, entries, twitchChannel),
|
||||
MessageContext::Original);
|
||||
},
|
||||
[channel{ctx.channel}](auto error, auto message) {
|
||||
auto errorMessage = formatChattersError(error, message);
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "messages/MessageBuilder.hpp"
|
||||
#include "providers/twitch/api/Helix.hpp"
|
||||
#include "providers/twitch/TwitchChannel.hpp"
|
||||
#include "providers/twitch/TwitchMessageBuilder.hpp"
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -77,11 +76,10 @@ QString getModerators(const CommandContext &ctx)
|
||||
|
||||
// TODO: sort results?
|
||||
|
||||
MessageBuilder builder;
|
||||
TwitchMessageBuilder::listOfUsersSystemMessage(
|
||||
"The moderators of this channel are", result, twitchChannel,
|
||||
&builder);
|
||||
channel->addMessage(builder.release(), MessageContext::Original);
|
||||
channel->addMessage(MessageBuilder::makeListOfUsersMessage(
|
||||
"The moderators of this channel are",
|
||||
result, twitchChannel),
|
||||
MessageContext::Original);
|
||||
},
|
||||
[channel{ctx.channel}](auto error, auto message) {
|
||||
auto errorMessage = formatModsError(error, message);
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "providers/twitch/api/Helix.hpp"
|
||||
#include "providers/twitch/TwitchAccount.hpp"
|
||||
#include "providers/twitch/TwitchChannel.hpp"
|
||||
#include "providers/twitch/TwitchMessageBuilder.hpp"
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -106,11 +105,10 @@ QString getVIPs(const CommandContext &ctx)
|
||||
auto messagePrefix = QString("The VIPs of this channel are");
|
||||
|
||||
// TODO: sort results?
|
||||
MessageBuilder builder;
|
||||
TwitchMessageBuilder::listOfUsersSystemMessage(
|
||||
messagePrefix, vipList, twitchChannel, &builder);
|
||||
|
||||
channel->addMessage(builder.release(), MessageContext::Original);
|
||||
channel->addMessage(MessageBuilder::makeListOfUsersMessage(
|
||||
messagePrefix, vipList, twitchChannel),
|
||||
MessageContext::Original);
|
||||
},
|
||||
[channel{ctx.channel}](auto error, auto message) {
|
||||
auto errorMessage = formatGetVIPsError(error, message);
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include "providers/twitch/api/Helix.hpp"
|
||||
#include "providers/twitch/TwitchAccount.hpp"
|
||||
#include "providers/twitch/TwitchChannel.hpp"
|
||||
#include "providers/twitch/TwitchMessageBuilder.hpp"
|
||||
#include "util/Twitch.hpp"
|
||||
|
||||
namespace chatterino::commands {
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include "providers/twitch/api/Helix.hpp"
|
||||
#include "providers/twitch/TwitchAccount.hpp"
|
||||
#include "providers/twitch/TwitchChannel.hpp"
|
||||
#include "providers/twitch/TwitchMessageBuilder.hpp"
|
||||
#include "util/Twitch.hpp"
|
||||
|
||||
namespace chatterino::commands {
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include "providers/twitch/api/Helix.hpp"
|
||||
#include "providers/twitch/TwitchAccount.hpp"
|
||||
#include "providers/twitch/TwitchChannel.hpp"
|
||||
#include "providers/twitch/TwitchMessageBuilder.hpp"
|
||||
|
||||
namespace {
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
#include "controllers/highlights/HighlightBadge.hpp"
|
||||
|
||||
#include "messages/SharedMessageBuilder.hpp"
|
||||
#include "providers/twitch/TwitchBadge.hpp"
|
||||
#include "singletons/Resources.hpp"
|
||||
#include "util/IrcHelpers.hpp"
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
@@ -97,7 +96,7 @@ bool HighlightBadge::compare(const QString &id, const Badge &badge) const
|
||||
{
|
||||
if (this->hasVersions_)
|
||||
{
|
||||
auto parts = SharedMessageBuilder::slashKeyValue(id);
|
||||
auto parts = slashKeyValue(id);
|
||||
return parts.first.compare(badge.key_, Qt::CaseInsensitive) == 0 &&
|
||||
parts.second.compare(badge.value_, Qt::CaseInsensitive) == 0;
|
||||
}
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
#include "controllers/notifications/NotificationModel.hpp"
|
||||
#include "controllers/sound/ISoundController.hpp"
|
||||
#include "messages/Message.hpp"
|
||||
#include "messages/MessageBuilder.hpp"
|
||||
#include "providers/twitch/api/Helix.hpp"
|
||||
#include "providers/twitch/TwitchIrcServer.hpp"
|
||||
#include "providers/twitch/TwitchMessageBuilder.hpp"
|
||||
#include "singletons/Settings.hpp"
|
||||
#include "singletons/StreamerMode.hpp"
|
||||
#include "singletons/Toasts.hpp"
|
||||
@@ -137,11 +137,9 @@ void NotificationController::notifyTwitchChannelLive(
|
||||
}
|
||||
|
||||
// Message in /live channel
|
||||
MessageBuilder builder;
|
||||
TwitchMessageBuilder::liveMessage(payload.displayName, &builder);
|
||||
builder.message().id = payload.channelId;
|
||||
getApp()->getTwitch()->getLiveChannel()->addMessage(
|
||||
builder.release(), MessageContext::Original);
|
||||
MessageBuilder::makeLiveMessage(payload.displayName, payload.channelId),
|
||||
MessageContext::Original);
|
||||
|
||||
// Notify on all channels with a ping sound
|
||||
if (showNotification && !playedSound &&
|
||||
|
||||
Reference in New Issue
Block a user