Skip to content

Commit

Permalink
Added /debug-env command (Chatterino#3727)
Browse files Browse the repository at this point in the history
  • Loading branch information
zneix authored May 13, 2022
1 parent 0c6358a commit 5ba3ef7
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/controllers/commands/CommandController.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "CommandController.hpp"

#include "Application.hpp"
#include "common/Env.hpp"
#include "common/SignalVector.hpp"
#include "controllers/accounts/AccountController.hpp"
#include "controllers/commands/Command.hpp"
Expand Down Expand Up @@ -439,6 +440,30 @@ void CommandController::initialize(Settings &, Paths &paths)
return "";
});

this->registerCommand("/debug-env", [](const auto & /*words*/,
ChannelPtr channel) {
auto env = Env::get();

QStringList debugMessages{
"recentMessagesApiUrl: " + env.recentMessagesApiUrl,
"linkResolverUrl: " + env.linkResolverUrl,
"twitchEmoteSetResolverUrl: " + env.twitchEmoteSetResolverUrl,
"twitchServerHost: " + env.twitchServerHost,
"twitchServerPort: " + QString::number(env.twitchServerPort),
"twitchServerSecure: " + QString::number(env.twitchServerSecure),
};

for (QString &str : debugMessages)
{
MessageBuilder builder;
builder.emplace<TimestampElement>(QTime::currentTime());
builder.emplace<TextElement>(str, MessageElementFlag::Text,
MessageColor::System);
channel->addMessage(builder.release());
}
return "";
});

this->registerCommand("/uptime", [](const auto & /*words*/, auto channel) {
auto *twitchChannel = dynamic_cast<TwitchChannel *>(channel.get());
if (twitchChannel == nullptr)
Expand Down

0 comments on commit 5ba3ef7

Please sign in to comment.