mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
fix: get_group_msg_history return type
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
{
|
{
|
||||||
"manifest_version": 4,
|
"manifest_version": 4,
|
||||||
"type": "extension",
|
"type": "extension",
|
||||||
"name": "LLOneBot v3.18.1",
|
"name": "LLOneBot v3.18.2",
|
||||||
"slug": "LLOneBot",
|
"slug": "LLOneBot",
|
||||||
"description": "LiteLoaderQQNT的OneBotApi,不支持商店在线更新",
|
"description": "LiteLoaderQQNT的OneBotApi,不支持商店在线更新",
|
||||||
"version": "3.18.1",
|
"version": "3.18.2",
|
||||||
"icon": "./icon.jpg",
|
"icon": "./icon.jpg",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
|
@@ -15,21 +15,25 @@ interface Payload {
|
|||||||
count: number
|
count: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class GoCQHTTPGetGroupMsgHistory extends BaseAction<Payload, OB11Message[]> {
|
interface Response{
|
||||||
|
messages: OB11Message[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export default class GoCQHTTPGetGroupMsgHistory extends BaseAction<Payload, Response> {
|
||||||
actionName = ActionName.GoCQHTTP_GetGroupMsgHistory
|
actionName = ActionName.GoCQHTTP_GetGroupMsgHistory
|
||||||
|
|
||||||
protected async _handle(payload: Payload): Promise<OB11Message[]> {
|
protected async _handle(payload: Payload): Promise<Response> {
|
||||||
const group = groups.find(group => group.groupCode === payload.group_id.toString())
|
const group = groups.find(group => group.groupCode === payload.group_id.toString())
|
||||||
if (!group) {
|
if (!group) {
|
||||||
throw `群${payload.group_id}不存在`
|
throw `群${payload.group_id}不存在`
|
||||||
}
|
}
|
||||||
const startMsgId = (await dbUtil.getMsgByShortId(payload.message_seq))?.msgId || "0"
|
const startMsgId = (await dbUtil.getMsgByShortId(payload.message_seq))?.msgId || "0"
|
||||||
// log("startMsgId", startMsgId)
|
// log("startMsgId", startMsgId)
|
||||||
let msgList = (await NTQQMsgApi.getMsgHistory({chatType: ChatType.group, peerUid: group.groupCode}, startMsgId, parseInt(payload.count.toString()) || 0)).msgList
|
let msgList = (await NTQQMsgApi.getMsgHistory({chatType: ChatType.group, peerUid: group.groupCode}, startMsgId, parseInt(payload.count?.toString()) || 20)).msgList
|
||||||
await Promise.all(msgList.map(async msg => {
|
await Promise.all(msgList.map(async msg => {
|
||||||
msg.msgShortId = await dbUtil.addMsg(msg)
|
msg.msgShortId = await dbUtil.addMsg(msg)
|
||||||
}))
|
}))
|
||||||
const ob11MsgList = await Promise.all(msgList.map(msg=>OB11Constructor.message(msg)))
|
const ob11MsgList = await Promise.all(msgList.map(msg=>OB11Constructor.message(msg)))
|
||||||
return ob11MsgList
|
return {"messages": ob11MsgList}
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -1 +1 @@
|
|||||||
export const version = "3.18.1"
|
export const version = "3.18.2"
|
Reference in New Issue
Block a user