This commit is contained in:
idranme 2024-10-01 21:16:39 +08:00
parent a7d86f8fe0
commit e313b2b3e6
No known key found for this signature in database
GPG Key ID: 926F7B5B668E495F
5 changed files with 29 additions and 12 deletions

View File

@ -45,7 +45,7 @@ import { GetGroupMsgHistory } from './go-cqhttp/GetGroupMsgHistory'
import GetFile from './file/GetFile'
import { GetForwardMsg } from './go-cqhttp/GetForwardMsg'
import { GetCookies } from './user/GetCookie'
import { SetMsgEmojiLike } from './msg/SetMsgEmojiLike'
import { SetMsgEmojiLike } from './llonebot/SetMsgEmojiLike'
import { ForwardFriendSingleMsg, ForwardGroupSingleMsg } from './msg/ForwardSingleMsg'
import { GetEssenceMsgList } from './go-cqhttp/GetGroupEssence'
import { GetGroupHonorInfo } from './group/GetGroupHonorInfo'
@ -71,6 +71,7 @@ import { UploadGroupFile } from './go-cqhttp/UploadGroupFile'
import { UploadPrivateFile } from './go-cqhttp/UploadPrivateFile'
import { GetGroupFileUrl } from './go-cqhttp/GetGroupFileUrl'
import { GetGroupNotice } from './go-cqhttp/GetGroupNotice'
import { GetRobotUinRange } from './llonebot/GetRobotUinRange'
export function initActionMap(adapter: Adapter) {
const actionHandlers = [
@ -87,6 +88,8 @@ export function initActionMap(adapter: Adapter) {
new GetFriendMsgHistory(adapter),
new FetchEmojiLike(adapter),
new FetchCustomFace(adapter),
new SetMsgEmojiLike(adapter),
new GetRobotUinRange(adapter),
// onebot11
new SendLike(adapter),
new GetMsg(adapter),
@ -117,7 +120,6 @@ export function initActionMap(adapter: Adapter) {
new GetRecord(adapter),
new CleanCache(adapter),
new GetCookies(adapter),
new SetMsgEmojiLike(adapter),
new ForwardFriendSingleMsg(adapter),
new ForwardGroupSingleMsg(adapter),
// go-cqhttp

View File

@ -0,0 +1,11 @@
import { BaseAction } from '../BaseAction'
import { ActionName } from '../types'
import { Dict } from 'cosmokit'
export class GetRobotUinRange extends BaseAction<void, Dict[]> {
actionName = ActionName.GetRobotUinRange
async _handle() {
return await this.ctx.ntUserApi.getRobotUinRange()
}
}

View File

@ -25,6 +25,8 @@ export enum ActionName {
FetchCustomFace = 'fetch_custom_face',
GetFriendMsgHistory = 'get_friend_msg_history',
SendForwardMsg = 'send_forward_msg',
SetMsgEmojiLike = 'set_msg_emoji_like',
GetRobotUinRange = 'get_robot_uin_range',
// onebot 11
SendLike = 'send_like',
GetLoginInfo = 'get_login_info',
@ -38,7 +40,6 @@ export enum ActionName {
SendGroupMsg = 'send_group_msg',
SendPrivateMsg = 'send_private_msg',
DeleteMsg = 'delete_msg',
SetMsgEmojiLike = 'set_msg_emoji_like',
SetGroupAddRequest = 'set_group_add_request',
SetFriendAddRequest = 'set_friend_add_request',
SetGroupLeave = 'set_group_leave',

View File

@ -20,7 +20,7 @@ import {
Sex,
TipGroupElementType,
User,
FriendV2
SimpleInfo
} from '../ntqqapi/types'
import { EventType } from './event/OB11BaseEvent'
import { encodeCQCode } from './cqcode'
@ -518,11 +518,11 @@ export namespace OB11Entities {
if (!replyMsgList?.length) {
return
}
const shortId = ctx.store.getShortIdByMsgInfo(peer, replyMsgList[0].msgId)
const shortId = ctx.store.createMsgShortId(peer, replyMsgList[0].msgId)
return new OB11GroupMsgEmojiLikeEvent(
parseInt(msg.peerUid),
parseInt(senderUin),
shortId!,
shortId,
[{
emoji_id: emojiId,
count: 1,
@ -568,8 +568,7 @@ export namespace OB11Entities {
pokedetail
)
}
}
if (grayTipElement.jsonGrayTipElement?.busiId === '2401' && json.items[2]) {
} else if (grayTipElement.jsonGrayTipElement?.busiId === '2401' && json.items[2]) {
ctx.logger.info('收到群精华消息', json)
const searchParams = new URL(json.items[2].jp).searchParams
const msgSeq = searchParams.get('seq')
@ -591,8 +590,7 @@ export namespace OB11Entities {
parseInt(essence.items[0]?.msgSenderUin ?? sourceMsg.senderUin),
parseInt(essence.items[0]?.opUin ?? '0'),
)
}
if (grayTipElement.jsonGrayTipElement?.busiId === '2407') {
} else if (grayTipElement.jsonGrayTipElement?.busiId === '2407') {
const memberUin = json.items[1].param[0]
const title = json.items[3].txt
ctx.logger.info('收到群成员新头衔消息', json)
@ -602,6 +600,11 @@ export namespace OB11Entities {
}
})
return new OB11GroupTitleEvent(parseInt(msg.peerUid), parseInt(memberUin), title)
} else if (grayTipElement.jsonGrayTipElement?.busiId === '19217') {
ctx.logger.info('收到新人被邀请进群消息', grayTipElement)
const userId = new URL(json.items[2].jp).searchParams.get('robot_uin')
const operatorId = new URL(json.items[0].jp).searchParams.get('uin')
return new OB11GroupIncreaseEvent(Number(msg.peerUid), Number(userId), Number(operatorId), 'invite')
}
}
}
@ -648,7 +651,7 @@ export namespace OB11Entities {
return friends.map(friend)
}
export function friendV2(raw: FriendV2): OB11User {
export function friendV2(raw: SimpleInfo): OB11User {
return {
...omit(raw.baseInfo, ['richBuffer', 'phoneNum']),
...omit(raw.coreInfo, ['nick']),
@ -660,7 +663,7 @@ export namespace OB11Entities {
}
}
export function friendsV2(raw: FriendV2[]): OB11User[] {
export function friendsV2(raw: SimpleInfo[]): OB11User[] {
return raw.map(friendV2)
}