mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
smol commit, idk if I will continue this
This commit is contained in:
parent
e9bd9ddb8e
commit
cd5c373e01
4 changed files with 28 additions and 14 deletions
|
@ -117,4 +117,12 @@ struct AutomodAction : PubSubAction {
|
|||
QString msgID;
|
||||
};
|
||||
|
||||
struct AutomodUserAction : PubSubAction {
|
||||
using PubSubAction::PubSubAction;
|
||||
|
||||
ActionUser target;
|
||||
|
||||
QString message;
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
|
|
|
@ -577,40 +577,50 @@ PubSub::PubSub()
|
|||
this->moderationActionHandlers["denied_automod_message"] =
|
||||
[this](const auto &data, const auto &roomID) {
|
||||
// This message got denied by a moderator
|
||||
AutomodUserAction action(data, roomID);
|
||||
|
||||
getCreatedByUser(data, action.source);
|
||||
qDebug() << "test2222";
|
||||
qDebug() << QString::fromStdString(rj::stringify(data));
|
||||
};
|
||||
|
||||
this->moderationActionHandlers["add_blocked_term"] =
|
||||
[this](const auto &data, const auto &roomID) {
|
||||
// A term has been added
|
||||
qDebug() << "test3333";
|
||||
qDebug() << QString::fromStdString(rj::stringify(data));
|
||||
};
|
||||
|
||||
this->moderationActionHandlers["approved_automod_message"] =
|
||||
[this](const auto &data, const auto &roomID) {
|
||||
// This message got approved by a moderator
|
||||
qDebug() << "test5555";
|
||||
qDebug() << QString::fromStdString(rj::stringify(data));
|
||||
};
|
||||
|
||||
this->moderationActionHandlers["add_permitted_term"] =
|
||||
[this](const auto &data, const auto &roomID) {
|
||||
// This term got a pass through automod
|
||||
qDebug() << "test6666";
|
||||
qDebug() << QString::fromStdString(rj::stringify(data));
|
||||
};
|
||||
this->moderationActionHandlers["modified_automod_properties"] =
|
||||
[this](const auto &data, const auto &roomID) {
|
||||
// The automod settings got modified
|
||||
qDebug() << "test4444";
|
||||
qDebug() << QString::fromStdString(rj::stringify(data));
|
||||
};
|
||||
this->moderationActionHandlers["delete_blocked_term"] =
|
||||
[this](const auto &data, const auto &roomID) {
|
||||
// This term got deleted
|
||||
qDebug() << "test7777";
|
||||
qDebug() << QString::fromStdString(rj::stringify(data));
|
||||
};
|
||||
this->moderationActionHandlers["delete_permitted_term"] =
|
||||
[this](const auto &data, const auto &roomID) {
|
||||
// This term got deleted
|
||||
qDebug() << "test8888";
|
||||
qDebug() << QString::fromStdString(rj::stringify(data));
|
||||
};
|
||||
this->websocketClient.set_access_channels(websocketpp::log::alevel::all);
|
||||
this->websocketClient.clear_access_channels(
|
||||
|
|
|
@ -114,6 +114,7 @@ public:
|
|||
Signal<UnbanAction> userUnbanned;
|
||||
|
||||
Signal<AutomodAction> automodMessage;
|
||||
Signal<AutomodUserAction> automodUserMessage;
|
||||
} moderation;
|
||||
|
||||
struct {
|
||||
|
|
|
@ -419,28 +419,21 @@ void TwitchAccount::autoModAllow(const QString msgID)
|
|||
QString url("https://api.twitch.tv/kraken/chat/twitchbot/approve");
|
||||
|
||||
NetworkRequest req(url, NetworkRequestType::Post);
|
||||
req.setRawHeader("Content-type", "application/json");
|
||||
/*req.setRawHeader curl - i - H 'Client-ID: abcd' -
|
||||
H 'Accept: application/vnd.twitchtv.v5+json' -
|
||||
H 'Authorization: OAuth efgh' -
|
||||
H "Content-type: application/json" --data '{"msg_id":"msgid"}';*/
|
||||
req.setRawHeader("Content-Type", "application/json");
|
||||
|
||||
auto qba = (QString("{\"msg_id\":\"") + msgID + "\"}").toUtf8();
|
||||
qDebug() << qba;
|
||||
|
||||
req.setRawHeader("Content-Length", QByteArray::number(qba.size()));
|
||||
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;
|
||||
log("[TwitchAccounts::autoModAllow] Error {}", errorCode);
|
||||
return true;
|
||||
});
|
||||
|
||||
req.onReplyCreated([=](QNetworkReply *reply) -> void {
|
||||
//
|
||||
//
|
||||
return;
|
||||
});
|
||||
|
||||
req.execute();
|
||||
}
|
||||
|
||||
|
@ -449,15 +442,17 @@ void TwitchAccount::autoModDeny(const QString msgID)
|
|||
QString url("https://api.twitch.tv/kraken/chat/twitchbot/deny");
|
||||
|
||||
NetworkRequest req(url, NetworkRequestType::Post);
|
||||
req.setRawHeader("Content-type", "application/json");
|
||||
req.setRawHeader("Content-Type", "application/json");
|
||||
auto qba = (QString("{\"msg_id\":\"") + msgID + "\"}").toUtf8();
|
||||
qDebug() << qba;
|
||||
|
||||
req.setRawHeader("Content-Length", QByteArray::number(qba.size()));
|
||||
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;
|
||||
log("[TwitchAccounts::autoModDeny] Error {}", errorCode);
|
||||
return true;
|
||||
});
|
||||
req.execute();
|
||||
|
|
Loading…
Reference in a new issue