mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
feat
This commit is contained in:
@@ -45,7 +45,7 @@ import { GetGroupMsgHistory } from './go-cqhttp/GetGroupMsgHistory'
|
|||||||
import GetFile from './file/GetFile'
|
import GetFile from './file/GetFile'
|
||||||
import { GetForwardMsg } from './go-cqhttp/GetForwardMsg'
|
import { GetForwardMsg } from './go-cqhttp/GetForwardMsg'
|
||||||
import { GetCookies } from './user/GetCookie'
|
import { GetCookies } from './user/GetCookie'
|
||||||
import { SetMsgEmojiLike } from './msg/SetMsgEmojiLike'
|
import { SetMsgEmojiLike } from './llonebot/SetMsgEmojiLike'
|
||||||
import { ForwardFriendSingleMsg, ForwardGroupSingleMsg } from './msg/ForwardSingleMsg'
|
import { ForwardFriendSingleMsg, ForwardGroupSingleMsg } from './msg/ForwardSingleMsg'
|
||||||
import { GetEssenceMsgList } from './go-cqhttp/GetGroupEssence'
|
import { GetEssenceMsgList } from './go-cqhttp/GetGroupEssence'
|
||||||
import { GetGroupHonorInfo } from './group/GetGroupHonorInfo'
|
import { GetGroupHonorInfo } from './group/GetGroupHonorInfo'
|
||||||
@@ -71,6 +71,7 @@ import { UploadGroupFile } from './go-cqhttp/UploadGroupFile'
|
|||||||
import { UploadPrivateFile } from './go-cqhttp/UploadPrivateFile'
|
import { UploadPrivateFile } from './go-cqhttp/UploadPrivateFile'
|
||||||
import { GetGroupFileUrl } from './go-cqhttp/GetGroupFileUrl'
|
import { GetGroupFileUrl } from './go-cqhttp/GetGroupFileUrl'
|
||||||
import { GetGroupNotice } from './go-cqhttp/GetGroupNotice'
|
import { GetGroupNotice } from './go-cqhttp/GetGroupNotice'
|
||||||
|
import { GetRobotUinRange } from './llonebot/GetRobotUinRange'
|
||||||
|
|
||||||
export function initActionMap(adapter: Adapter) {
|
export function initActionMap(adapter: Adapter) {
|
||||||
const actionHandlers = [
|
const actionHandlers = [
|
||||||
@@ -87,6 +88,8 @@ export function initActionMap(adapter: Adapter) {
|
|||||||
new GetFriendMsgHistory(adapter),
|
new GetFriendMsgHistory(adapter),
|
||||||
new FetchEmojiLike(adapter),
|
new FetchEmojiLike(adapter),
|
||||||
new FetchCustomFace(adapter),
|
new FetchCustomFace(adapter),
|
||||||
|
new SetMsgEmojiLike(adapter),
|
||||||
|
new GetRobotUinRange(adapter),
|
||||||
// onebot11
|
// onebot11
|
||||||
new SendLike(adapter),
|
new SendLike(adapter),
|
||||||
new GetMsg(adapter),
|
new GetMsg(adapter),
|
||||||
@@ -117,7 +120,6 @@ export function initActionMap(adapter: Adapter) {
|
|||||||
new GetRecord(adapter),
|
new GetRecord(adapter),
|
||||||
new CleanCache(adapter),
|
new CleanCache(adapter),
|
||||||
new GetCookies(adapter),
|
new GetCookies(adapter),
|
||||||
new SetMsgEmojiLike(adapter),
|
|
||||||
new ForwardFriendSingleMsg(adapter),
|
new ForwardFriendSingleMsg(adapter),
|
||||||
new ForwardGroupSingleMsg(adapter),
|
new ForwardGroupSingleMsg(adapter),
|
||||||
// go-cqhttp
|
// go-cqhttp
|
||||||
|
11
src/onebot11/action/llonebot/GetRobotUinRange.ts
Normal file
11
src/onebot11/action/llonebot/GetRobotUinRange.ts
Normal 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()
|
||||||
|
}
|
||||||
|
}
|
@@ -25,6 +25,8 @@ export enum ActionName {
|
|||||||
FetchCustomFace = 'fetch_custom_face',
|
FetchCustomFace = 'fetch_custom_face',
|
||||||
GetFriendMsgHistory = 'get_friend_msg_history',
|
GetFriendMsgHistory = 'get_friend_msg_history',
|
||||||
SendForwardMsg = 'send_forward_msg',
|
SendForwardMsg = 'send_forward_msg',
|
||||||
|
SetMsgEmojiLike = 'set_msg_emoji_like',
|
||||||
|
GetRobotUinRange = 'get_robot_uin_range',
|
||||||
// onebot 11
|
// onebot 11
|
||||||
SendLike = 'send_like',
|
SendLike = 'send_like',
|
||||||
GetLoginInfo = 'get_login_info',
|
GetLoginInfo = 'get_login_info',
|
||||||
@@ -38,7 +40,6 @@ export enum ActionName {
|
|||||||
SendGroupMsg = 'send_group_msg',
|
SendGroupMsg = 'send_group_msg',
|
||||||
SendPrivateMsg = 'send_private_msg',
|
SendPrivateMsg = 'send_private_msg',
|
||||||
DeleteMsg = 'delete_msg',
|
DeleteMsg = 'delete_msg',
|
||||||
SetMsgEmojiLike = 'set_msg_emoji_like',
|
|
||||||
SetGroupAddRequest = 'set_group_add_request',
|
SetGroupAddRequest = 'set_group_add_request',
|
||||||
SetFriendAddRequest = 'set_friend_add_request',
|
SetFriendAddRequest = 'set_friend_add_request',
|
||||||
SetGroupLeave = 'set_group_leave',
|
SetGroupLeave = 'set_group_leave',
|
||||||
|
@@ -20,7 +20,7 @@ import {
|
|||||||
Sex,
|
Sex,
|
||||||
TipGroupElementType,
|
TipGroupElementType,
|
||||||
User,
|
User,
|
||||||
FriendV2
|
SimpleInfo
|
||||||
} from '../ntqqapi/types'
|
} from '../ntqqapi/types'
|
||||||
import { EventType } from './event/OB11BaseEvent'
|
import { EventType } from './event/OB11BaseEvent'
|
||||||
import { encodeCQCode } from './cqcode'
|
import { encodeCQCode } from './cqcode'
|
||||||
@@ -518,11 +518,11 @@ export namespace OB11Entities {
|
|||||||
if (!replyMsgList?.length) {
|
if (!replyMsgList?.length) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const shortId = ctx.store.getShortIdByMsgInfo(peer, replyMsgList[0].msgId)
|
const shortId = ctx.store.createMsgShortId(peer, replyMsgList[0].msgId)
|
||||||
return new OB11GroupMsgEmojiLikeEvent(
|
return new OB11GroupMsgEmojiLikeEvent(
|
||||||
parseInt(msg.peerUid),
|
parseInt(msg.peerUid),
|
||||||
parseInt(senderUin),
|
parseInt(senderUin),
|
||||||
shortId!,
|
shortId,
|
||||||
[{
|
[{
|
||||||
emoji_id: emojiId,
|
emoji_id: emojiId,
|
||||||
count: 1,
|
count: 1,
|
||||||
@@ -568,8 +568,7 @@ export namespace OB11Entities {
|
|||||||
pokedetail
|
pokedetail
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
} else if (grayTipElement.jsonGrayTipElement?.busiId === '2401' && json.items[2]) {
|
||||||
if (grayTipElement.jsonGrayTipElement?.busiId === '2401' && json.items[2]) {
|
|
||||||
ctx.logger.info('收到群精华消息', json)
|
ctx.logger.info('收到群精华消息', json)
|
||||||
const searchParams = new URL(json.items[2].jp).searchParams
|
const searchParams = new URL(json.items[2].jp).searchParams
|
||||||
const msgSeq = searchParams.get('seq')
|
const msgSeq = searchParams.get('seq')
|
||||||
@@ -591,8 +590,7 @@ export namespace OB11Entities {
|
|||||||
parseInt(essence.items[0]?.msgSenderUin ?? sourceMsg.senderUin),
|
parseInt(essence.items[0]?.msgSenderUin ?? sourceMsg.senderUin),
|
||||||
parseInt(essence.items[0]?.opUin ?? '0'),
|
parseInt(essence.items[0]?.opUin ?? '0'),
|
||||||
)
|
)
|
||||||
}
|
} else if (grayTipElement.jsonGrayTipElement?.busiId === '2407') {
|
||||||
if (grayTipElement.jsonGrayTipElement?.busiId === '2407') {
|
|
||||||
const memberUin = json.items[1].param[0]
|
const memberUin = json.items[1].param[0]
|
||||||
const title = json.items[3].txt
|
const title = json.items[3].txt
|
||||||
ctx.logger.info('收到群成员新头衔消息', json)
|
ctx.logger.info('收到群成员新头衔消息', json)
|
||||||
@@ -602,6 +600,11 @@ export namespace OB11Entities {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
return new OB11GroupTitleEvent(parseInt(msg.peerUid), parseInt(memberUin), title)
|
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)
|
return friends.map(friend)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function friendV2(raw: FriendV2): OB11User {
|
export function friendV2(raw: SimpleInfo): OB11User {
|
||||||
return {
|
return {
|
||||||
...omit(raw.baseInfo, ['richBuffer', 'phoneNum']),
|
...omit(raw.baseInfo, ['richBuffer', 'phoneNum']),
|
||||||
...omit(raw.coreInfo, ['nick']),
|
...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)
|
return raw.map(friendV2)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user