Add user lookup
This commit is contained in:
parent
f8c328ff55
commit
996663d449
|
@ -2355,6 +2355,39 @@ export default class Misskey implements MegalodonInterface {
|
||||||
limit: 20
|
limit: 20
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const match = q.match(/^@(?<user>.*?)(?:@(?<host>.*?)|)$/);
|
||||||
|
if (match) {
|
||||||
|
const lookupQuery = {
|
||||||
|
username: match.groups?.user,
|
||||||
|
host: match.groups?.host
|
||||||
|
};
|
||||||
|
|
||||||
|
const result = await this.client.post<MisskeyAPI.Entity.UserDetail>('/api/users/show', lookupQuery).then(res => ({
|
||||||
|
...res,
|
||||||
|
data: {
|
||||||
|
accounts: [this.converter.userDetail(res.data, this.baseUrlToHost(this.baseUrl))],
|
||||||
|
statuses: [],
|
||||||
|
hashtags: []
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
if (result.status !== 200) {
|
||||||
|
result.status = 200;
|
||||||
|
result.statusText = "OK";
|
||||||
|
result.data = {
|
||||||
|
accounts: [],
|
||||||
|
statuses: [],
|
||||||
|
hashtags: []
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {}
|
||||||
|
|
||||||
return this.client.post<Array<MisskeyAPI.Entity.UserDetail>>('/api/users/search', params).then(res => ({
|
return this.client.post<Array<MisskeyAPI.Entity.UserDetail>>('/api/users/search', params).then(res => ({
|
||||||
...res,
|
...res,
|
||||||
data: {
|
data: {
|
||||||
|
|
Loading…
Reference in a new issue