mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
fix: #509
This commit is contained in:
parent
221b3fb730
commit
ce57b7b725
@ -2,12 +2,14 @@ import { ChatType, Peer } from '@/core/entities';
|
|||||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||||
import BaseAction from '../BaseAction';
|
import BaseAction from '../BaseAction';
|
||||||
import { ActionName } from '../types';
|
import { ActionName } from '../types';
|
||||||
|
import { MessageUnique } from '@/common/message-unique';
|
||||||
|
|
||||||
const SchemaData = {
|
const SchemaData = {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
properties: {
|
properties: {
|
||||||
user_id: { type: ['number', 'string'] },
|
user_id: { type: ['number', 'string'] },
|
||||||
group_id: { type: ['number', 'string'] },
|
group_id: { type: ['number', 'string'] },
|
||||||
|
message_id: { type: ['number', 'string'] },
|
||||||
},
|
},
|
||||||
} as const satisfies JSONSchema;
|
} as const satisfies JSONSchema;
|
||||||
|
|
||||||
@ -15,6 +17,16 @@ type PlayloadType = FromSchema<typeof SchemaData>;
|
|||||||
|
|
||||||
class MarkMsgAsRead extends BaseAction<PlayloadType, null> {
|
class MarkMsgAsRead extends BaseAction<PlayloadType, null> {
|
||||||
async getPeer(payload: PlayloadType): Promise<Peer> {
|
async getPeer(payload: PlayloadType): Promise<Peer> {
|
||||||
|
if (payload.message_id) {
|
||||||
|
let s_peer = MessageUnique.getMsgIdAndPeerByShortId(+payload.message_id)?.Peer;
|
||||||
|
if (s_peer) {
|
||||||
|
return s_peer;
|
||||||
|
}
|
||||||
|
let l_peer = MessageUnique.getPeerByMsgId(payload.message_id.toString())?.Peer;
|
||||||
|
if (l_peer) {
|
||||||
|
return l_peer;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (payload.user_id) {
|
if (payload.user_id) {
|
||||||
const peerUid = await this.core.apis.UserApi.getUidByUinV2(payload.user_id.toString());
|
const peerUid = await this.core.apis.UserApi.getUidByUinV2(payload.user_id.toString());
|
||||||
if (!peerUid) {
|
if (!peerUid) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user