refactor: add Channel::addSystemMessage function (#5500)

This commit is contained in:
pajlada
2024-07-07 22:03:05 +02:00
committed by GitHub
parent 4535823ca8
commit 354079c74c
47 changed files with 443 additions and 588 deletions
@@ -69,8 +69,8 @@ QString chatters(const CommandContext &ctx)
if (ctx.twitchChannel == nullptr)
{
ctx.channel->addMessage(makeSystemMessage(
"The /chatters command only works in Twitch Channels."));
ctx.channel->addSystemMessage(
"The /chatters command only works in Twitch Channels.");
return "";
}
@@ -79,13 +79,12 @@ QString chatters(const CommandContext &ctx)
ctx.twitchChannel->roomId(),
getIApp()->getAccounts()->twitch.getCurrent()->getUserId(), 1,
[channel{ctx.channel}](auto result) {
channel->addMessage(
makeSystemMessage(QString("Chatter count: %1.")
.arg(localizeNumbers(result.total))));
channel->addSystemMessage(QString("Chatter count: %1.")
.arg(localizeNumbers(result.total)));
},
[channel{ctx.channel}](auto error, auto message) {
auto errorMessage = formatChattersError(error, message);
channel->addMessage(makeSystemMessage(errorMessage));
channel->addSystemMessage(errorMessage);
});
return "";
@@ -100,8 +99,8 @@ QString testChatters(const CommandContext &ctx)
if (ctx.twitchChannel == nullptr)
{
ctx.channel->addMessage(makeSystemMessage(
"The /test-chatters command only works in Twitch Channels."));
ctx.channel->addSystemMessage(
"The /test-chatters command only works in Twitch Channels.");
return "";
}
@@ -134,7 +133,7 @@ QString testChatters(const CommandContext &ctx)
},
[channel{ctx.channel}](auto error, auto message) {
auto errorMessage = formatChattersError(error, message);
channel->addMessage(makeSystemMessage(errorMessage));
channel->addSystemMessage(errorMessage);
});
return "";