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",
|
"electron-vite": "^2.3.0",
|
||||||
"protobufjs-cli": "^1.1.3",
|
"protobufjs-cli": "^1.1.3",
|
||||||
"typescript": "^5.6.2",
|
"typescript": "^5.6.2",
|
||||||
"vite": "^5.4.4",
|
"vite": "^5.4.5",
|
||||||
"vite-plugin-cp": "^4.0.8"
|
"vite-plugin-cp": "^4.0.8"
|
||||||
},
|
},
|
||||||
"packageManager": "yarn@4.4.1"
|
"packageManager": "yarn@4.4.1"
|
||||||
|
@ -189,4 +189,9 @@ export class NTQQFriendApi extends Service {
|
|||||||
return await invoke('nodeIKernelBuddyService/isBuddy', [{ uid }, null])
|
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')!
|
const psKey = (await ntUserApi.getPSkey(['qun.qq.com'])).domainPskeyMap.get('qun.qq.com')!
|
||||||
return await invoke('nodeIKernelGroupService/uploadGroupBulletinPic', [{ groupCode, psKey, path }, null])
|
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
|
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) {
|
async getCookies(domain: string) {
|
||||||
const clientKeyData = await this.forceFetchClientKey()
|
const clientKeyData = await this.forceFetchClientKey()
|
||||||
if (clientKeyData?.result !== 0) {
|
if (clientKeyData?.result !== 0) {
|
||||||
|
@ -119,7 +119,7 @@ export interface NodeIKernelBuddyService {
|
|||||||
|
|
||||||
reportDoubtBuddyReqUnread(): void
|
reportDoubtBuddyReqUnread(): void
|
||||||
|
|
||||||
getBuddyRecommendContactArkJson(uid: string, phoneNumber: string): Promise<unknown>
|
getBuddyRecommendContactArkJson(uid: string, phoneNumber: string): Promise<GeneralCallResult & { arkMsg: string }>
|
||||||
|
|
||||||
isNull(): boolean
|
isNull(): boolean
|
||||||
}
|
}
|
@ -232,7 +232,7 @@ export interface NodeIKernelGroupService {
|
|||||||
|
|
||||||
setMemberShutUp(groupCode: string, memberTimes: { uid: string, timeStamp: number }[]): Promise<void>
|
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
|
getJoinGroupLink(groupCode: string): unknown
|
||||||
|
|
||||||
@ -244,6 +244,7 @@ export interface NodeIKernelGroupService {
|
|||||||
msgRandom: number,
|
msgRandom: number,
|
||||||
msgSeq: number
|
msgSeq: number
|
||||||
}): Promise<unknown>
|
}): Promise<unknown>
|
||||||
|
|
||||||
//需要提前判断是否存在 高版本新增
|
//需要提前判断是否存在 高版本新增
|
||||||
removeGroupEssence(param: {
|
removeGroupEssence(param: {
|
||||||
groupCode: string
|
groupCode: string
|
||||||
|
@ -174,6 +174,12 @@ export async function createSendElements(
|
|||||||
sendElements.push(SendElementEntities.rps(resultId))
|
sendElements.push(SendElementEntities.rps(resultId))
|
||||||
}
|
}
|
||||||
break
|
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,6 +130,7 @@ export enum OB11MessageDataType {
|
|||||||
poke = 'poke',
|
poke = 'poke',
|
||||||
dice = 'dice',
|
dice = 'dice',
|
||||||
RPS = 'rps',
|
RPS = 'rps',
|
||||||
|
contact = 'contact',
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface OB11MessageMFace {
|
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 =
|
export type OB11MessageData =
|
||||||
| OB11MessageText
|
| OB11MessageText
|
||||||
| OB11MessageFace
|
| OB11MessageFace
|
||||||
@ -295,6 +304,7 @@ export type OB11MessageData =
|
|||||||
| OB11MessageRPS
|
| OB11MessageRPS
|
||||||
| OB11MessageMarkdown
|
| OB11MessageMarkdown
|
||||||
| OB11MessageForward
|
| OB11MessageForward
|
||||||
|
| OB11MessageContact
|
||||||
|
|
||||||
export interface OB11PostSendMsg {
|
export interface OB11PostSendMsg {
|
||||||
message_type?: 'private' | 'group'
|
message_type?: 'private' | 'group'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user