refactor: Move all commands to their own files (#4946)
This commit is contained in:
@@ -1,11 +1,16 @@
|
||||
#include "controllers/commands/builtin/chatterino/Debugging.hpp"
|
||||
|
||||
#include "common/Channel.hpp"
|
||||
#include "common/Env.hpp"
|
||||
#include "common/Literals.hpp"
|
||||
#include "controllers/commands/CommandContext.hpp"
|
||||
#include "messages/Image.hpp"
|
||||
#include "messages/MessageBuilder.hpp"
|
||||
#include "messages/MessageElement.hpp"
|
||||
#include "singletons/Theme.hpp"
|
||||
#include "util/PostToThread.hpp"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QLoggingCategory>
|
||||
#include <QString>
|
||||
|
||||
@@ -63,4 +68,70 @@ QString toggleThemeReload(const CommandContext &ctx)
|
||||
return {};
|
||||
}
|
||||
|
||||
QString listEnvironmentVariables(const CommandContext &ctx)
|
||||
{
|
||||
const auto &channel = ctx.channel;
|
||||
if (channel == nullptr)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
auto env = Env::get();
|
||||
|
||||
QStringList debugMessages{
|
||||
"recentMessagesApiUrl: " + env.recentMessagesApiUrl,
|
||||
"linkResolverUrl: " + env.linkResolverUrl,
|
||||
"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 "";
|
||||
}
|
||||
|
||||
QString listArgs(const CommandContext &ctx)
|
||||
{
|
||||
const auto &channel = ctx.channel;
|
||||
if (channel == nullptr)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
QString msg = QApplication::instance()->arguments().join(' ');
|
||||
|
||||
channel->addMessage(makeSystemMessage(msg));
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
QString forceImageGarbageCollection(const CommandContext &ctx)
|
||||
{
|
||||
(void)ctx;
|
||||
|
||||
runInGuiThread([] {
|
||||
auto &iep = ImageExpirationPool::instance();
|
||||
iep.freeOld();
|
||||
});
|
||||
return "";
|
||||
}
|
||||
|
||||
QString forceImageUnload(const CommandContext &ctx)
|
||||
{
|
||||
(void)ctx;
|
||||
|
||||
runInGuiThread([] {
|
||||
auto &iep = ImageExpirationPool::instance();
|
||||
iep.freeAll();
|
||||
});
|
||||
return "";
|
||||
}
|
||||
|
||||
} // namespace chatterino::commands
|
||||
|
||||
Reference in New Issue
Block a user