Added /debug-env command (#3727)

This commit is contained in:
Kasia 2022-05-13 21:59:03 +02:00 committed by GitHub
parent 0c6358a2af
commit 5ba3ef721f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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"
@ -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)