diff --git a/src/providers/twitch/TwitchAccount.cpp b/src/providers/twitch/TwitchAccount.cpp index 4bfae4354..c9a691975 100644 --- a/src/providers/twitch/TwitchAccount.cpp +++ b/src/providers/twitch/TwitchAccount.cpp @@ -414,14 +414,47 @@ AccessGuard } // AutoModActions -void TwitchAccount::autoModAllow(const QString msgID, - std::function successCallback) +void TwitchAccount::autoModAllow(const QString msgID) { + QString url("https://api.twitch.tv/kraken/chat/twitchbot/approve"); + + NetworkRequest req(url); + auto qba = (QString("{\"msg_id\":\"") + msgID + "\"}").toUtf8(); + qDebug() << qba; + req.setPayload(qba); + req.setCaller(QThread::currentThread()); + req.makeAuthorizedV5(this->getOAuthClient(), this->getOAuthToken()); + + req.onError([=](int errorCode) { + qDebug() << "you just got an error 4HEad" << errorCode; + return true; + }); + + req.onReplyCreated([=](QNetworkReply *reply) -> void { + // + // + return; + }); + + req.execute(); } -void TwitchAccount::autoModDeny(const QString msgID, - std::function successCallback) +void TwitchAccount::autoModDeny(const QString msgID) { + QString url("https://api.twitch.tv/kraken/chat/twitchbot/deny"); + + NetworkRequest req(url); + auto qba = (QString("{\"msg_id\":\"") + msgID + "\"}").toUtf8(); + qDebug() << qba; + req.setPayload(qba); + req.setCaller(QThread::currentThread()); + req.makeAuthorizedV5(this->getOAuthClient(), this->getOAuthToken()); + + req.onError([=](int errorCode) { + qDebug() << "you just got an error 4HEad" << errorCode; + return true; + }); + req.execute(); } void TwitchAccount::parseEmotes(const rapidjson::Document &root) diff --git a/src/providers/twitch/TwitchAccount.hpp b/src/providers/twitch/TwitchAccount.hpp index bc53e0b24..e5db1749d 100644 --- a/src/providers/twitch/TwitchAccount.hpp +++ b/src/providers/twitch/TwitchAccount.hpp @@ -109,10 +109,8 @@ public: AccessGuard accessEmotes() const; // Automod actions - void autoModAllow(const QString msgID, - std::function successCallback); - void autoModDeny(const QString msgID, - std::function successCallback); + void autoModAllow(const QString msgID); + void autoModDeny(const QString msgID); private: void parseEmotes(const rapidjson::Document &document); diff --git a/src/widgets/helper/ChannelView.cpp b/src/widgets/helper/ChannelView.cpp index 135c9cc44..1f4aa2d88 100644 --- a/src/widgets/helper/ChannelView.cpp +++ b/src/widgets/helper/ChannelView.cpp @@ -2,6 +2,7 @@ #include "Application.hpp" #include "common/Common.hpp" +#include "controllers/accounts/AccountController.hpp" #include "debug/Benchmark.hpp" #include "debug/Log.hpp" #include "messages/Emote.hpp" @@ -1673,9 +1674,11 @@ void ChannelView::handleLinkClick(QMouseEvent *event, const Link &link, case Link::AutoModAllow: { + getApp()->accounts->twitch.getCurrent()->autoModAllow(link.value); } case Link::AutoModDeny: { + getApp()->accounts->twitch.getCurrent()->autoModDeny(link.value); } default:;