mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
feat: support for sending contact
message segment
This commit is contained in:
parent
cad09b2ed1
commit
536999f296
@ -41,7 +41,7 @@
|
||||
"electron-vite": "^2.3.0",
|
||||
"protobufjs-cli": "^1.1.3",
|
||||
"typescript": "^5.6.2",
|
||||
"vite": "^5.4.4",
|
||||
"vite": "^5.4.5",
|
||||
"vite-plugin-cp": "^4.0.8"
|
||||
},
|
||||
"packageManager": "yarn@4.4.1"
|
||||
|
@ -189,4 +189,9 @@ export class NTQQFriendApi extends Service {
|
||||
return await invoke('nodeIKernelBuddyService/isBuddy', [{ uid }, null])
|
||||
}
|
||||
}
|
||||
|
||||
async getBuddyRecommendContact(uin: string) {
|
||||
const ret = await invoke('nodeIKernelBuddyService/getBuddyRecommendContactArkJson', [{ uin }, null])
|
||||
return ret.arkMsg
|
||||
}
|
||||
}
|
||||
|
@ -300,4 +300,9 @@ export class NTQQGroupApi extends Service {
|
||||
const psKey = (await ntUserApi.getPSkey(['qun.qq.com'])).domainPskeyMap.get('qun.qq.com')!
|
||||
return await invoke('nodeIKernelGroupService/uploadGroupBulletinPic', [{ groupCode, psKey, path }, null])
|
||||
}
|
||||
|
||||
async getGroupRecommendContact(groupCode: string) {
|
||||
const ret = await invoke('nodeIKernelGroupService/getGroupRecommendContactArkJson', [{ groupCode }, null])
|
||||
return ret.arkJson
|
||||
}
|
||||
}
|
||||
|
@ -87,17 +87,6 @@ export class NTQQUserApi extends Service {
|
||||
return result.info
|
||||
}
|
||||
|
||||
async getSkey(): Promise<string> {
|
||||
const clientKeyData = await this.forceFetchClientKey()
|
||||
if (clientKeyData?.result !== 0) {
|
||||
throw new Error('获取clientKey失败')
|
||||
}
|
||||
const url = 'https://ssl.ptlogin2.qq.com/jump?ptlang=1033&clientuin=' + selfInfo.uin
|
||||
+ '&clientkey=' + clientKeyData.clientKey
|
||||
+ '&u1=https%3A%2F%2Fh5.qzone.qq.com%2Fqqnt%2Fqzoneinpcqq%2Ffriend%3Frefresh%3D0%26clientuin%3D0%26darkMode%3D0&keyindex=' + clientKeyData.keyIndex
|
||||
return (await RequestUtil.HttpsGetCookies(url))?.skey
|
||||
}
|
||||
|
||||
async getCookies(domain: string) {
|
||||
const clientKeyData = await this.forceFetchClientKey()
|
||||
if (clientKeyData?.result !== 0) {
|
||||
|
@ -119,7 +119,7 @@ export interface NodeIKernelBuddyService {
|
||||
|
||||
reportDoubtBuddyReqUnread(): void
|
||||
|
||||
getBuddyRecommendContactArkJson(uid: string, phoneNumber: string): Promise<unknown>
|
||||
getBuddyRecommendContactArkJson(uid: string, phoneNumber: string): Promise<GeneralCallResult & { arkMsg: string }>
|
||||
|
||||
isNull(): boolean
|
||||
}
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ export interface NodeIKernelGroupService {
|
||||
//26702(其实更早 但是我不知道)
|
||||
getGroupLatestEssenceList(groupCode: string): Promise<unknown>
|
||||
|
||||
//26702(其实更早 但是我不知道)
|
||||
//26702(其实更早 但是我不知道)
|
||||
shareDigest(Req: {
|
||||
appId: string,
|
||||
appType: number,
|
||||
@ -232,7 +232,7 @@ export interface NodeIKernelGroupService {
|
||||
|
||||
setMemberShutUp(groupCode: string, memberTimes: { uid: string, timeStamp: number }[]): Promise<void>
|
||||
|
||||
getGroupRecommendContactArkJson(groupCode: string): unknown
|
||||
getGroupRecommendContactArkJson(groupCode: string): Promise<GeneralCallResult & { arkJson: string }>
|
||||
|
||||
getJoinGroupLink(groupCode: string): unknown
|
||||
|
||||
@ -244,6 +244,7 @@ export interface NodeIKernelGroupService {
|
||||
msgRandom: number,
|
||||
msgSeq: number
|
||||
}): Promise<unknown>
|
||||
|
||||
//需要提前判断是否存在 高版本新增
|
||||
removeGroupEssence(param: {
|
||||
groupCode: string
|
||||
@ -252,4 +253,4 @@ export interface NodeIKernelGroupService {
|
||||
}): Promise<unknown>
|
||||
|
||||
isNull(): boolean
|
||||
}
|
||||
}
|
||||
|
@ -174,6 +174,12 @@ export async function createSendElements(
|
||||
sendElements.push(SendElementEntities.rps(resultId))
|
||||
}
|
||||
break
|
||||
case OB11MessageDataType.contact: {
|
||||
const { type, id } = sendMsg.data
|
||||
const data = type === 'qq' ? ctx.ntFriendApi.getBuddyRecommendContact(id) : ctx.ntGroupApi.getGroupRecommendContact(id)
|
||||
sendElements.push(SendElementEntities.ark(await data))
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@ -301,4 +307,4 @@ export async function createPeer(ctx: Context, payload: CreatePeerPayload, mode:
|
||||
}
|
||||
}
|
||||
throw new Error('请指定 group_id 或 user_id')
|
||||
}
|
||||
}
|
||||
|
@ -130,6 +130,7 @@ export enum OB11MessageDataType {
|
||||
poke = 'poke',
|
||||
dice = 'dice',
|
||||
RPS = 'rps',
|
||||
contact = 'contact',
|
||||
}
|
||||
|
||||
export interface OB11MessageMFace {
|
||||
@ -276,6 +277,14 @@ export interface OB11MessageForward {
|
||||
}
|
||||
}
|
||||
|
||||
export interface OB11MessageContact {
|
||||
type: OB11MessageDataType.contact
|
||||
data: {
|
||||
type: 'qq' | 'group'
|
||||
id: string
|
||||
}
|
||||
}
|
||||
|
||||
export type OB11MessageData =
|
||||
| OB11MessageText
|
||||
| OB11MessageFace
|
||||
@ -295,6 +304,7 @@ export type OB11MessageData =
|
||||
| OB11MessageRPS
|
||||
| OB11MessageMarkdown
|
||||
| OB11MessageForward
|
||||
| OB11MessageContact
|
||||
|
||||
export interface OB11PostSendMsg {
|
||||
message_type?: 'private' | 'group'
|
||||
|
Loading…
x
Reference in New Issue
Block a user