mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
smol commit
This commit is contained in:
parent
7aa798f924
commit
cc5528ec18
|
@ -414,14 +414,47 @@ AccessGuard<const TwitchAccount::TwitchAccountEmoteData>
|
|||
}
|
||||
|
||||
// AutoModActions
|
||||
void TwitchAccount::autoModAllow(const QString msgID,
|
||||
std::function<void()> 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<void()> 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)
|
||||
|
|
|
@ -109,10 +109,8 @@ public:
|
|||
AccessGuard<const TwitchAccountEmoteData> accessEmotes() const;
|
||||
|
||||
// Automod actions
|
||||
void autoModAllow(const QString msgID,
|
||||
std::function<void()> successCallback);
|
||||
void autoModDeny(const QString msgID,
|
||||
std::function<void()> successCallback);
|
||||
void autoModAllow(const QString msgID);
|
||||
void autoModDeny(const QString msgID);
|
||||
|
||||
private:
|
||||
void parseEmotes(const rapidjson::Document &document);
|
||||
|
|
|
@ -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:;
|
||||
|
|
Loading…
Reference in a new issue