Skip to content
This repository was archived by the owner on Aug 16, 2024. It is now read-only.
This repository was archived by the owner on Aug 16, 2024. It is now read-only.

GetGroupMemberInfo未处理查找失败返回 #51

@zmdyy0318

Description

@zmdyy0318

改函数方法里,当http回复
"{"code":5,"msg":"指定对象不存在"}"
时,未捕获code值,直接使用json获取name
该函数代码如下
GroupMemberInfo MiraiBot::GetGroupMemberInfo(GID_t gid, QQ_t memberId)
{

stringstream api_url;
api_url
	<< "/memberInfo?sessionKey="
	<< sessionKey_
	<< "&target="
	<< int64_t(gid)
	<< "&memberId="
<< int64_t(memberId);
	auto res = http_client_.Get(api_url.str().data());
if (!res)
	throw std::runtime_error("网络错误");
if (res->status != 200)
	throw std::runtime_error("[mirai-api-http error]: " + res->body);
json re_json = json::parse(res->body);
GroupMemberInfo result;
result.Set(re_json);
return result;

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions