mirror of
https://github.com/chrononeko/chronocat.git
synced 2024-11-25 09:37:35 +00:00
feat(api): implement chronocat.internal.uix.uin.get
This commit is contained in:
parent
c3b9a4b82b
commit
92133ce831
29
packages/engine-chronocat-api/src/api/internal/uix.ts
Normal file
29
packages/engine-chronocat-api/src/api/internal/uix.ts
Normal file
@ -0,0 +1,29 @@
|
||||
import type { ChronocatContext } from '@chronocat/shell'
|
||||
import { getMemberInfo } from '../../definitions/groupService'
|
||||
import { getUserDetailInfoWithBizInfo } from '../../definitions/profileService'
|
||||
|
||||
export const buildGetUin = (ctx: ChronocatContext) => async (uid: string) => {
|
||||
await getUserDetailInfoWithBizInfo({
|
||||
uid,
|
||||
keys: [0],
|
||||
})
|
||||
|
||||
return new Promise<string>((res, rej) => {
|
||||
ctx.chronocat.uix.once(uid, res)
|
||||
void ctx.chronocat.sleep(5000).then(rej)
|
||||
})
|
||||
}
|
||||
|
||||
export const buildGetUinWithGroup =
|
||||
(ctx: ChronocatContext) => async (uid: string, group: string) => {
|
||||
await getMemberInfo({
|
||||
forceUpdate: true,
|
||||
groupCode: group,
|
||||
uids: [uid],
|
||||
})
|
||||
|
||||
return new Promise<string>((res, rej) => {
|
||||
ctx.chronocat.uix.once(uid, res)
|
||||
void ctx.chronocat.sleep(5000).then(rej)
|
||||
})
|
||||
}
|
@ -8,7 +8,7 @@ export const getMemberInfo = define<
|
||||
[
|
||||
{
|
||||
forceUpdate: boolean
|
||||
groupCode: number
|
||||
groupCode: string
|
||||
uids: string[]
|
||||
},
|
||||
]
|
||||
|
@ -18,6 +18,7 @@ import { buildGuildMemberMute } from './api/guild/member/mute'
|
||||
import { buildGuildRemove } from './api/guild/remove'
|
||||
import { buildAssetsGet } from './api/internal/assets/get'
|
||||
import { qfaceGet, qfaceList } from './api/internal/qface'
|
||||
import { buildGetUin, buildGetUinWithGroup } from './api/internal/uix'
|
||||
import { buildLoginGet } from './api/login/get'
|
||||
import { buildMessageCreate } from './api/message/create'
|
||||
import { buildMessageDelete } from './api/message/delete'
|
||||
@ -72,6 +73,9 @@ export const apply = async (ctx: ChronocatContext) => {
|
||||
register('friend.approve', buildFriendApprove(ctx))
|
||||
register('unsafe.friend.remove', buildFriendRemove(ctx))
|
||||
|
||||
register('chronocat.internal.uix.uin.get', buildGetUin(ctx))
|
||||
register('chronocat.internal.uix.uin.get.group', buildGetUinWithGroup(ctx))
|
||||
|
||||
await ctx.chronocat.whenReady()
|
||||
|
||||
register('chronocat.internal.qface.get', qfaceGet)
|
||||
|
Loading…
Reference in New Issue
Block a user