Added /chatters command (#2344)
This commit is contained in:
@@ -434,6 +434,24 @@ void CommandController::initialize(Settings &, Paths &paths)
|
||||
userPopup->show();
|
||||
return "";
|
||||
});
|
||||
|
||||
this->registerCommand(
|
||||
"/chatters", [](const auto & /*words*/, auto channel) {
|
||||
auto twitchChannel = dynamic_cast<TwitchChannel *>(channel.get());
|
||||
|
||||
if (twitchChannel == nullptr)
|
||||
{
|
||||
channel->addMessage(makeSystemMessage(
|
||||
"The /chatters command only works in Twitch Channels"));
|
||||
return "";
|
||||
}
|
||||
|
||||
channel->addMessage(makeSystemMessage(
|
||||
QString("Chatter count: %1")
|
||||
.arg(QString::number(twitchChannel->chatterCount()))));
|
||||
|
||||
return "";
|
||||
});
|
||||
}
|
||||
|
||||
void CommandController::save()
|
||||
@@ -517,7 +535,7 @@ QString CommandController::execCommand(const QString &textNoEmoji,
|
||||
void CommandController::registerCommand(QString commandName,
|
||||
CommandFunction commandFunction)
|
||||
{
|
||||
assert(this->commands_.contains(commandName) == false);
|
||||
assert(!this->commands_.contains(commandName));
|
||||
|
||||
this->commands_[commandName] = commandFunction;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user