smol commit

This commit is contained in:
apa420 2019-01-20 16:07:31 +01:00
parent 7aa798f924
commit cc5528ec18
3 changed files with 42 additions and 8 deletions

View file

@ -414,14 +414,47 @@ AccessGuard<const TwitchAccount::TwitchAccountEmoteData>
} }
// AutoModActions // AutoModActions
void TwitchAccount::autoModAllow(const QString msgID, void TwitchAccount::autoModAllow(const QString msgID)
std::function<void()> successCallback)
{ {
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, void TwitchAccount::autoModDeny(const QString msgID)
std::function<void()> successCallback)
{ {
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) void TwitchAccount::parseEmotes(const rapidjson::Document &root)

View file

@ -109,10 +109,8 @@ public:
AccessGuard<const TwitchAccountEmoteData> accessEmotes() const; AccessGuard<const TwitchAccountEmoteData> accessEmotes() const;
// Automod actions // Automod actions
void autoModAllow(const QString msgID, void autoModAllow(const QString msgID);
std::function<void()> successCallback); void autoModDeny(const QString msgID);
void autoModDeny(const QString msgID,
std::function<void()> successCallback);
private: private:
void parseEmotes(const rapidjson::Document &document); void parseEmotes(const rapidjson::Document &document);

View file

@ -2,6 +2,7 @@
#include "Application.hpp" #include "Application.hpp"
#include "common/Common.hpp" #include "common/Common.hpp"
#include "controllers/accounts/AccountController.hpp"
#include "debug/Benchmark.hpp" #include "debug/Benchmark.hpp"
#include "debug/Log.hpp" #include "debug/Log.hpp"
#include "messages/Emote.hpp" #include "messages/Emote.hpp"
@ -1673,9 +1674,11 @@ void ChannelView::handleLinkClick(QMouseEvent *event, const Link &link,
case Link::AutoModAllow: case Link::AutoModAllow:
{ {
getApp()->accounts->twitch.getCurrent()->autoModAllow(link.value);
} }
case Link::AutoModDeny: case Link::AutoModDeny:
{ {
getApp()->accounts->twitch.getCurrent()->autoModDeny(link.value);
} }
default:; default:;