This repository has been archived by the owner on Dec 31, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27
提供一个获取群名片/昵称的函数 #13
Comments
auto get_private_display_nickname(const cq::MessageEvent &msg) -> string {
try {
auto stranger_info = cq::get_stranger_info(msg.user_id);
return stranger_info.nickname;
} catch (cq::ApiError &e) {}
return std::to_string(msg.user_id);
}
auto get_display_nickname(const cq::GroupMessageEvent &msg) -> string {
try {
auto member_info = cq::get_group_member_info(msg.group_id, msg.user_id);
if (!member_info.card.empty()) {
return member_info.card;
} else {
return member_info.nickname;
}
} catch (cq::ApiError &e) {}
return get_private_display_nickname(msg);
}
auto get_display_nickname(const cq::MessageEvent &msg) -> string {
return get_private_display_nickname(msg);
} 我觉得我可能写错了 |
@t532 光速实现,爱了。 |
这个API有问题,当修改群名片后它依旧显示未修改前的名片。 |
@QiJieH 不使用缓存的情况下请求是直接发给QQ的服务器的,在速度上肯定会差一点,用得多了还会引起风控。 如非必要尽量保持 cache 就好。 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The text was updated successfully, but these errors were encountered: