mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
make ts happy
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
import BaseAction from '../BaseAction'
|
||||
import { NTQQMsgApi, Peer } from '../../../ntqqapi/api'
|
||||
import { ChatType, RawMessage } from '../../../ntqqapi/types'
|
||||
import { dbUtil } from '../../../common/db'
|
||||
import { getUidByUin } from '../../../common/data'
|
||||
import { NTQQMsgApi } from '@/ntqqapi/api'
|
||||
import { ChatType, RawMessage } from '@/ntqqapi/types'
|
||||
import { dbUtil } from '@/common/db'
|
||||
import { getUidByUin } from '@/common/data'
|
||||
import { ActionName } from '../types'
|
||||
import { Peer } from '@/ntqqapi/types'
|
||||
|
||||
interface Payload {
|
||||
message_id: number
|
||||
@@ -15,16 +16,16 @@ interface Response {
|
||||
message_id: number
|
||||
}
|
||||
|
||||
class ForwardSingleMsg extends BaseAction<Payload, Response> {
|
||||
abstract class ForwardSingleMsg extends BaseAction<Payload, Response> {
|
||||
protected async getTargetPeer(payload: Payload): Promise<Peer> {
|
||||
if (payload.user_id) {
|
||||
return { chatType: ChatType.friend, peerUid: getUidByUin(payload.user_id.toString()) }
|
||||
return { chatType: ChatType.friend, peerUid: getUidByUin(payload.user_id.toString())! }
|
||||
}
|
||||
return { chatType: ChatType.group, peerUid: payload.group_id.toString() }
|
||||
}
|
||||
|
||||
protected async _handle(payload: Payload): Promise<Response> {
|
||||
const msg = await dbUtil.getMsgByShortId(payload.message_id)
|
||||
const msg = (await dbUtil.getMsgByShortId(payload.message_id))!
|
||||
const peer = await this.getTargetPeer(payload)
|
||||
const sentMsg = await NTQQMsgApi.forwardMsg(
|
||||
{
|
||||
@@ -35,7 +36,7 @@ class ForwardSingleMsg extends BaseAction<Payload, Response> {
|
||||
[msg.msgId],
|
||||
)
|
||||
const ob11MsgId = await dbUtil.addMsg(sentMsg)
|
||||
return {message_id: ob11MsgId}
|
||||
return { message_id: ob11MsgId! }
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user