refactor: make a single MessageBuilder (#5548)

This commit is contained in:
pajlada
2024-08-24 12:18:27 +02:00
committed by GitHub
parent 5170085d7c
commit 175afa8b16
33 changed files with 2819 additions and 3014 deletions
@@ -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 {