From e5a9b6557d1514538aa9bbc29102d5eceb901c9f Mon Sep 17 00:00:00 2001 From: jackb-p Date: Tue, 22 Nov 2016 23:27:37 +0000 Subject: [PATCH] Add TrueName attribute to users, ignores nickname --- Toast/bot/js/V8Instance.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Toast/bot/js/V8Instance.cpp b/Toast/bot/js/V8Instance.cpp index 6769c31..d75227f 100644 --- a/Toast/bot/js/V8Instance.cpp +++ b/Toast/bot/js/V8Instance.cpp @@ -368,6 +368,10 @@ void V8Instance::js_get_user(Local property, const PropertyCallbackInfonick == "null" ? member->user->username : member->nick; info.GetReturnValue().Set(String::NewFromUtf8(info.GetIsolate(), name.c_str(), NewStringType::kNormal).ToLocalChecked()); } + else if (property_s == "TrueName") { // ignores nick + std::string name = member->user->username; + info.GetReturnValue().Set(String::NewFromUtf8(info.GetIsolate(), name.c_str(), NewStringType::kNormal).ToLocalChecked()); + } else if (property_s == "Mention") { std::string mention = "<@" + member->user->id + ">"; info.GetReturnValue().Set(String::NewFromUtf8(info.GetIsolate(), mention.c_str(), NewStringType::kNormal).ToLocalChecked());