diff options
author | George Hazan <george.hazan@gmail.com> | 2024-05-06 16:39:53 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2024-05-06 16:39:53 +0300 |
commit | e3b1e2a24f8e2be58f88ffa86e9d0f6ba32bf5cb (patch) | |
tree | 7b14822b18063b175112f5c347decd4c1ffbfad6 /protocols/Discord | |
parent | be2aa995bbff6e82a9f5a465490a6e0037c28484 (diff) |
fixes #4399 completely
Diffstat (limited to 'protocols/Discord')
-rw-r--r-- | protocols/Discord/src/dispatch.cpp | 17 | ||||
-rw-r--r-- | protocols/Discord/src/groupchat.cpp | 2 |
2 files changed, 12 insertions, 7 deletions
diff --git a/protocols/Discord/src/dispatch.cpp b/protocols/Discord/src/dispatch.cpp index 3691836d98..01e976be2b 100644 --- a/protocols/Discord/src/dispatch.cpp +++ b/protocols/Discord/src/dispatch.cpp @@ -473,8 +473,11 @@ void CDiscordProto::OnCommandMessage(const JSONNode &pRoot, bool bIsNew) }
else {
CMStringW wszText = PrepareMessageText(pRoot), wszMentioned;
+ SnowFlake mentionId = 0;
+
for (auto &it : pRoot["mentions"]) {
wszMentioned = getName(it);
+ mentionId = _wtoi64(it["id"].as_mstring());
break;
}
@@ -485,15 +488,17 @@ void CDiscordProto::OnCommandMessage(const JSONNode &pRoot, bool bIsNew) return;
case 1: // user was added to chat
- wszText.Format(TranslateT("%s added %s to the group"), getName(pRoot["author"]).c_str(), wszMentioned.c_str());
+ if (mentionId != userId)
+ wszText.Format(TranslateT("%s added %s to the group"), getName(pRoot["author"]).c_str(), wszMentioned.c_str());
+ else
+ wszText.Format(TranslateT("%s joined the group"), wszMentioned.c_str());
break;
case 2: // user was removed from chat
- wszText.Format(TranslateT("%s removed %s from the group"), getName(pRoot["author"]).c_str(), wszMentioned.c_str());
- break;
-
- case 3: // user left chat
- wszText.Format(TranslateT("%s left group"), wszMentioned.c_str());
+ if (mentionId != userId)
+ wszText.Format(TranslateT("%s removed %s from the group"), getName(pRoot["author"]).c_str(), wszMentioned.c_str());
+ else
+ wszText.Format(TranslateT("%s left the group"), wszMentioned.c_str());
break;
}
diff --git a/protocols/Discord/src/groupchat.cpp b/protocols/Discord/src/groupchat.cpp index 81543fa174..b65bc0dffd 100644 --- a/protocols/Discord/src/groupchat.cpp +++ b/protocols/Discord/src/groupchat.cpp @@ -210,7 +210,7 @@ public: void CDiscordProto::LeaveChat(CDiscordUser *pChat)
{
- CMStringA szUrl(FORMAT, "/channels/%S", pChat->wszUsername.c_str());
+ CMStringA szUrl(FORMAT, "/channels/%S?silent=false", pChat->wszUsername.c_str());
Push(new AsyncHttpRequest(this, REQUEST_DELETE, szUrl, nullptr));
}
|