diff --git a/src/controllers/commands/CommandController.cpp b/src/controllers/commands/CommandController.cpp index fa8119037..f86506493 100644 --- a/src/controllers/commands/CommandController.cpp +++ b/src/controllers/commands/CommandController.cpp @@ -10,6 +10,7 @@ #include "providers/twitch/TwitchServer.hpp" #include "singletons/Paths.hpp" #include "singletons/Settings.hpp" +#include "widgets/dialogs/LogsPopup.hpp" #include #include @@ -197,6 +198,39 @@ QString CommandController::execCommand(const QString &text, ChannelPtr channel, channel->addMessage(Message::createSystemMessage(message)); }); + return ""; + } else if (commandName == "/logs") { + if (words.size() < 2) { + channel->addMessage( + Message::createSystemMessage("Usage: /logs [user] (channel)")); + return ""; + } + auto app = getApp(); + + auto logs = new LogsPopup(); + QString target; + + if (words.at(1).at(0) == "@") { + target = words.at(1).mid(1); + } else { + target = words.at(1); + } + + if (words.size() == 3) { + QString channelName = words.at(2); + if (words.at(2).at(0) == "#") { + channelName = words.at(2).mid(1); + } + auto logsChannel = app->twitch.server->getChannelOrEmpty(channelName); + if (logsChannel == nullptr) { + } else { + logs->setInfo(logsChannel, target); + } + } else { + logs->setInfo(channel, target); + } + logs->setAttribute(Qt::WA_DeleteOnClose); + logs->show(); return ""; } }