diff --git a/src/singletons/commandmanager.cpp b/src/singletons/commandmanager.cpp index 4d11e65c7..60deb66a5 100644 --- a/src/singletons/commandmanager.cpp +++ b/src/singletons/commandmanager.cpp @@ -1,5 +1,8 @@ #include "singletons/commandmanager.hpp" #include "debug/log.hpp" +#include "messages/messagebuilder.hpp" +#include "providers/twitch/twitchserver.hpp" +#include "singletons/accountmanager.hpp" #include "singletons/pathmanager.hpp" #include @@ -137,6 +140,28 @@ QString CommandManager::execCommand(const QString &text, ChannelPtr channel, boo // channel->addMessage(messages::Message::createSystemMessage(messageText)); return ""; + } else if (commandName == "/w") { + if (words.length() <= 2) { + return ""; + } + + messages::MessageBuilder b; + + b.emplace( + singletons::AccountManager::getInstance().Twitch.getCurrent()->getUserName(), + messages::MessageElement::Text); + b.emplace("->", messages::MessageElement::Text); + b.emplace(words[1], messages::MessageElement::Text); + + QString rest = ""; + + for (int i = 2; i < words.length(); i++) { + rest += words[i]; + } + + b.emplace(rest, messages::MessageElement::Text); + + TwitchServer::getInstance().whispersChannel->addMessage(b.getMessage()); } }