refactor: add Channel::addSystemMessage function (#5500)
This commit is contained in:
@@ -554,8 +554,7 @@ QString CommandController::execCommand(const QString &textNoEmoji,
|
||||
|
||||
if (!dryRun && channel->getType() == Channel::Type::TwitchWhispers)
|
||||
{
|
||||
channel->addMessage(
|
||||
makeSystemMessage("Use /w <username> <message> to whisper"));
|
||||
channel->addSystemMessage("Use /w <username> <message> to whisper");
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "controllers/accounts/AccountController.hpp"
|
||||
#include "controllers/commands/CommandContext.hpp"
|
||||
#include "controllers/userdata/UserDataController.hpp"
|
||||
#include "messages/MessageBuilder.hpp"
|
||||
#include "providers/twitch/api/Helix.hpp"
|
||||
#include "providers/twitch/TwitchAccount.hpp"
|
||||
#include "providers/twitch/TwitchChannel.hpp"
|
||||
@@ -39,10 +38,10 @@ QString follow(const CommandContext &ctx)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
ctx.channel->addSystemMessage(
|
||||
"Twitch has removed the ability to follow users through "
|
||||
"third-party applications. For more information, see "
|
||||
"https://github.com/Chatterino/chatterino2/issues/3076"));
|
||||
"https://github.com/Chatterino/chatterino2/issues/3076");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -52,10 +51,10 @@ QString unfollow(const CommandContext &ctx)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
ctx.channel->addSystemMessage(
|
||||
"Twitch has removed the ability to unfollow users through "
|
||||
"third-party applications. For more information, see "
|
||||
"https://github.com/Chatterino/chatterino2/issues/3076"));
|
||||
"https://github.com/Chatterino/chatterino2/issues/3076");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -68,8 +67,8 @@ QString uptime(const CommandContext &ctx)
|
||||
|
||||
if (ctx.twitchChannel == nullptr)
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
"The /uptime command only works in Twitch Channels."));
|
||||
ctx.channel->addSystemMessage(
|
||||
"The /uptime command only works in Twitch Channels.");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -78,7 +77,7 @@ QString uptime(const CommandContext &ctx)
|
||||
QString messageText =
|
||||
streamStatus->live ? streamStatus->uptime : "Channel is not live.";
|
||||
|
||||
ctx.channel->addMessage(makeSystemMessage(messageText));
|
||||
ctx.channel->addSystemMessage(messageText);
|
||||
|
||||
return "";
|
||||
}
|
||||
@@ -92,8 +91,7 @@ QString user(const CommandContext &ctx)
|
||||
|
||||
if (ctx.words.size() < 2)
|
||||
{
|
||||
ctx.channel->addMessage(
|
||||
makeSystemMessage("Usage: /user <user> [channel]"));
|
||||
ctx.channel->addSystemMessage("Usage: /user <user> [channel]");
|
||||
return "";
|
||||
}
|
||||
QString userName = ctx.words[1];
|
||||
@@ -129,11 +127,11 @@ QString requests(const CommandContext &ctx)
|
||||
}
|
||||
else
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
ctx.channel->addSystemMessage(
|
||||
"Usage: /requests [channel]. You can also use the command "
|
||||
"without arguments in any Twitch channel to open its "
|
||||
"channel points requests queue. Only the broadcaster and "
|
||||
"moderators have permission to view the queue."));
|
||||
"moderators have permission to view the queue.");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -163,11 +161,11 @@ QString lowtrust(const CommandContext &ctx)
|
||||
}
|
||||
else
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
ctx.channel->addSystemMessage(
|
||||
"Usage: /lowtrust [channel]. You can also use the command "
|
||||
"without arguments in any Twitch channel to open its "
|
||||
"suspicious user activity feed. Only the broadcaster and "
|
||||
"moderators have permission to view this feed."));
|
||||
"moderators have permission to view this feed.");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -190,15 +188,15 @@ QString clip(const CommandContext &ctx)
|
||||
if (const auto type = ctx.channel->getType();
|
||||
type != Channel::Type::Twitch && type != Channel::Type::TwitchWatching)
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
"The /clip command only works in Twitch Channels."));
|
||||
ctx.channel->addSystemMessage(
|
||||
"The /clip command only works in Twitch Channels.");
|
||||
return "";
|
||||
}
|
||||
|
||||
if (ctx.twitchChannel == nullptr)
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
"The /clip command only works in Twitch Channels."));
|
||||
ctx.channel->addSystemMessage(
|
||||
"The /clip command only works in Twitch Channels.");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -216,25 +214,25 @@ QString marker(const CommandContext &ctx)
|
||||
|
||||
if (ctx.twitchChannel == nullptr)
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
"The /marker command only works in Twitch channels."));
|
||||
ctx.channel->addSystemMessage(
|
||||
"The /marker command only works in Twitch channels.");
|
||||
return "";
|
||||
}
|
||||
|
||||
// Avoid Helix calls without Client ID and/or OAuth Token
|
||||
if (getIApp()->getAccounts()->twitch.getCurrent()->isAnon())
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
"You need to be logged in to create stream markers!"));
|
||||
ctx.channel->addSystemMessage(
|
||||
"You need to be logged in to create stream markers!");
|
||||
return "";
|
||||
}
|
||||
|
||||
// Exact same message as in webchat
|
||||
if (!ctx.twitchChannel->isLive())
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
ctx.channel->addSystemMessage(
|
||||
"You can only add stream markers during live streams. Try "
|
||||
"again when the channel is live streaming."));
|
||||
"again when the channel is live streaming.");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -247,13 +245,13 @@ QString marker(const CommandContext &ctx)
|
||||
ctx.twitchChannel->roomId(), arguments.join(" ").left(140),
|
||||
[channel{ctx.channel},
|
||||
arguments](const HelixStreamMarker &streamMarker) {
|
||||
channel->addMessage(makeSystemMessage(
|
||||
channel->addSystemMessage(
|
||||
QString("Successfully added a stream marker at %1%2")
|
||||
.arg(formatTime(streamMarker.positionSeconds))
|
||||
.arg(streamMarker.description.isEmpty()
|
||||
? ""
|
||||
: QString(": \"%1\"")
|
||||
.arg(streamMarker.description))));
|
||||
.arg(streamMarker.description)));
|
||||
},
|
||||
[channel{ctx.channel}](auto error) {
|
||||
QString errorMessage("Failed to create stream marker - ");
|
||||
@@ -279,7 +277,7 @@ QString marker(const CommandContext &ctx)
|
||||
break;
|
||||
}
|
||||
|
||||
channel->addMessage(makeSystemMessage(errorMessage));
|
||||
channel->addSystemMessage(errorMessage);
|
||||
});
|
||||
|
||||
return "";
|
||||
@@ -303,10 +301,10 @@ QString streamlink(const CommandContext &ctx)
|
||||
}
|
||||
else
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
ctx.channel->addSystemMessage(
|
||||
"/streamlink [channel]. Open specified Twitch channel in "
|
||||
"streamlink. If no channel argument is specified, open the "
|
||||
"current Twitch channel instead."));
|
||||
"current Twitch channel instead.");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -335,10 +333,10 @@ QString popout(const CommandContext &ctx)
|
||||
}
|
||||
else
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
ctx.channel->addSystemMessage(
|
||||
"Usage: /popout <channel>. You can also use the command "
|
||||
"without arguments in any Twitch channel to open its "
|
||||
"popout chat."));
|
||||
"popout chat.");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -385,7 +383,7 @@ QString popup(const CommandContext &ctx)
|
||||
}
|
||||
}
|
||||
|
||||
ctx.channel->addMessage(makeSystemMessage(usageMessage));
|
||||
ctx.channel->addSystemMessage(usageMessage);
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -469,8 +467,8 @@ QString openURL(const CommandContext &ctx)
|
||||
const auto &positionalArguments = parser.positionalArguments();
|
||||
if (positionalArguments.isEmpty())
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
"Usage: /openurl <URL> [--incognito/--no-incognito]"));
|
||||
ctx.channel->addSystemMessage(
|
||||
"Usage: /openurl <URL> [--incognito/--no-incognito]");
|
||||
return "";
|
||||
}
|
||||
auto urlString = parser.positionalArguments().join(' ');
|
||||
@@ -478,7 +476,7 @@ QString openURL(const CommandContext &ctx)
|
||||
QUrl url = QUrl::fromUserInput(urlString);
|
||||
if (!url.isValid())
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage("Invalid URL specified."));
|
||||
ctx.channel->addSystemMessage("Invalid URL specified.");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -488,9 +486,9 @@ QString openURL(const CommandContext &ctx)
|
||||
|
||||
if (forcePrivateMode && forceNonPrivateMode)
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
ctx.channel->addSystemMessage(
|
||||
"Error: /openurl may only be called with --incognito or "
|
||||
"--no-incognito, not both at the same time."));
|
||||
"--no-incognito, not both at the same time.");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -518,7 +516,7 @@ QString openURL(const CommandContext &ctx)
|
||||
|
||||
if (!res)
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage("Could not open URL."));
|
||||
ctx.channel->addSystemMessage("Could not open URL.");
|
||||
}
|
||||
|
||||
return "";
|
||||
@@ -553,16 +551,16 @@ QString injectFakeMessage(const CommandContext &ctx)
|
||||
|
||||
if (!ctx.channel->isTwitchChannel())
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
"The /fakemsg command only works in Twitch channels."));
|
||||
ctx.channel->addSystemMessage(
|
||||
"The /fakemsg command only works in Twitch channels.");
|
||||
return "";
|
||||
}
|
||||
|
||||
if (ctx.words.size() < 2)
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
ctx.channel->addSystemMessage(
|
||||
"Usage: /fakemsg (raw irc text) - injects raw irc text as "
|
||||
"if it was a message received from TMI"));
|
||||
"if it was a message received from TMI");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -583,9 +581,9 @@ QString injectStreamUpdateNoStream(const CommandContext &ctx)
|
||||
}
|
||||
if (ctx.twitchChannel == nullptr)
|
||||
{
|
||||
ctx.channel->addMessage(
|
||||
makeSystemMessage("The /debug-update-to-no-stream command only "
|
||||
"works in Twitch channels"));
|
||||
ctx.channel->addSystemMessage(
|
||||
"The /debug-update-to-no-stream command only "
|
||||
"works in Twitch channels");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -602,9 +600,8 @@ QString copyToClipboard(const CommandContext &ctx)
|
||||
|
||||
if (ctx.words.size() < 2)
|
||||
{
|
||||
ctx.channel->addMessage(
|
||||
makeSystemMessage("Usage: /copy <text> - copies provided "
|
||||
"text to clipboard."));
|
||||
ctx.channel->addSystemMessage("Usage: /copy <text> - copies provided "
|
||||
"text to clipboard.");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -621,15 +618,15 @@ QString unstableSetUserClientSideColor(const CommandContext &ctx)
|
||||
|
||||
if (ctx.twitchChannel == nullptr)
|
||||
{
|
||||
ctx.channel->addMessage(
|
||||
makeSystemMessage("The /unstable-set-user-color command only "
|
||||
"works in Twitch channels."));
|
||||
ctx.channel->addSystemMessage(
|
||||
"The /unstable-set-user-color command only "
|
||||
"works in Twitch channels.");
|
||||
return "";
|
||||
}
|
||||
if (ctx.words.size() < 2)
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
QString("Usage: %1 <TwitchUserID> [color]").arg(ctx.words.at(0))));
|
||||
ctx.channel->addSystemMessage(
|
||||
QString("Usage: %1 <TwitchUserID> [color]").arg(ctx.words.at(0)));
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -653,9 +650,8 @@ QString openUsercard(const CommandContext &ctx)
|
||||
|
||||
if (ctx.words.size() < 2)
|
||||
{
|
||||
channel->addMessage(
|
||||
makeSystemMessage("Usage: /usercard <username> [channel] or "
|
||||
"/usercard id:<id> [channel]"));
|
||||
channel->addSystemMessage("Usage: /usercard <username> [channel] or "
|
||||
"/usercard id:<id> [channel]");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -672,9 +668,9 @@ QString openUsercard(const CommandContext &ctx)
|
||||
|
||||
if (channelTemp->isEmpty())
|
||||
{
|
||||
channel->addMessage(makeSystemMessage(
|
||||
channel->addSystemMessage(
|
||||
"A usercard can only be displayed for a channel that is "
|
||||
"currently opened in Chatterino."));
|
||||
"currently opened in Chatterino.");
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
@@ -22,12 +22,12 @@ QString setLoggingRules(const CommandContext &ctx)
|
||||
{
|
||||
if (ctx.words.size() < 2)
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
ctx.channel->addSystemMessage(
|
||||
"Usage: /c2-set-logging-rules <rules...>. To enable debug logging "
|
||||
"for all categories from chatterino, use "
|
||||
"'chatterino.*.debug=true'. For the format on the rules, see "
|
||||
"https://doc.qt.io/qt-6/"
|
||||
"qloggingcategory.html#configuring-categories"));
|
||||
"qloggingcategory.html#configuring-categories");
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ QString setLoggingRules(const CommandContext &ctx)
|
||||
"https://doc.qt.io/qt-6/qloggingcategory.html#setFilterRules");
|
||||
}
|
||||
|
||||
ctx.channel->addMessage(makeSystemMessage(message));
|
||||
ctx.channel->addSystemMessage(message);
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -56,15 +56,13 @@ QString toggleThemeReload(const CommandContext &ctx)
|
||||
if (getTheme()->isAutoReloading())
|
||||
{
|
||||
getTheme()->setAutoReload(false);
|
||||
ctx.channel->addMessage(
|
||||
makeSystemMessage(u"Disabled theme auto reloading."_s));
|
||||
ctx.channel->addSystemMessage(u"Disabled theme auto reloading."_s);
|
||||
return {};
|
||||
}
|
||||
|
||||
getTheme()->setAutoReload(true);
|
||||
ctx.channel->addMessage(
|
||||
makeSystemMessage(u"Auto reloading theme every %1 ms."_s.arg(
|
||||
Theme::AUTO_RELOAD_INTERVAL_MS)));
|
||||
ctx.channel->addSystemMessage(u"Auto reloading theme every %1 ms."_s.arg(
|
||||
Theme::AUTO_RELOAD_INTERVAL_MS));
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -107,7 +105,7 @@ QString listArgs(const CommandContext &ctx)
|
||||
|
||||
QString msg = QApplication::instance()->arguments().join(' ');
|
||||
|
||||
channel->addMessage(makeSystemMessage(msg));
|
||||
channel->addSystemMessage(msg);
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
#include "controllers/commands/builtin/twitch/AddModerator.hpp"
|
||||
|
||||
#include "Application.hpp"
|
||||
#include "common/Channel.hpp"
|
||||
#include "controllers/accounts/AccountController.hpp"
|
||||
#include "controllers/commands/CommandContext.hpp"
|
||||
#include "messages/MessageBuilder.hpp"
|
||||
#include "providers/twitch/api/Helix.hpp"
|
||||
#include "providers/twitch/TwitchAccount.hpp"
|
||||
#include "providers/twitch/TwitchChannel.hpp"
|
||||
@@ -22,23 +20,22 @@ QString addModerator(const CommandContext &ctx)
|
||||
|
||||
if (ctx.twitchChannel == nullptr)
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
"The /mod command only works in Twitch channels."));
|
||||
ctx.channel->addSystemMessage(
|
||||
"The /mod command only works in Twitch channels.");
|
||||
return "";
|
||||
}
|
||||
if (ctx.words.size() < 2)
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
ctx.channel->addSystemMessage(
|
||||
"Usage: \"/mod <username>\" - Grant moderator status to a "
|
||||
"user. Use \"/mods\" to list the moderators of this channel."));
|
||||
"user. Use \"/mods\" to list the moderators of this channel.");
|
||||
return "";
|
||||
}
|
||||
|
||||
auto currentUser = getIApp()->getAccounts()->twitch.getCurrent();
|
||||
if (currentUser->isAnon())
|
||||
{
|
||||
ctx.channel->addMessage(
|
||||
makeSystemMessage("You must be logged in to mod someone!"));
|
||||
ctx.channel->addSystemMessage("You must be logged in to mod someone!");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -52,10 +49,10 @@ QString addModerator(const CommandContext &ctx)
|
||||
getHelix()->addChannelModerator(
|
||||
twitchChannel->roomId(), targetUser.id,
|
||||
[channel, targetUser] {
|
||||
channel->addMessage(makeSystemMessage(
|
||||
channel->addSystemMessage(
|
||||
QString("You have added %1 as a moderator of this "
|
||||
"channel.")
|
||||
.arg(targetUser.displayName)));
|
||||
.arg(targetUser.displayName));
|
||||
},
|
||||
[channel, targetUser](auto error, auto message) {
|
||||
QString errorMessage =
|
||||
@@ -116,13 +113,13 @@ QString addModerator(const CommandContext &ctx)
|
||||
}
|
||||
break;
|
||||
}
|
||||
channel->addMessage(makeSystemMessage(errorMessage));
|
||||
channel->addSystemMessage(errorMessage);
|
||||
});
|
||||
},
|
||||
[channel{ctx.channel}, target] {
|
||||
// Equivalent error from IRC
|
||||
channel->addMessage(
|
||||
makeSystemMessage(QString("Invalid username: %1").arg(target)));
|
||||
channel->addSystemMessage(
|
||||
QString("Invalid username: %1").arg(target));
|
||||
});
|
||||
|
||||
return "";
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
#include "controllers/commands/builtin/twitch/AddVIP.hpp"
|
||||
|
||||
#include "Application.hpp"
|
||||
#include "common/Channel.hpp"
|
||||
#include "controllers/accounts/AccountController.hpp"
|
||||
#include "controllers/commands/CommandContext.hpp"
|
||||
#include "messages/MessageBuilder.hpp"
|
||||
#include "providers/twitch/api/Helix.hpp"
|
||||
#include "providers/twitch/TwitchAccount.hpp"
|
||||
#include "providers/twitch/TwitchChannel.hpp"
|
||||
@@ -22,23 +20,22 @@ QString addVIP(const CommandContext &ctx)
|
||||
|
||||
if (ctx.twitchChannel == nullptr)
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
"The /vip command only works in Twitch channels."));
|
||||
ctx.channel->addSystemMessage(
|
||||
"The /vip command only works in Twitch channels.");
|
||||
return "";
|
||||
}
|
||||
if (ctx.words.size() < 2)
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
ctx.channel->addSystemMessage(
|
||||
"Usage: \"/vip <username>\" - Grant VIP status to a user. Use "
|
||||
"\"/vips\" to list the VIPs of this channel."));
|
||||
"\"/vips\" to list the VIPs of this channel.");
|
||||
return "";
|
||||
}
|
||||
|
||||
auto currentUser = getIApp()->getAccounts()->twitch.getCurrent();
|
||||
if (currentUser->isAnon())
|
||||
{
|
||||
ctx.channel->addMessage(
|
||||
makeSystemMessage("You must be logged in to VIP someone!"));
|
||||
ctx.channel->addSystemMessage("You must be logged in to VIP someone!");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -52,9 +49,9 @@ QString addVIP(const CommandContext &ctx)
|
||||
getHelix()->addChannelVIP(
|
||||
twitchChannel->roomId(), targetUser.id,
|
||||
[channel, targetUser] {
|
||||
channel->addMessage(makeSystemMessage(
|
||||
channel->addSystemMessage(
|
||||
QString("You have added %1 as a VIP of this channel.")
|
||||
.arg(targetUser.displayName)));
|
||||
.arg(targetUser.displayName));
|
||||
},
|
||||
[channel, targetUser](auto error, auto message) {
|
||||
QString errorMessage = QString("Failed to add VIP - ");
|
||||
@@ -97,13 +94,13 @@ QString addVIP(const CommandContext &ctx)
|
||||
}
|
||||
break;
|
||||
}
|
||||
channel->addMessage(makeSystemMessage(errorMessage));
|
||||
channel->addSystemMessage(errorMessage);
|
||||
});
|
||||
},
|
||||
[channel{ctx.channel}, target] {
|
||||
// Equivalent error from IRC
|
||||
channel->addMessage(
|
||||
makeSystemMessage(QString("Invalid username: %1").arg(target)));
|
||||
channel->addSystemMessage(
|
||||
QString("Invalid username: %1").arg(target));
|
||||
});
|
||||
|
||||
return "";
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
#include "controllers/commands/builtin/twitch/Announce.hpp"
|
||||
|
||||
#include "Application.hpp"
|
||||
#include "common/Channel.hpp"
|
||||
#include "controllers/accounts/AccountController.hpp"
|
||||
#include "controllers/commands/CommandContext.hpp"
|
||||
#include "messages/MessageBuilder.hpp"
|
||||
#include "providers/twitch/api/Helix.hpp"
|
||||
#include "providers/twitch/TwitchAccount.hpp"
|
||||
#include "providers/twitch/TwitchChannel.hpp"
|
||||
@@ -22,8 +20,8 @@ QString sendAnnouncementColor(const CommandContext &ctx,
|
||||
|
||||
if (ctx.twitchChannel == nullptr)
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
"This command can only be used in Twitch channels."));
|
||||
ctx.channel->addSystemMessage(
|
||||
"This command can only be used in Twitch channels.");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -48,16 +46,16 @@ QString sendAnnouncementColor(const CommandContext &ctx,
|
||||
"message with a %1 highlight.")
|
||||
.arg(colorStr);
|
||||
}
|
||||
ctx.channel->addMessage(makeSystemMessage(usageMsg));
|
||||
ctx.channel->addSystemMessage(usageMsg);
|
||||
return "";
|
||||
}
|
||||
|
||||
auto user = getIApp()->getAccounts()->twitch.getCurrent();
|
||||
if (user->isAnon())
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
ctx.channel->addSystemMessage(
|
||||
QString("You must be logged in to use the /announce%1 command.")
|
||||
.arg(colorStr)));
|
||||
.arg(colorStr));
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -93,7 +91,7 @@ QString sendAnnouncementColor(const CommandContext &ctx,
|
||||
break;
|
||||
}
|
||||
|
||||
channel->addMessage(makeSystemMessage(errorMessage));
|
||||
channel->addSystemMessage(errorMessage);
|
||||
});
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "controllers/accounts/AccountController.hpp"
|
||||
#include "controllers/commands/CommandContext.hpp"
|
||||
#include "controllers/commands/common/ChannelAction.hpp"
|
||||
#include "messages/MessageBuilder.hpp"
|
||||
#include "providers/twitch/api/Helix.hpp"
|
||||
#include "providers/twitch/TwitchAccount.hpp"
|
||||
#include "providers/twitch/TwitchChannel.hpp"
|
||||
@@ -93,7 +92,7 @@ void banUserByID(const ChannelPtr &channel, const QString &channelID,
|
||||
[channel, displayName](auto error, auto message) {
|
||||
auto errorMessage =
|
||||
formatBanTimeoutError("ban", error, message, displayName);
|
||||
channel->addMessage(makeSystemMessage(errorMessage));
|
||||
channel->addSystemMessage(errorMessage);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -110,7 +109,7 @@ void timeoutUserByID(const ChannelPtr &channel, const QString &channelID,
|
||||
[channel, displayName](auto error, auto message) {
|
||||
auto errorMessage =
|
||||
formatBanTimeoutError("timeout", error, message, displayName);
|
||||
channel->addMessage(makeSystemMessage(errorMessage));
|
||||
channel->addSystemMessage(errorMessage);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -129,7 +128,7 @@ QString sendBan(const CommandContext &ctx)
|
||||
{
|
||||
if (ctx.channel != nullptr)
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(actions.error()));
|
||||
ctx.channel->addSystemMessage(actions.error());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -145,8 +144,7 @@ QString sendBan(const CommandContext &ctx)
|
||||
auto currentUser = getIApp()->getAccounts()->twitch.getCurrent();
|
||||
if (currentUser->isAnon())
|
||||
{
|
||||
ctx.channel->addMessage(
|
||||
makeSystemMessage("You must be logged in to ban someone!"));
|
||||
ctx.channel->addSystemMessage("You must be logged in to ban someone!");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -192,16 +190,16 @@ QString sendBan(const CommandContext &ctx)
|
||||
userLoginsToFetch](const auto &users) mutable {
|
||||
if (!actionChannel.hydrateFrom(users))
|
||||
{
|
||||
channel->addMessage(makeSystemMessage(
|
||||
channel->addSystemMessage(
|
||||
QString("Failed to ban, bad channel name: %1")
|
||||
.arg(actionChannel.login)));
|
||||
.arg(actionChannel.login));
|
||||
return;
|
||||
}
|
||||
if (!actionTarget.hydrateFrom(users))
|
||||
{
|
||||
channel->addMessage(makeSystemMessage(
|
||||
channel->addSystemMessage(
|
||||
QString("Failed to ban, bad target name: %1")
|
||||
.arg(actionTarget.login)));
|
||||
.arg(actionTarget.login));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -210,9 +208,9 @@ QString sendBan(const CommandContext &ctx)
|
||||
reason, actionTarget.displayName);
|
||||
},
|
||||
[channel{ctx.channel}, userLoginsToFetch] {
|
||||
channel->addMessage(makeSystemMessage(
|
||||
channel->addSystemMessage(
|
||||
QString("Failed to ban, bad username(s): %1")
|
||||
.arg(userLoginsToFetch.join(", "))));
|
||||
.arg(userLoginsToFetch.join(", ")));
|
||||
});
|
||||
}
|
||||
else
|
||||
@@ -239,8 +237,8 @@ QString sendBanById(const CommandContext &ctx)
|
||||
}
|
||||
if (twitchChannel == nullptr)
|
||||
{
|
||||
channel->addMessage(makeSystemMessage(
|
||||
QString("The /banid command only works in Twitch channels.")));
|
||||
channel->addSystemMessage(
|
||||
"The /banid command only works in Twitch channels.");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -250,15 +248,14 @@ QString sendBanById(const CommandContext &ctx)
|
||||
"shown to the target user and other moderators.";
|
||||
if (words.size() < 2)
|
||||
{
|
||||
channel->addMessage(makeSystemMessage(usageStr));
|
||||
channel->addSystemMessage(usageStr);
|
||||
return "";
|
||||
}
|
||||
|
||||
auto currentUser = getIApp()->getAccounts()->twitch.getCurrent();
|
||||
if (currentUser->isAnon())
|
||||
{
|
||||
channel->addMessage(
|
||||
makeSystemMessage("You must be logged in to ban someone!"));
|
||||
channel->addSystemMessage("You must be logged in to ban someone!");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -282,7 +279,7 @@ QString sendTimeout(const CommandContext &ctx)
|
||||
{
|
||||
if (ctx.channel != nullptr)
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(actions.error()));
|
||||
ctx.channel->addSystemMessage(actions.error());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -298,8 +295,8 @@ QString sendTimeout(const CommandContext &ctx)
|
||||
auto currentUser = getIApp()->getAccounts()->twitch.getCurrent();
|
||||
if (currentUser->isAnon())
|
||||
{
|
||||
ctx.channel->addMessage(
|
||||
makeSystemMessage("You must be logged in to timeout someone!"));
|
||||
ctx.channel->addSystemMessage(
|
||||
"You must be logged in to timeout someone!");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -346,16 +343,16 @@ QString sendTimeout(const CommandContext &ctx)
|
||||
userLoginsToFetch](const auto &users) mutable {
|
||||
if (!actionChannel.hydrateFrom(users))
|
||||
{
|
||||
channel->addMessage(makeSystemMessage(
|
||||
channel->addSystemMessage(
|
||||
QString("Failed to timeout, bad channel name: %1")
|
||||
.arg(actionChannel.login)));
|
||||
.arg(actionChannel.login));
|
||||
return;
|
||||
}
|
||||
if (!actionTarget.hydrateFrom(users))
|
||||
{
|
||||
channel->addMessage(makeSystemMessage(
|
||||
channel->addSystemMessage(
|
||||
QString("Failed to timeout, bad target name: %1")
|
||||
.arg(actionTarget.login)));
|
||||
.arg(actionTarget.login));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -364,9 +361,9 @@ QString sendTimeout(const CommandContext &ctx)
|
||||
duration, reason, actionTarget.displayName);
|
||||
},
|
||||
[channel{ctx.channel}, userLoginsToFetch] {
|
||||
channel->addMessage(makeSystemMessage(
|
||||
channel->addSystemMessage(
|
||||
QString("Failed to timeout, bad username(s): %1")
|
||||
.arg(userLoginsToFetch.join(", "))));
|
||||
.arg(userLoginsToFetch.join(", ")));
|
||||
});
|
||||
}
|
||||
else
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include "common/Channel.hpp"
|
||||
#include "controllers/accounts/AccountController.hpp"
|
||||
#include "controllers/commands/CommandContext.hpp"
|
||||
#include "messages/MessageBuilder.hpp"
|
||||
#include "providers/twitch/api/Helix.hpp"
|
||||
#include "providers/twitch/TwitchAccount.hpp"
|
||||
#include "util/Twitch.hpp"
|
||||
@@ -26,14 +25,14 @@ QString blockUser(const CommandContext &ctx)
|
||||
|
||||
if (ctx.twitchChannel == nullptr)
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
"The /block command only works in Twitch channels."));
|
||||
ctx.channel->addSystemMessage(
|
||||
"The /block command only works in Twitch channels.");
|
||||
return "";
|
||||
}
|
||||
|
||||
if (ctx.words.size() < 2)
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage("Usage: /block <user>"));
|
||||
ctx.channel->addSystemMessage("Usage: /block <user>");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -41,8 +40,8 @@ QString blockUser(const CommandContext &ctx)
|
||||
|
||||
if (currentUser->isAnon())
|
||||
{
|
||||
ctx.channel->addMessage(
|
||||
makeSystemMessage("You must be logged in to block someone!"));
|
||||
ctx.channel->addSystemMessage(
|
||||
"You must be logged in to block someone!");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -56,22 +55,21 @@ QString blockUser(const CommandContext &ctx)
|
||||
getIApp()->getAccounts()->twitch.getCurrent()->blockUser(
|
||||
targetUser.id, nullptr,
|
||||
[channel, target, targetUser] {
|
||||
channel->addMessage(makeSystemMessage(
|
||||
channel->addSystemMessage(
|
||||
QString("You successfully blocked user %1")
|
||||
.arg(target)));
|
||||
.arg(target));
|
||||
},
|
||||
[channel, target] {
|
||||
channel->addMessage(makeSystemMessage(
|
||||
channel->addSystemMessage(
|
||||
QString("User %1 couldn't be blocked, an unknown "
|
||||
"error occurred!")
|
||||
.arg(target)));
|
||||
.arg(target));
|
||||
});
|
||||
},
|
||||
[channel{ctx.channel}, target] {
|
||||
channel->addMessage(
|
||||
makeSystemMessage(QString("User %1 couldn't be blocked, no "
|
||||
"user with that name found!")
|
||||
.arg(target)));
|
||||
channel->addSystemMessage(QString("User %1 couldn't be blocked, no "
|
||||
"user with that name found!")
|
||||
.arg(target));
|
||||
});
|
||||
|
||||
return "";
|
||||
@@ -84,9 +82,9 @@ QString ignoreUser(const CommandContext &ctx)
|
||||
return "";
|
||||
}
|
||||
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
ctx.channel->addSystemMessage(
|
||||
"Ignore command has been renamed to /block, please use it from "
|
||||
"now on as /ignore is going to be removed soon."));
|
||||
"now on as /ignore is going to be removed soon.");
|
||||
|
||||
return blockUser(ctx);
|
||||
}
|
||||
@@ -100,14 +98,14 @@ QString unblockUser(const CommandContext &ctx)
|
||||
|
||||
if (ctx.twitchChannel == nullptr)
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
"The /unblock command only works in Twitch channels."));
|
||||
ctx.channel->addSystemMessage(
|
||||
"The /unblock command only works in Twitch channels.");
|
||||
return "";
|
||||
}
|
||||
|
||||
if (ctx.words.size() < 2)
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage("Usage: /unblock <user>"));
|
||||
ctx.channel->addSystemMessage("Usage: /unblock <user>");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -115,8 +113,8 @@ QString unblockUser(const CommandContext &ctx)
|
||||
|
||||
if (currentUser->isAnon())
|
||||
{
|
||||
ctx.channel->addMessage(
|
||||
makeSystemMessage("You must be logged in to unblock someone!"));
|
||||
ctx.channel->addSystemMessage(
|
||||
"You must be logged in to unblock someone!");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -129,22 +127,21 @@ QString unblockUser(const CommandContext &ctx)
|
||||
getIApp()->getAccounts()->twitch.getCurrent()->unblockUser(
|
||||
targetUser.id, nullptr,
|
||||
[channel, target, targetUser] {
|
||||
channel->addMessage(makeSystemMessage(
|
||||
channel->addSystemMessage(
|
||||
QString("You successfully unblocked user %1")
|
||||
.arg(target)));
|
||||
.arg(target));
|
||||
},
|
||||
[channel, target] {
|
||||
channel->addMessage(makeSystemMessage(
|
||||
channel->addSystemMessage(
|
||||
QString("User %1 couldn't be unblocked, an unknown "
|
||||
"error occurred!")
|
||||
.arg(target)));
|
||||
.arg(target));
|
||||
});
|
||||
},
|
||||
[channel{ctx.channel}, target] {
|
||||
channel->addMessage(
|
||||
makeSystemMessage(QString("User %1 couldn't be unblocked, "
|
||||
"no user with that name found!")
|
||||
.arg(target)));
|
||||
channel->addSystemMessage(QString("User %1 couldn't be unblocked, "
|
||||
"no user with that name found!")
|
||||
.arg(target));
|
||||
});
|
||||
|
||||
return "";
|
||||
@@ -157,9 +154,9 @@ QString unignoreUser(const CommandContext &ctx)
|
||||
return "";
|
||||
}
|
||||
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
ctx.channel->addSystemMessage(
|
||||
"Unignore command has been renamed to /unblock, please use it "
|
||||
"from now on as /unignore is going to be removed soon."));
|
||||
"from now on as /unignore is going to be removed soon.");
|
||||
return unblockUser(ctx);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include "Application.hpp"
|
||||
#include "controllers/accounts/AccountController.hpp"
|
||||
#include "controllers/commands/CommandContext.hpp"
|
||||
#include "messages/MessageBuilder.hpp"
|
||||
#include "providers/twitch/api/Helix.hpp"
|
||||
#include "providers/twitch/TwitchAccount.hpp"
|
||||
#include "providers/twitch/TwitchChannel.hpp"
|
||||
@@ -87,8 +86,8 @@ auto successCallback = [](auto result) {};
|
||||
auto failureCallback = [](ChannelPtr channel, int durationUnitMultiplier = 1) {
|
||||
return [channel, durationUnitMultiplier](const auto &error,
|
||||
const QString &message) {
|
||||
channel->addMessage(makeSystemMessage(
|
||||
formatError(error, message, durationUnitMultiplier)));
|
||||
channel->addSystemMessage(
|
||||
formatError(error, message, durationUnitMultiplier));
|
||||
};
|
||||
};
|
||||
|
||||
@@ -104,21 +103,21 @@ QString emoteOnly(const CommandContext &ctx)
|
||||
auto currentUser = getIApp()->getAccounts()->twitch.getCurrent();
|
||||
if (currentUser->isAnon())
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(P_NOT_LOGGED_IN));
|
||||
ctx.channel->addSystemMessage(P_NOT_LOGGED_IN);
|
||||
return "";
|
||||
}
|
||||
|
||||
if (ctx.twitchChannel == nullptr)
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
"The /emoteonly command only works in Twitch channels."));
|
||||
ctx.channel->addSystemMessage(
|
||||
"The /emoteonly command only works in Twitch channels.");
|
||||
return "";
|
||||
}
|
||||
|
||||
if (ctx.twitchChannel->accessRoomModes()->emoteOnly)
|
||||
{
|
||||
ctx.channel->addMessage(
|
||||
makeSystemMessage("This room is already in emote-only mode."));
|
||||
ctx.channel->addSystemMessage(
|
||||
"This room is already in emote-only mode.");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -134,20 +133,19 @@ QString emoteOnlyOff(const CommandContext &ctx)
|
||||
auto currentUser = getIApp()->getAccounts()->twitch.getCurrent();
|
||||
if (currentUser->isAnon())
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(P_NOT_LOGGED_IN));
|
||||
ctx.channel->addSystemMessage(P_NOT_LOGGED_IN);
|
||||
return "";
|
||||
}
|
||||
if (ctx.twitchChannel == nullptr)
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
"The /emoteonlyoff command only works in Twitch channels."));
|
||||
ctx.channel->addSystemMessage(
|
||||
"The /emoteonlyoff command only works in Twitch channels.");
|
||||
return "";
|
||||
}
|
||||
|
||||
if (!ctx.twitchChannel->accessRoomModes()->emoteOnly)
|
||||
{
|
||||
ctx.channel->addMessage(
|
||||
makeSystemMessage("This room is not in emote-only mode."));
|
||||
ctx.channel->addSystemMessage("This room is not in emote-only mode.");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -163,21 +161,21 @@ QString subscribers(const CommandContext &ctx)
|
||||
auto currentUser = getIApp()->getAccounts()->twitch.getCurrent();
|
||||
if (currentUser->isAnon())
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(P_NOT_LOGGED_IN));
|
||||
ctx.channel->addSystemMessage(P_NOT_LOGGED_IN);
|
||||
return "";
|
||||
}
|
||||
|
||||
if (ctx.twitchChannel == nullptr)
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
"The /subscribers command only works in Twitch channels."));
|
||||
ctx.channel->addSystemMessage(
|
||||
"The /subscribers command only works in Twitch channels.");
|
||||
return "";
|
||||
}
|
||||
|
||||
if (ctx.twitchChannel->accessRoomModes()->submode)
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
"This room is already in subscribers-only mode."));
|
||||
ctx.channel->addSystemMessage(
|
||||
"This room is already in subscribers-only mode.");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -193,21 +191,21 @@ QString subscribersOff(const CommandContext &ctx)
|
||||
auto currentUser = getIApp()->getAccounts()->twitch.getCurrent();
|
||||
if (currentUser->isAnon())
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(P_NOT_LOGGED_IN));
|
||||
ctx.channel->addSystemMessage(P_NOT_LOGGED_IN);
|
||||
return "";
|
||||
}
|
||||
|
||||
if (ctx.twitchChannel == nullptr)
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
"The /subscribersoff command only works in Twitch channels."));
|
||||
ctx.channel->addSystemMessage(
|
||||
"The /subscribersoff command only works in Twitch channels.");
|
||||
return "";
|
||||
}
|
||||
|
||||
if (!ctx.twitchChannel->accessRoomModes()->submode)
|
||||
{
|
||||
ctx.channel->addMessage(
|
||||
makeSystemMessage("This room is not in subscribers-only mode."));
|
||||
ctx.channel->addSystemMessage(
|
||||
"This room is not in subscribers-only mode.");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -223,14 +221,14 @@ QString slow(const CommandContext &ctx)
|
||||
auto currentUser = getIApp()->getAccounts()->twitch.getCurrent();
|
||||
if (currentUser->isAnon())
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(P_NOT_LOGGED_IN));
|
||||
ctx.channel->addSystemMessage(P_NOT_LOGGED_IN);
|
||||
return "";
|
||||
}
|
||||
|
||||
if (ctx.twitchChannel == nullptr)
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
"The /slow command only works in Twitch channels."));
|
||||
ctx.channel->addSystemMessage(
|
||||
"The /slow command only works in Twitch channels.");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -241,20 +239,20 @@ QString slow(const CommandContext &ctx)
|
||||
duration = ctx.words.at(1).toInt(&ok);
|
||||
if (!ok || duration <= 0)
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
ctx.channel->addSystemMessage(
|
||||
"Usage: \"/slow [duration]\" - Enables slow mode (limit how "
|
||||
"often users may send messages). Duration (optional, "
|
||||
"default=30) must be a positive number of seconds. Use "
|
||||
"\"slowoff\" to disable."));
|
||||
"\"slowoff\" to disable.");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
if (ctx.twitchChannel->accessRoomModes()->slowMode == duration)
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
ctx.channel->addSystemMessage(
|
||||
QString("This room is already in %1-second slow mode.")
|
||||
.arg(duration)));
|
||||
.arg(duration));
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -270,21 +268,20 @@ QString slowOff(const CommandContext &ctx)
|
||||
auto currentUser = getIApp()->getAccounts()->twitch.getCurrent();
|
||||
if (currentUser->isAnon())
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(P_NOT_LOGGED_IN));
|
||||
ctx.channel->addSystemMessage(P_NOT_LOGGED_IN);
|
||||
return "";
|
||||
}
|
||||
|
||||
if (ctx.twitchChannel == nullptr)
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
"The /slowoff command only works in Twitch channels."));
|
||||
ctx.channel->addSystemMessage(
|
||||
"The /slowoff command only works in Twitch channels.");
|
||||
return "";
|
||||
}
|
||||
|
||||
if (ctx.twitchChannel->accessRoomModes()->slowMode <= 0)
|
||||
{
|
||||
ctx.channel->addMessage(
|
||||
makeSystemMessage("This room is not in slow mode."));
|
||||
ctx.channel->addSystemMessage("This room is not in slow mode.");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -300,14 +297,14 @@ QString followers(const CommandContext &ctx)
|
||||
auto currentUser = getIApp()->getAccounts()->twitch.getCurrent();
|
||||
if (currentUser->isAnon())
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(P_NOT_LOGGED_IN));
|
||||
ctx.channel->addSystemMessage(P_NOT_LOGGED_IN);
|
||||
return "";
|
||||
}
|
||||
|
||||
if (ctx.twitchChannel == nullptr)
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
"The /followers command only works in Twitch channels."));
|
||||
ctx.channel->addSystemMessage(
|
||||
"The /followers command only works in Twitch channels.");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -319,20 +316,20 @@ QString followers(const CommandContext &ctx)
|
||||
// -1 / 60 == 0 => use parsed
|
||||
if (parsed < 0)
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
ctx.channel->addSystemMessage(
|
||||
"Usage: \"/followers [duration]\" - Enables followers-only "
|
||||
"mode (only users who have followed for 'duration' may chat). "
|
||||
"Examples: \"30m\", \"1 week\", \"5 days 12 hours\". Must be "
|
||||
"less than 3 months."));
|
||||
"less than 3 months.");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
if (ctx.twitchChannel->accessRoomModes()->followerOnly == duration)
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
ctx.channel->addSystemMessage(
|
||||
QString("This room is already in %1 followers-only mode.")
|
||||
.arg(formatTime(duration * 60))));
|
||||
.arg(formatTime(duration * 60)));
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -348,21 +345,21 @@ QString followersOff(const CommandContext &ctx)
|
||||
auto currentUser = getIApp()->getAccounts()->twitch.getCurrent();
|
||||
if (currentUser->isAnon())
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(P_NOT_LOGGED_IN));
|
||||
ctx.channel->addSystemMessage(P_NOT_LOGGED_IN);
|
||||
return "";
|
||||
}
|
||||
|
||||
if (ctx.twitchChannel == nullptr)
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
"The /followersoff command only works in Twitch channels."));
|
||||
ctx.channel->addSystemMessage(
|
||||
"The /followersoff command only works in Twitch channels.");
|
||||
return "";
|
||||
}
|
||||
|
||||
if (ctx.twitchChannel->accessRoomModes()->followerOnly < 0)
|
||||
{
|
||||
ctx.channel->addMessage(
|
||||
makeSystemMessage("This room is not in followers-only mode. "));
|
||||
ctx.channel->addSystemMessage(
|
||||
"This room is not in followers-only mode. ");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -378,21 +375,21 @@ QString uniqueChat(const CommandContext &ctx)
|
||||
auto currentUser = getIApp()->getAccounts()->twitch.getCurrent();
|
||||
if (currentUser->isAnon())
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(P_NOT_LOGGED_IN));
|
||||
ctx.channel->addSystemMessage(P_NOT_LOGGED_IN);
|
||||
return "";
|
||||
}
|
||||
|
||||
if (ctx.twitchChannel == nullptr)
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
"The /uniquechat command only works in Twitch channels."));
|
||||
ctx.channel->addSystemMessage(
|
||||
"The /uniquechat command only works in Twitch channels.");
|
||||
return "";
|
||||
}
|
||||
|
||||
if (ctx.twitchChannel->accessRoomModes()->r9k)
|
||||
{
|
||||
ctx.channel->addMessage(
|
||||
makeSystemMessage("This room is already in unique-chat mode."));
|
||||
ctx.channel->addSystemMessage(
|
||||
"This room is already in unique-chat mode.");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -408,21 +405,20 @@ QString uniqueChatOff(const CommandContext &ctx)
|
||||
auto currentUser = getIApp()->getAccounts()->twitch.getCurrent();
|
||||
if (currentUser->isAnon())
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(P_NOT_LOGGED_IN));
|
||||
ctx.channel->addSystemMessage(P_NOT_LOGGED_IN);
|
||||
return "";
|
||||
}
|
||||
|
||||
if (ctx.twitchChannel == nullptr)
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
"The /uniquechatoff command only works in Twitch channels."));
|
||||
ctx.channel->addSystemMessage(
|
||||
"The /uniquechatoff command only works in Twitch channels.");
|
||||
return "";
|
||||
}
|
||||
|
||||
if (!ctx.twitchChannel->accessRoomModes()->r9k)
|
||||
{
|
||||
ctx.channel->addMessage(
|
||||
makeSystemMessage("This room is not in unique-chat mode."));
|
||||
ctx.channel->addSystemMessage("This room is not in unique-chat mode.");
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
@@ -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 "";
|
||||
|
||||
@@ -26,9 +26,9 @@ QString deleteMessages(TwitchChannel *twitchChannel, const QString &messageID)
|
||||
// Avoid Helix calls without Client ID and/or OAuth Token
|
||||
if (user->isAnon())
|
||||
{
|
||||
twitchChannel->addMessage(makeSystemMessage(
|
||||
twitchChannel->addSystemMessage(
|
||||
QString("You must be logged in to use the %1 command.")
|
||||
.arg(commandName)));
|
||||
.arg(commandName));
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ QString deleteMessages(TwitchChannel *twitchChannel, const QString &messageID)
|
||||
break;
|
||||
}
|
||||
|
||||
twitchChannel->addMessage(makeSystemMessage(errorMessage));
|
||||
twitchChannel->addSystemMessage(errorMessage);
|
||||
});
|
||||
|
||||
return "";
|
||||
@@ -101,8 +101,8 @@ QString deleteAllMessages(const CommandContext &ctx)
|
||||
|
||||
if (ctx.twitchChannel == nullptr)
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
"The /clear command only works in Twitch channels."));
|
||||
ctx.channel->addSystemMessage(
|
||||
"The /clear command only works in Twitch channels.");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -120,16 +120,15 @@ QString deleteOneMessage(const CommandContext &ctx)
|
||||
// We use this to ensure the user gets better error messages for missing or malformed arguments
|
||||
if (ctx.twitchChannel == nullptr)
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
"The /delete command only works in Twitch channels."));
|
||||
ctx.channel->addSystemMessage(
|
||||
"The /delete command only works in Twitch channels.");
|
||||
return "";
|
||||
}
|
||||
|
||||
if (ctx.words.size() < 2)
|
||||
{
|
||||
ctx.channel->addMessage(
|
||||
makeSystemMessage("Usage: /delete <msg-id> - Deletes the "
|
||||
"specified message."));
|
||||
ctx.channel->addSystemMessage("Usage: /delete <msg-id> - Deletes the "
|
||||
"specified message.");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -138,8 +137,8 @@ QString deleteOneMessage(const CommandContext &ctx)
|
||||
if (uuid.isNull())
|
||||
{
|
||||
// The message id must be a valid UUID
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
QString("Invalid msg-id: \"%1\"").arg(messageID)));
|
||||
ctx.channel->addSystemMessage(
|
||||
QString("Invalid msg-id: \"%1\"").arg(messageID));
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -149,9 +148,9 @@ QString deleteOneMessage(const CommandContext &ctx)
|
||||
if (msg->loginName == ctx.channel->getName() &&
|
||||
!ctx.channel->isBroadcaster())
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
ctx.channel->addSystemMessage(
|
||||
"You cannot delete the broadcaster's messages unless "
|
||||
"you are the broadcaster."));
|
||||
"you are the broadcaster.");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,8 +60,8 @@ QString getModerators(const CommandContext &ctx)
|
||||
|
||||
if (ctx.twitchChannel == nullptr)
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
"The /mods command only works in Twitch Channels."));
|
||||
ctx.channel->addSystemMessage(
|
||||
"The /mods command only works in Twitch Channels.");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -70,8 +70,8 @@ QString getModerators(const CommandContext &ctx)
|
||||
[channel{ctx.channel}, twitchChannel{ctx.twitchChannel}](auto result) {
|
||||
if (result.empty())
|
||||
{
|
||||
channel->addMessage(makeSystemMessage(
|
||||
"This channel does not have any moderators."));
|
||||
channel->addSystemMessage(
|
||||
"This channel does not have any moderators.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ QString getModerators(const CommandContext &ctx)
|
||||
},
|
||||
[channel{ctx.channel}](auto error, auto message) {
|
||||
auto errorMessage = formatModsError(error, message);
|
||||
channel->addMessage(makeSystemMessage(errorMessage));
|
||||
channel->addSystemMessage(errorMessage);
|
||||
});
|
||||
|
||||
return "";
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include "providers/twitch/TwitchAccount.hpp"
|
||||
#include "providers/twitch/TwitchChannel.hpp"
|
||||
#include "providers/twitch/TwitchMessageBuilder.hpp"
|
||||
#include "util/Twitch.hpp"
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -77,19 +76,19 @@ QString getVIPs(const CommandContext &ctx)
|
||||
|
||||
if (ctx.twitchChannel == nullptr)
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
"The /vips command only works in Twitch channels."));
|
||||
ctx.channel->addSystemMessage(
|
||||
"The /vips command only works in Twitch channels.");
|
||||
return "";
|
||||
}
|
||||
|
||||
auto currentUser = getIApp()->getAccounts()->twitch.getCurrent();
|
||||
if (currentUser->isAnon())
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
ctx.channel->addSystemMessage(
|
||||
"Due to Twitch restrictions, " //
|
||||
"this command can only be used by the broadcaster. "
|
||||
"To see the list of VIPs you must use the "
|
||||
"Twitch website."));
|
||||
"Twitch website.");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -99,8 +98,8 @@ QString getVIPs(const CommandContext &ctx)
|
||||
const std::vector<HelixVip> &vipList) {
|
||||
if (vipList.empty())
|
||||
{
|
||||
channel->addMessage(
|
||||
makeSystemMessage("This channel does not have any VIPs."));
|
||||
channel->addSystemMessage(
|
||||
"This channel does not have any VIPs.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -115,7 +114,7 @@ QString getVIPs(const CommandContext &ctx)
|
||||
},
|
||||
[channel{ctx.channel}](auto error, auto message) {
|
||||
auto errorMessage = formatGetVIPsError(error, message);
|
||||
channel->addMessage(makeSystemMessage(errorMessage));
|
||||
channel->addSystemMessage(errorMessage);
|
||||
});
|
||||
|
||||
return "";
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include "Application.hpp"
|
||||
#include "controllers/accounts/AccountController.hpp"
|
||||
#include "controllers/commands/CommandContext.hpp"
|
||||
#include "messages/MessageBuilder.hpp"
|
||||
#include "providers/twitch/api/Helix.hpp"
|
||||
#include "providers/twitch/TwitchAccount.hpp"
|
||||
#include "providers/twitch/TwitchChannel.hpp"
|
||||
@@ -124,24 +123,23 @@ QString startRaid(const CommandContext &ctx)
|
||||
|
||||
if (ctx.twitchChannel == nullptr)
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
"The /raid command only works in Twitch channels."));
|
||||
ctx.channel->addSystemMessage(
|
||||
"The /raid command only works in Twitch channels.");
|
||||
return "";
|
||||
}
|
||||
|
||||
if (ctx.words.size() < 2)
|
||||
{
|
||||
ctx.channel->addMessage(
|
||||
makeSystemMessage("Usage: \"/raid <username>\" - Raid a user. "
|
||||
"Only the broadcaster can start a raid."));
|
||||
ctx.channel->addSystemMessage(
|
||||
"Usage: \"/raid <username>\" - Raid a user. "
|
||||
"Only the broadcaster can start a raid.");
|
||||
return "";
|
||||
}
|
||||
|
||||
auto currentUser = getIApp()->getAccounts()->twitch.getCurrent();
|
||||
if (currentUser->isAnon())
|
||||
{
|
||||
ctx.channel->addMessage(
|
||||
makeSystemMessage("You must be logged in to start a raid!"));
|
||||
ctx.channel->addSystemMessage("You must be logged in to start a raid!");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -155,19 +153,18 @@ QString startRaid(const CommandContext &ctx)
|
||||
getHelix()->startRaid(
|
||||
twitchChannel->roomId(), targetUser.id,
|
||||
[channel, targetUser] {
|
||||
channel->addMessage(
|
||||
makeSystemMessage(QString("You started to raid %1.")
|
||||
.arg(targetUser.displayName)));
|
||||
channel->addSystemMessage(QString("You started to raid %1.")
|
||||
.arg(targetUser.displayName));
|
||||
},
|
||||
[channel, targetUser](auto error, auto message) {
|
||||
auto errorMessage = formatStartRaidError(error, message);
|
||||
channel->addMessage(makeSystemMessage(errorMessage));
|
||||
channel->addSystemMessage(errorMessage);
|
||||
});
|
||||
},
|
||||
[channel{ctx.channel}, target] {
|
||||
// Equivalent error from IRC
|
||||
channel->addMessage(
|
||||
makeSystemMessage(QString("Invalid username: %1").arg(target)));
|
||||
channel->addSystemMessage(
|
||||
QString("Invalid username: %1").arg(target));
|
||||
});
|
||||
|
||||
return "";
|
||||
@@ -182,36 +179,35 @@ QString cancelRaid(const CommandContext &ctx)
|
||||
|
||||
if (ctx.twitchChannel == nullptr)
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
"The /unraid command only works in Twitch channels."));
|
||||
ctx.channel->addSystemMessage(
|
||||
"The /unraid command only works in Twitch channels.");
|
||||
return "";
|
||||
}
|
||||
|
||||
if (ctx.words.size() != 1)
|
||||
{
|
||||
ctx.channel->addMessage(
|
||||
makeSystemMessage("Usage: \"/unraid\" - Cancel the current raid. "
|
||||
"Only the broadcaster can cancel the raid."));
|
||||
ctx.channel->addSystemMessage(
|
||||
"Usage: \"/unraid\" - Cancel the current raid. "
|
||||
"Only the broadcaster can cancel the raid.");
|
||||
return "";
|
||||
}
|
||||
|
||||
auto currentUser = getIApp()->getAccounts()->twitch.getCurrent();
|
||||
if (currentUser->isAnon())
|
||||
{
|
||||
ctx.channel->addMessage(
|
||||
makeSystemMessage("You must be logged in to cancel the raid!"));
|
||||
ctx.channel->addSystemMessage(
|
||||
"You must be logged in to cancel the raid!");
|
||||
return "";
|
||||
}
|
||||
|
||||
getHelix()->cancelRaid(
|
||||
ctx.twitchChannel->roomId(),
|
||||
[channel{ctx.channel}] {
|
||||
channel->addMessage(
|
||||
makeSystemMessage(QString("You cancelled the raid.")));
|
||||
channel->addSystemMessage("You cancelled the raid.");
|
||||
},
|
||||
[channel{ctx.channel}](auto error, auto message) {
|
||||
auto errorMessage = formatCancelRaidError(error, message);
|
||||
channel->addMessage(makeSystemMessage(errorMessage));
|
||||
channel->addSystemMessage(errorMessage);
|
||||
});
|
||||
|
||||
return "";
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
#include "controllers/commands/builtin/twitch/RemoveModerator.hpp"
|
||||
|
||||
#include "Application.hpp"
|
||||
#include "common/Channel.hpp"
|
||||
#include "controllers/accounts/AccountController.hpp"
|
||||
#include "controllers/commands/CommandContext.hpp"
|
||||
#include "messages/MessageBuilder.hpp"
|
||||
#include "providers/twitch/api/Helix.hpp"
|
||||
#include "providers/twitch/TwitchAccount.hpp"
|
||||
#include "providers/twitch/TwitchChannel.hpp"
|
||||
@@ -22,23 +20,23 @@ QString removeModerator(const CommandContext &ctx)
|
||||
|
||||
if (ctx.twitchChannel == nullptr)
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
"The /unmod command only works in Twitch channels."));
|
||||
ctx.channel->addSystemMessage(
|
||||
"The /unmod command only works in Twitch channels.");
|
||||
return "";
|
||||
}
|
||||
if (ctx.words.size() < 2)
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
ctx.channel->addSystemMessage(
|
||||
"Usage: \"/unmod <username>\" - Revoke moderator status from a "
|
||||
"user. Use \"/mods\" to list the moderators of this channel."));
|
||||
"user. Use \"/mods\" to list the moderators of this channel.");
|
||||
return "";
|
||||
}
|
||||
|
||||
auto currentUser = getIApp()->getAccounts()->twitch.getCurrent();
|
||||
if (currentUser->isAnon())
|
||||
{
|
||||
ctx.channel->addMessage(
|
||||
makeSystemMessage("You must be logged in to unmod someone!"));
|
||||
ctx.channel->addSystemMessage(
|
||||
"You must be logged in to unmod someone!");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -52,10 +50,10 @@ QString removeModerator(const CommandContext &ctx)
|
||||
getHelix()->removeChannelModerator(
|
||||
twitchChannel->roomId(), targetUser.id,
|
||||
[channel, targetUser] {
|
||||
channel->addMessage(makeSystemMessage(
|
||||
channel->addSystemMessage(
|
||||
QString("You have removed %1 as a moderator of "
|
||||
"this channel.")
|
||||
.arg(targetUser.displayName)));
|
||||
.arg(targetUser.displayName));
|
||||
},
|
||||
[channel, targetUser](auto error, auto message) {
|
||||
QString errorMessage =
|
||||
@@ -107,13 +105,13 @@ QString removeModerator(const CommandContext &ctx)
|
||||
}
|
||||
break;
|
||||
}
|
||||
channel->addMessage(makeSystemMessage(errorMessage));
|
||||
channel->addSystemMessage(errorMessage);
|
||||
});
|
||||
},
|
||||
[channel{ctx.channel}, target] {
|
||||
// Equivalent error from IRC
|
||||
channel->addMessage(
|
||||
makeSystemMessage(QString("Invalid username: %1").arg(target)));
|
||||
channel->addSystemMessage(
|
||||
QString("Invalid username: %1").arg(target));
|
||||
});
|
||||
|
||||
return "";
|
||||
|
||||
@@ -22,23 +22,23 @@ QString removeVIP(const CommandContext &ctx)
|
||||
|
||||
if (ctx.twitchChannel == nullptr)
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
"The /unvip command only works in Twitch channels."));
|
||||
ctx.channel->addSystemMessage(
|
||||
"The /unvip command only works in Twitch channels.");
|
||||
return "";
|
||||
}
|
||||
if (ctx.words.size() < 2)
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
ctx.channel->addSystemMessage(
|
||||
"Usage: \"/unvip <username>\" - Revoke VIP status from a user. "
|
||||
"Use \"/vips\" to list the VIPs of this channel."));
|
||||
"Use \"/vips\" to list the VIPs of this channel.");
|
||||
return "";
|
||||
}
|
||||
|
||||
auto currentUser = getIApp()->getAccounts()->twitch.getCurrent();
|
||||
if (currentUser->isAnon())
|
||||
{
|
||||
ctx.channel->addMessage(
|
||||
makeSystemMessage("You must be logged in to UnVIP someone!"));
|
||||
ctx.channel->addSystemMessage(
|
||||
"You must be logged in to UnVIP someone!");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -52,9 +52,9 @@ QString removeVIP(const CommandContext &ctx)
|
||||
getHelix()->removeChannelVIP(
|
||||
twitchChannel->roomId(), targetUser.id,
|
||||
[channel, targetUser] {
|
||||
channel->addMessage(makeSystemMessage(
|
||||
channel->addSystemMessage(
|
||||
QString("You have removed %1 as a VIP of this channel.")
|
||||
.arg(targetUser.displayName)));
|
||||
.arg(targetUser.displayName));
|
||||
},
|
||||
[channel, targetUser](auto error, auto message) {
|
||||
QString errorMessage = QString("Failed to remove VIP - ");
|
||||
@@ -97,13 +97,13 @@ QString removeVIP(const CommandContext &ctx)
|
||||
}
|
||||
break;
|
||||
}
|
||||
channel->addMessage(makeSystemMessage(errorMessage));
|
||||
channel->addSystemMessage(errorMessage);
|
||||
});
|
||||
},
|
||||
[channel{ctx.channel}, target] {
|
||||
// Equivalent error from IRC
|
||||
channel->addMessage(
|
||||
makeSystemMessage(QString("Invalid username: %1").arg(target)));
|
||||
channel->addSystemMessage(
|
||||
QString("Invalid username: %1").arg(target));
|
||||
});
|
||||
|
||||
return "";
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
#include "controllers/commands/builtin/twitch/SendReply.hpp"
|
||||
|
||||
#include "common/Channel.hpp"
|
||||
#include "controllers/commands/CommandContext.hpp"
|
||||
#include "messages/Message.hpp"
|
||||
#include "messages/MessageBuilder.hpp"
|
||||
#include "messages/MessageThread.hpp"
|
||||
#include "providers/twitch/TwitchChannel.hpp"
|
||||
#include "util/Twitch.hpp"
|
||||
@@ -19,15 +17,14 @@ QString sendReply(const CommandContext &ctx)
|
||||
|
||||
if (ctx.twitchChannel == nullptr)
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
"The /reply command only works in Twitch channels."));
|
||||
ctx.channel->addSystemMessage(
|
||||
"The /reply command only works in Twitch channels.");
|
||||
return "";
|
||||
}
|
||||
|
||||
if (ctx.words.size() < 3)
|
||||
{
|
||||
ctx.channel->addMessage(
|
||||
makeSystemMessage("Usage: /reply <username> <message>"));
|
||||
ctx.channel->addSystemMessage("Usage: /reply <username> <message>");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -54,8 +51,7 @@ QString sendReply(const CommandContext &ctx)
|
||||
}
|
||||
}
|
||||
|
||||
ctx.channel->addMessage(
|
||||
makeSystemMessage("A message from that user wasn't found."));
|
||||
ctx.channel->addSystemMessage("A message from that user wasn't found.");
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -208,16 +208,15 @@ QString sendWhisper(const CommandContext &ctx)
|
||||
|
||||
if (ctx.words.size() < 3)
|
||||
{
|
||||
ctx.channel->addMessage(
|
||||
makeSystemMessage("Usage: /w <username> <message>"));
|
||||
ctx.channel->addSystemMessage("Usage: /w <username> <message>");
|
||||
return "";
|
||||
}
|
||||
|
||||
auto currentUser = getIApp()->getAccounts()->twitch.getCurrent();
|
||||
if (currentUser->isAnon())
|
||||
{
|
||||
ctx.channel->addMessage(
|
||||
makeSystemMessage("You must be logged in to send a whisper!"));
|
||||
ctx.channel->addSystemMessage(
|
||||
"You must be logged in to send a whisper!");
|
||||
return "";
|
||||
}
|
||||
auto target = ctx.words.at(1);
|
||||
@@ -236,12 +235,11 @@ QString sendWhisper(const CommandContext &ctx)
|
||||
},
|
||||
[channel, target, targetUser](auto error, auto message) {
|
||||
auto errorMessage = formatWhisperError(error, message);
|
||||
channel->addMessage(makeSystemMessage(errorMessage));
|
||||
channel->addSystemMessage(errorMessage);
|
||||
});
|
||||
},
|
||||
[channel{ctx.channel}] {
|
||||
channel->addMessage(
|
||||
makeSystemMessage("No user matching that username."));
|
||||
channel->addSystemMessage("No user matching that username.");
|
||||
});
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include "Application.hpp"
|
||||
#include "controllers/accounts/AccountController.hpp"
|
||||
#include "controllers/commands/CommandContext.hpp"
|
||||
#include "messages/MessageBuilder.hpp"
|
||||
#include "providers/twitch/api/Helix.hpp"
|
||||
#include "providers/twitch/TwitchAccount.hpp"
|
||||
#include "providers/twitch/TwitchChannel.hpp"
|
||||
@@ -17,9 +16,9 @@ QString toggleShieldMode(const CommandContext &ctx, bool isActivating)
|
||||
|
||||
if (ctx.twitchChannel == nullptr)
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
ctx.channel->addSystemMessage(
|
||||
QStringLiteral("The %1 command only works in Twitch channels.")
|
||||
.arg(command)));
|
||||
.arg(command));
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -28,9 +27,9 @@ QString toggleShieldMode(const CommandContext &ctx, bool isActivating)
|
||||
// Avoid Helix calls without Client ID and/or OAuth Token
|
||||
if (user->isAnon())
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
ctx.channel->addSystemMessage(
|
||||
QStringLiteral("You must be logged in to use the %1 command.")
|
||||
.arg(command)));
|
||||
.arg(command));
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -39,13 +38,11 @@ QString toggleShieldMode(const CommandContext &ctx, bool isActivating)
|
||||
[channel = ctx.channel](const auto &res) {
|
||||
if (!res.isActive)
|
||||
{
|
||||
channel->addMessage(
|
||||
makeSystemMessage("Shield mode was deactivated."));
|
||||
channel->addSystemMessage("Shield mode was deactivated.");
|
||||
return;
|
||||
}
|
||||
|
||||
channel->addMessage(
|
||||
makeSystemMessage("Shield mode was activated."));
|
||||
channel->addSystemMessage("Shield mode was activated.");
|
||||
},
|
||||
[channel = ctx.channel](const auto error, const auto &message) {
|
||||
using Error = HelixUpdateShieldModeError;
|
||||
@@ -78,7 +75,7 @@ QString toggleShieldMode(const CommandContext &ctx, bool isActivating)
|
||||
}
|
||||
break;
|
||||
}
|
||||
channel->addMessage(makeSystemMessage(errorMessage));
|
||||
channel->addSystemMessage(errorMessage);
|
||||
});
|
||||
|
||||
return {};
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include "Application.hpp"
|
||||
#include "controllers/accounts/AccountController.hpp"
|
||||
#include "controllers/commands/CommandContext.hpp"
|
||||
#include "messages/MessageBuilder.hpp"
|
||||
#include "providers/twitch/api/Helix.hpp"
|
||||
#include "providers/twitch/TwitchAccount.hpp"
|
||||
#include "providers/twitch/TwitchChannel.hpp"
|
||||
@@ -19,24 +18,22 @@ QString sendShoutout(const CommandContext &ctx)
|
||||
|
||||
if (twitchChannel == nullptr)
|
||||
{
|
||||
channel->addMessage(makeSystemMessage(
|
||||
"The /shoutout command only works in Twitch channels."));
|
||||
channel->addSystemMessage(
|
||||
"The /shoutout command only works in Twitch channels.");
|
||||
return "";
|
||||
}
|
||||
|
||||
auto currentUser = getIApp()->getAccounts()->twitch.getCurrent();
|
||||
if (currentUser->isAnon())
|
||||
{
|
||||
channel->addMessage(
|
||||
makeSystemMessage("You must be logged in to send shoutout."));
|
||||
channel->addSystemMessage("You must be logged in to send shoutout.");
|
||||
return "";
|
||||
}
|
||||
|
||||
if (words->size() < 2)
|
||||
{
|
||||
channel->addMessage(
|
||||
makeSystemMessage("Usage: \"/shoutout <username>\" - Sends a "
|
||||
"shoutout to the specified twitch user"));
|
||||
channel->addSystemMessage("Usage: \"/shoutout <username>\" - Sends a "
|
||||
"shoutout to the specified twitch user");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -52,8 +49,8 @@ QString sendShoutout(const CommandContext &ctx)
|
||||
twitchChannel->roomId(), targetUser.id,
|
||||
currentUser->getUserId(),
|
||||
[channel, targetUser]() {
|
||||
channel->addMessage(makeSystemMessage(
|
||||
QString("Sent shoutout to %1").arg(targetUser.login)));
|
||||
channel->addSystemMessage(
|
||||
QString("Sent shoutout to %1").arg(targetUser.login));
|
||||
},
|
||||
[channel](auto error, auto message) {
|
||||
QString errorMessage = "Failed to send shoutout - ";
|
||||
@@ -99,13 +96,13 @@ QString sendShoutout(const CommandContext &ctx)
|
||||
break;
|
||||
}
|
||||
|
||||
channel->addMessage(makeSystemMessage(errorMessage));
|
||||
channel->addSystemMessage(errorMessage);
|
||||
});
|
||||
},
|
||||
[channel, target] {
|
||||
// Equivalent error from IRC
|
||||
channel->addMessage(
|
||||
makeSystemMessage(QString("Invalid username: %1").arg(target)));
|
||||
channel->addSystemMessage(
|
||||
QString("Invalid username: %1").arg(target));
|
||||
});
|
||||
|
||||
return "";
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
#include "controllers/commands/builtin/twitch/StartCommercial.hpp"
|
||||
|
||||
#include "Application.hpp"
|
||||
#include "common/Channel.hpp"
|
||||
#include "controllers/accounts/AccountController.hpp"
|
||||
#include "controllers/commands/CommandContext.hpp"
|
||||
#include "messages/MessageBuilder.hpp"
|
||||
#include "providers/twitch/api/Helix.hpp"
|
||||
#include "providers/twitch/TwitchAccount.hpp"
|
||||
#include "providers/twitch/TwitchChannel.hpp"
|
||||
@@ -83,8 +81,8 @@ QString startCommercial(const CommandContext &ctx)
|
||||
|
||||
if (ctx.twitchChannel == nullptr)
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
"The /commercial command only works in Twitch channels."));
|
||||
ctx.channel->addSystemMessage(
|
||||
"The /commercial command only works in Twitch channels.");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -96,7 +94,7 @@ QString startCommercial(const CommandContext &ctx)
|
||||
|
||||
if (ctx.words.size() < 2)
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(usageStr));
|
||||
ctx.channel->addSystemMessage(usageStr);
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -105,8 +103,8 @@ QString startCommercial(const CommandContext &ctx)
|
||||
// Avoid Helix calls without Client ID and/or OAuth Token
|
||||
if (user->isAnon())
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
"You must be logged in to use the /commercial command."));
|
||||
ctx.channel->addSystemMessage(
|
||||
"You must be logged in to use the /commercial command.");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -116,18 +114,18 @@ QString startCommercial(const CommandContext &ctx)
|
||||
getHelix()->startCommercial(
|
||||
broadcasterID, length,
|
||||
[channel{ctx.channel}](auto response) {
|
||||
channel->addMessage(makeSystemMessage(
|
||||
channel->addSystemMessage(
|
||||
QString("Starting %1 second long commercial break. "
|
||||
"Keep in mind you are still "
|
||||
"live and not all viewers will receive a "
|
||||
"commercial. "
|
||||
"You may run another commercial in %2 seconds.")
|
||||
.arg(response.length)
|
||||
.arg(response.retryAfter)));
|
||||
.arg(response.retryAfter));
|
||||
},
|
||||
[channel{ctx.channel}](auto error, auto message) {
|
||||
auto errorMessage = formatStartCommercialError(error, message);
|
||||
channel->addMessage(makeSystemMessage(errorMessage));
|
||||
channel->addSystemMessage(errorMessage);
|
||||
});
|
||||
|
||||
return "";
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include "controllers/accounts/AccountController.hpp"
|
||||
#include "controllers/commands/CommandContext.hpp"
|
||||
#include "controllers/commands/common/ChannelAction.hpp"
|
||||
#include "messages/MessageBuilder.hpp"
|
||||
#include "providers/twitch/api/Helix.hpp"
|
||||
#include "providers/twitch/TwitchAccount.hpp"
|
||||
|
||||
@@ -76,7 +75,7 @@ void unbanUserByID(const ChannelPtr &channel, const QString &channelID,
|
||||
break;
|
||||
}
|
||||
|
||||
channel->addMessage(makeSystemMessage(errorMessage));
|
||||
channel->addSystemMessage(errorMessage);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -96,7 +95,7 @@ QString unbanUser(const CommandContext &ctx)
|
||||
{
|
||||
if (ctx.channel != nullptr)
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(actions.error()));
|
||||
ctx.channel->addSystemMessage(actions.error());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -112,8 +111,8 @@ QString unbanUser(const CommandContext &ctx)
|
||||
auto currentUser = getIApp()->getAccounts()->twitch.getCurrent();
|
||||
if (currentUser->isAnon())
|
||||
{
|
||||
ctx.channel->addMessage(
|
||||
makeSystemMessage("You must be logged in to unban someone!"));
|
||||
ctx.channel->addSystemMessage(
|
||||
"You must be logged in to unban someone!");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -159,16 +158,16 @@ QString unbanUser(const CommandContext &ctx)
|
||||
userLoginsToFetch](const auto &users) mutable {
|
||||
if (!actionChannel.hydrateFrom(users))
|
||||
{
|
||||
channel->addMessage(makeSystemMessage(
|
||||
channel->addSystemMessage(
|
||||
QString("Failed to timeout, bad channel name: %1")
|
||||
.arg(actionChannel.login)));
|
||||
.arg(actionChannel.login));
|
||||
return;
|
||||
}
|
||||
if (!actionTarget.hydrateFrom(users))
|
||||
{
|
||||
channel->addMessage(makeSystemMessage(
|
||||
channel->addSystemMessage(
|
||||
QString("Failed to timeout, bad target name: %1")
|
||||
.arg(actionTarget.login)));
|
||||
.arg(actionTarget.login));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -177,9 +176,9 @@ QString unbanUser(const CommandContext &ctx)
|
||||
actionTarget.displayName);
|
||||
},
|
||||
[channel{ctx.channel}, userLoginsToFetch] {
|
||||
channel->addMessage(makeSystemMessage(
|
||||
channel->addSystemMessage(
|
||||
QString("Failed to timeout, bad username(s): %1")
|
||||
.arg(userLoginsToFetch.join(", "))));
|
||||
.arg(userLoginsToFetch.join(", ")));
|
||||
});
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
#include "controllers/commands/builtin/twitch/UpdateChannel.hpp"
|
||||
|
||||
#include "common/Channel.hpp"
|
||||
#include "common/network/NetworkResult.hpp"
|
||||
#include "controllers/commands/CommandContext.hpp"
|
||||
#include "messages/MessageBuilder.hpp"
|
||||
#include "providers/twitch/api/Helix.hpp"
|
||||
#include "providers/twitch/TwitchChannel.hpp"
|
||||
|
||||
@@ -70,15 +68,14 @@ QString setTitle(const CommandContext &ctx)
|
||||
|
||||
if (ctx.words.size() < 2)
|
||||
{
|
||||
ctx.channel->addMessage(
|
||||
makeSystemMessage("Usage: /settitle <stream title>"));
|
||||
ctx.channel->addSystemMessage("Usage: /settitle <stream title>");
|
||||
return "";
|
||||
}
|
||||
|
||||
if (ctx.twitchChannel == nullptr)
|
||||
{
|
||||
ctx.channel->addMessage(
|
||||
makeSystemMessage("Unable to set title of non-Twitch channel."));
|
||||
ctx.channel->addSystemMessage(
|
||||
"Unable to set title of non-Twitch channel.");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -89,13 +86,13 @@ QString setTitle(const CommandContext &ctx)
|
||||
[channel{ctx.channel}, title](const auto &result) {
|
||||
(void)result;
|
||||
|
||||
channel->addMessage(
|
||||
makeSystemMessage(QString("Updated title to %1").arg(title)));
|
||||
channel->addSystemMessage(
|
||||
QString("Updated title to %1").arg(title));
|
||||
},
|
||||
[channel{ctx.channel}](auto error, auto message) {
|
||||
auto errorMessage =
|
||||
formatUpdateChannelError("title", error, message);
|
||||
channel->addMessage(makeSystemMessage(errorMessage));
|
||||
channel->addSystemMessage(errorMessage);
|
||||
});
|
||||
|
||||
return "";
|
||||
@@ -110,15 +107,14 @@ QString setGame(const CommandContext &ctx)
|
||||
|
||||
if (ctx.words.size() < 2)
|
||||
{
|
||||
ctx.channel->addMessage(
|
||||
makeSystemMessage("Usage: /setgame <stream game>"));
|
||||
ctx.channel->addSystemMessage("Usage: /setgame <stream game>");
|
||||
return "";
|
||||
}
|
||||
|
||||
if (ctx.twitchChannel == nullptr)
|
||||
{
|
||||
ctx.channel->addMessage(
|
||||
makeSystemMessage("Unable to set game of non-Twitch channel."));
|
||||
ctx.channel->addSystemMessage(
|
||||
"Unable to set game of non-Twitch channel.");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -130,7 +126,7 @@ QString setGame(const CommandContext &ctx)
|
||||
gameName](const std::vector<HelixGame> &games) {
|
||||
if (games.empty())
|
||||
{
|
||||
channel->addMessage(makeSystemMessage("Game not found."));
|
||||
channel->addSystemMessage("Game not found.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -154,17 +150,17 @@ QString setGame(const CommandContext &ctx)
|
||||
getHelix()->updateChannel(
|
||||
twitchChannel->roomId(), matchedGame.id, "", "",
|
||||
[channel, games, matchedGame](const NetworkResult &) {
|
||||
channel->addMessage(makeSystemMessage(
|
||||
QString("Updated game to %1").arg(matchedGame.name)));
|
||||
channel->addSystemMessage(
|
||||
QString("Updated game to %1").arg(matchedGame.name));
|
||||
},
|
||||
[channel](auto error, auto message) {
|
||||
auto errorMessage =
|
||||
formatUpdateChannelError("game", error, message);
|
||||
channel->addMessage(makeSystemMessage(errorMessage));
|
||||
channel->addSystemMessage(errorMessage);
|
||||
});
|
||||
},
|
||||
[channel{ctx.channel}] {
|
||||
channel->addMessage(makeSystemMessage("Failed to look up game."));
|
||||
channel->addSystemMessage("Failed to look up game.");
|
||||
});
|
||||
|
||||
return "";
|
||||
|
||||
@@ -21,8 +21,8 @@ QString updateUserColor(const CommandContext &ctx)
|
||||
|
||||
if (!ctx.channel->isTwitchChannel())
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
"The /color command only works in Twitch channels."));
|
||||
ctx.channel->addSystemMessage(
|
||||
"The /color command only works in Twitch channels.");
|
||||
return "";
|
||||
}
|
||||
auto user = getIApp()->getAccounts()->twitch.getCurrent();
|
||||
@@ -30,8 +30,8 @@ QString updateUserColor(const CommandContext &ctx)
|
||||
// Avoid Helix calls without Client ID and/or OAuth Token
|
||||
if (user->isAnon())
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
"You must be logged in to use the /color command."));
|
||||
ctx.channel->addSystemMessage(
|
||||
"You must be logged in to use the /color command.");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -39,11 +39,11 @@ QString updateUserColor(const CommandContext &ctx)
|
||||
|
||||
if (colorString.isEmpty())
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(
|
||||
ctx.channel->addSystemMessage(
|
||||
QString("Usage: /color <color> - Color must be one of Twitch's "
|
||||
"supported colors (%1) or a hex code (#000000) if you "
|
||||
"have Turbo or Prime.")
|
||||
.arg(VALID_HELIX_COLORS.join(", "))));
|
||||
.arg(VALID_HELIX_COLORS.join(", ")));
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ QString updateUserColor(const CommandContext &ctx)
|
||||
[colorString, channel{ctx.channel}] {
|
||||
QString successMessage =
|
||||
QString("Your color has been changed to %1.").arg(colorString);
|
||||
channel->addMessage(makeSystemMessage(successMessage));
|
||||
channel->addSystemMessage(successMessage);
|
||||
},
|
||||
[colorString, channel{ctx.channel}](auto error, auto message) {
|
||||
QString errorMessage =
|
||||
@@ -90,7 +90,7 @@ QString updateUserColor(const CommandContext &ctx)
|
||||
break;
|
||||
}
|
||||
|
||||
channel->addMessage(makeSystemMessage(errorMessage));
|
||||
channel->addSystemMessage(errorMessage);
|
||||
});
|
||||
|
||||
return "";
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
#include "controllers/commands/builtin/twitch/Warn.hpp"
|
||||
|
||||
#include "Application.hpp"
|
||||
#include "common/Channel.hpp"
|
||||
#include "common/QLogging.hpp"
|
||||
#include "controllers/accounts/AccountController.hpp"
|
||||
#include "controllers/commands/CommandContext.hpp"
|
||||
#include "controllers/commands/common/ChannelAction.hpp"
|
||||
#include "messages/MessageBuilder.hpp"
|
||||
#include "providers/twitch/api/Helix.hpp"
|
||||
#include "providers/twitch/TwitchAccount.hpp"
|
||||
#include "providers/twitch/TwitchChannel.hpp"
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -73,7 +72,7 @@ void warnUserByID(const ChannelPtr &channel, const QString &channelID,
|
||||
break;
|
||||
}
|
||||
|
||||
channel->addMessage(makeSystemMessage(errorMessage));
|
||||
channel->addSystemMessage(errorMessage);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -92,7 +91,7 @@ QString sendWarn(const CommandContext &ctx)
|
||||
{
|
||||
if (ctx.channel != nullptr)
|
||||
{
|
||||
ctx.channel->addMessage(makeSystemMessage(actions.error()));
|
||||
ctx.channel->addSystemMessage(actions.error());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -108,8 +107,7 @@ QString sendWarn(const CommandContext &ctx)
|
||||
auto currentUser = getIApp()->getAccounts()->twitch.getCurrent();
|
||||
if (currentUser->isAnon())
|
||||
{
|
||||
ctx.channel->addMessage(
|
||||
makeSystemMessage("You must be logged in to warn someone!"));
|
||||
ctx.channel->addSystemMessage("You must be logged in to warn someone!");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -118,8 +116,8 @@ QString sendWarn(const CommandContext &ctx)
|
||||
const auto &reason = action.reason;
|
||||
if (reason.isEmpty())
|
||||
{
|
||||
ctx.channel->addMessage(
|
||||
makeSystemMessage("Failed to warn, you must specify a reason"));
|
||||
ctx.channel->addSystemMessage(
|
||||
"Failed to warn, you must specify a reason");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -161,16 +159,16 @@ QString sendWarn(const CommandContext &ctx)
|
||||
userLoginsToFetch](const auto &users) mutable {
|
||||
if (!actionChannel.hydrateFrom(users))
|
||||
{
|
||||
channel->addMessage(makeSystemMessage(
|
||||
channel->addSystemMessage(
|
||||
QString("Failed to warn, bad channel name: %1")
|
||||
.arg(actionChannel.login)));
|
||||
.arg(actionChannel.login));
|
||||
return;
|
||||
}
|
||||
if (!actionTarget.hydrateFrom(users))
|
||||
{
|
||||
channel->addMessage(makeSystemMessage(
|
||||
channel->addSystemMessage(
|
||||
QString("Failed to warn, bad target name: %1")
|
||||
.arg(actionTarget.login)));
|
||||
.arg(actionTarget.login));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -179,9 +177,9 @@ QString sendWarn(const CommandContext &ctx)
|
||||
reason, actionTarget.displayName);
|
||||
},
|
||||
[channel{ctx.channel}, userLoginsToFetch] {
|
||||
channel->addMessage(makeSystemMessage(
|
||||
channel->addSystemMessage(
|
||||
QString("Failed to warn, bad username(s): %1")
|
||||
.arg(userLoginsToFetch.join(", "))));
|
||||
.arg(userLoginsToFetch.join(", ")));
|
||||
});
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user