Added /chatters command (#2344)
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
- Major: Added "Channel Filters". See https://wiki.chatterino.com/Filters/ for how they work or how to configure them. (#1748, #2083, #2090, #2200)
|
- Major: Added "Channel Filters". See https://wiki.chatterino.com/Filters/ for how they work or how to configure them. (#1748, #2083, #2090, #2200)
|
||||||
- Major: Added Streamer Mode configuration (under `Settings -> General`), where you can select which features of Chatterino should behave differently when you are in Streamer Mode. (#2001, #2316, #2342)
|
- Major: Added Streamer Mode configuration (under `Settings -> General`), where you can select which features of Chatterino should behave differently when you are in Streamer Mode. (#2001, #2316, #2342)
|
||||||
- Major: Color mentions to match the mentioned users. You can disable this by unchecking "Color @usernames" under `Settings -> General -> Advanced (misc.)`. (#1963, #2284)
|
- Major: Color mentions to match the mentioned users. You can disable this by unchecking "Color @usernames" under `Settings -> General -> Advanced (misc.)`. (#1963, #2284)
|
||||||
|
- Minor: Added `/chatters` command showing chatter count. (#2344)
|
||||||
- Minor: Added a button to the split context menu to open the moderation view for a channel when the account selected has moderator permissions. (#2321)
|
- Minor: Added a button to the split context menu to open the moderation view for a channel when the account selected has moderator permissions. (#2321)
|
||||||
- Minor: Made BetterTTV emote tooltips use authors' display name. (#2267)
|
- Minor: Made BetterTTV emote tooltips use authors' display name. (#2267)
|
||||||
- Minor: Added Ctrl + 1/2/3/... and Ctrl+9 shortcuts to Emote Popup (activated with Ctrl+E). They work exactly the same as shortcuts in main window. (#2263)
|
- Minor: Added Ctrl + 1/2/3/... and Ctrl+9 shortcuts to Emote Popup (activated with Ctrl+E). They work exactly the same as shortcuts in main window. (#2263)
|
||||||
|
|||||||
@@ -434,6 +434,24 @@ void CommandController::initialize(Settings &, Paths &paths)
|
|||||||
userPopup->show();
|
userPopup->show();
|
||||||
return "";
|
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()
|
void CommandController::save()
|
||||||
@@ -517,7 +535,7 @@ QString CommandController::execCommand(const QString &textNoEmoji,
|
|||||||
void CommandController::registerCommand(QString commandName,
|
void CommandController::registerCommand(QString commandName,
|
||||||
CommandFunction commandFunction)
|
CommandFunction commandFunction)
|
||||||
{
|
{
|
||||||
assert(this->commands_.contains(commandName) == false);
|
assert(!this->commands_.contains(commandName));
|
||||||
|
|
||||||
this->commands_[commandName] = commandFunction;
|
this->commands_[commandName] = commandFunction;
|
||||||
|
|
||||||
|
|||||||
@@ -528,6 +528,11 @@ const QString &TwitchChannel::popoutPlayerUrl()
|
|||||||
return this->popoutPlayerUrl_;
|
return this->popoutPlayerUrl_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int TwitchChannel::chatterCount()
|
||||||
|
{
|
||||||
|
return this->chatterCount_;
|
||||||
|
}
|
||||||
|
|
||||||
void TwitchChannel::setLive(bool newLiveStatus)
|
void TwitchChannel::setLive(bool newLiveStatus)
|
||||||
{
|
{
|
||||||
bool gotNewLiveStatus = false;
|
bool gotNewLiveStatus = false;
|
||||||
@@ -770,9 +775,14 @@ void TwitchChannel::refreshChatters()
|
|||||||
// channel still exists?
|
// channel still exists?
|
||||||
auto shared = weak.lock();
|
auto shared = weak.lock();
|
||||||
if (!shared)
|
if (!shared)
|
||||||
|
{
|
||||||
return Failure;
|
return Failure;
|
||||||
|
}
|
||||||
|
|
||||||
auto pair = parseChatters(result.parseJson());
|
auto data = result.parseJson();
|
||||||
|
this->chatterCount_ = data.value("chatter_count").toInt();
|
||||||
|
|
||||||
|
auto pair = parseChatters(std::move(data));
|
||||||
if (pair.first)
|
if (pair.first)
|
||||||
{
|
{
|
||||||
this->setChatters(std::move(pair.second));
|
this->setChatters(std::move(pair.second));
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ public:
|
|||||||
const QString &subscriptionUrl();
|
const QString &subscriptionUrl();
|
||||||
const QString &channelUrl();
|
const QString &channelUrl();
|
||||||
const QString &popoutPlayerUrl();
|
const QString &popoutPlayerUrl();
|
||||||
|
int chatterCount();
|
||||||
virtual bool isLive() const override;
|
virtual bool isLive() const override;
|
||||||
QString roomId() const;
|
QString roomId() const;
|
||||||
AccessGuard<const RoomModes> accessRoomModes() const;
|
AccessGuard<const RoomModes> accessRoomModes() const;
|
||||||
@@ -155,6 +156,7 @@ private:
|
|||||||
const QString subscriptionUrl_;
|
const QString subscriptionUrl_;
|
||||||
const QString channelUrl_;
|
const QString channelUrl_;
|
||||||
const QString popoutPlayerUrl_;
|
const QString popoutPlayerUrl_;
|
||||||
|
int chatterCount_;
|
||||||
UniqueAccess<StreamStatus> streamStatus_;
|
UniqueAccess<StreamStatus> streamStatus_;
|
||||||
UniqueAccess<RoomModes> roomModes_;
|
UniqueAccess<RoomModes> roomModes_;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user