Skip to content

Commit

Permalink
perf: 使用uin
Browse files Browse the repository at this point in the history
  • Loading branch information
msojocs committed Oct 6, 2024
1 parent 454cc36 commit c39789a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/onebot/actions/friend/friend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const getFriendList = async (p: {}): Promise<any> => {
name: e.categroyName,
count: e.categroyMbCount,
friend_list: e.buddyList.map(f => ({
uin: f.uin,
uin: parseInt(f.uin),
nick: f.nick,
avatar_url: f.avatarUrl,
remark: f.remark,
Expand Down Expand Up @@ -69,6 +69,7 @@ const getUserInfo = async (p: UserInfoReq): Promise<UserInfoResp> => {
export const initFriend = () => {
// 注册获取好友列表
registerActionHandle('get_friend_list', getFriendList)
registerActionHandle('get_friend_list_with_group', getFriendList)
registerActionHandle('send_like_friend', sendLikeFriend)
registerActionHandle('get_user_info', getUserInfo)
}
2 changes: 1 addition & 1 deletion src/onebot/actions/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface BotActionRequest<T = any> {
*/
id: string
user: {
qid: `${number}`
uin: `${number}`
}
/**
* 动作名称
Expand Down
2 changes: 1 addition & 1 deletion src/onebot/common/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useNTCore } from "../../ntqq/core/core"
import { useNTUserStore } from "../../ntqq/store/user"
import { useLogger } from "../../common/log"

const { registerEventListener, removeEventListener } = useStore()
const { registerEventListener } = useStore()
const log = useLogger('Common/User')

export const getUserInfoByUid = (uid: `u_${string}`): Promise<UserDetailInfoType> => {
Expand Down
4 changes: 2 additions & 2 deletions src/server/websocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ export const startWebsocketServer = () => {
ws.send(JSON.stringify(ret));
return
}
log.info('id:', msg.user.qid)
asyncStore.getStore()?.set('id', msg.user.qid)
log.info('uin:', msg.user.uin)
asyncStore.getStore()?.set('id', msg.user.uin)
const { getUserInfo } = useNTUserStore()
let u = getUserInfo()
if (!u) {
Expand Down

0 comments on commit c39789a

Please sign in to comment.