mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
feat: fetch_emoji_like
This commit is contained in:
@@ -67,6 +67,10 @@ setTimeout(() => {
|
|||||||
// }, 25000)
|
// }, 25000)
|
||||||
|
|
||||||
export class NTQQMsgApi {
|
export class NTQQMsgApi {
|
||||||
|
static async getMsgEmojiLikesList(peer: Peer, msgSeq: string, emojiId: string, emojiType: string, count: number = 20) {
|
||||||
|
console.log(peer, msgSeq, emojiId, emojiType, count);
|
||||||
|
return napCatCore.session.getMsgService().getMsgEmojiLikesList(peer, msgSeq, emojiId, emojiType, "", false, 20)
|
||||||
|
}
|
||||||
// static napCatCore: NapCatCore | null = null;
|
// static napCatCore: NapCatCore | null = null;
|
||||||
// enum BaseEmojiType {
|
// enum BaseEmojiType {
|
||||||
// NORMAL_EMOJI,
|
// NORMAL_EMOJI,
|
||||||
|
32
src/onebot11/action/extends/FetchEmojioLike.ts
Normal file
32
src/onebot11/action/extends/FetchEmojioLike.ts
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
//getMsgEmojiLikesList
|
||||||
|
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||||
|
import BaseAction from '../BaseAction';
|
||||||
|
import { ActionName } from '../types';
|
||||||
|
import { NTQQMsgApi } from '@/core/apis';
|
||||||
|
import { MessageUnique } from '@/common/utils/MessageUnique';
|
||||||
|
const SchemaData = {
|
||||||
|
type: 'object',
|
||||||
|
properties: {
|
||||||
|
user_id: { type: 'string' },
|
||||||
|
group_id: { type: 'string' },
|
||||||
|
emojiId: { type: 'string' },
|
||||||
|
emojiType: { type: 'string' },
|
||||||
|
message_id: { type: ['string', 'number'] },
|
||||||
|
count: { type: 'number' }
|
||||||
|
},
|
||||||
|
required: ['emojiId', 'emojiType', 'message_id']
|
||||||
|
} as const satisfies JSONSchema;
|
||||||
|
|
||||||
|
type Payload = FromSchema<typeof SchemaData>;
|
||||||
|
|
||||||
|
export class FetchEmojioLike extends BaseAction<Payload, any> {
|
||||||
|
actionName = ActionName.FetchEmojioLike;
|
||||||
|
PayloadSchema = SchemaData;
|
||||||
|
protected async _handle(payload: Payload) {
|
||||||
|
let msgIdPeer = MessageUnique.getMsgIdAndPeerByShortId(parseInt(payload.message_id.toString()));
|
||||||
|
if(!msgIdPeer) throw new Error('消息不存在');
|
||||||
|
let msg = (await NTQQMsgApi.getMsgsByMsgId(msgIdPeer.Peer, [msgIdPeer.MsgId])).msgList[0];
|
||||||
|
const ret = await NTQQMsgApi.getMsgEmojiLikesList(msgIdPeer.Peer,msg.msgSeq,payload.emojiId,payload.emojiType,payload.count);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
@@ -78,8 +78,10 @@ import SetGroupHeader from './extends/SetGroupHeader';
|
|||||||
import { FetchCustomFace } from './extends/FetchCustomFace';
|
import { FetchCustomFace } from './extends/FetchCustomFace';
|
||||||
import GoCQHTTPUploadPrivateFile from './go-cqhttp/UploadPrivareFile';
|
import GoCQHTTPUploadPrivateFile from './go-cqhttp/UploadPrivareFile';
|
||||||
import TestApi01 from './extends/TestApi01';
|
import TestApi01 from './extends/TestApi01';
|
||||||
|
import { FetchEmojioLike } from './extends/FetchEmojioLike';
|
||||||
|
|
||||||
export const actionHandlers = [
|
export const actionHandlers = [
|
||||||
|
new FetchEmojioLike(),
|
||||||
new RebootNormal(),
|
new RebootNormal(),
|
||||||
new GetFile(),
|
new GetFile(),
|
||||||
new Debug(),
|
new Debug(),
|
||||||
|
@@ -102,5 +102,6 @@ export enum ActionName {
|
|||||||
SetGroupHeader = 'set_group_head',
|
SetGroupHeader = 'set_group_head',
|
||||||
FetchCustomFace = 'fetch_custom_face',
|
FetchCustomFace = 'fetch_custom_face',
|
||||||
GOCQHTTP_UploadPrivateFile = 'upload_private_file',
|
GOCQHTTP_UploadPrivateFile = 'upload_private_file',
|
||||||
TestApi01 = 'test_api_01'
|
TestApi01 = 'test_api_01',
|
||||||
|
FetchEmojioLike = "fetch_emoji_like"
|
||||||
}
|
}
|
||||||
|
@@ -458,6 +458,7 @@ export class OB11Constructor {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (grayTipElement) {
|
if (grayTipElement) {
|
||||||
|
//console.log('收到群提示消息', grayTipElement);
|
||||||
if (grayTipElement.xmlElement?.templId === '10382') {
|
if (grayTipElement.xmlElement?.templId === '10382') {
|
||||||
const emojiLikeData = new fastXmlParser.XMLParser({
|
const emojiLikeData = new fastXmlParser.XMLParser({
|
||||||
ignoreAttributes: false,
|
ignoreAttributes: false,
|
||||||
|
@@ -98,6 +98,8 @@ export class NapCatOnebot11 {
|
|||||||
// .map(x => x.toString(16).padStart(2, '0'))
|
// .map(x => x.toString(16).padStart(2, '0'))
|
||||||
// .join('');
|
// .join('');
|
||||||
// }
|
// }
|
||||||
|
// const hex = buf2hex(Buffer.from(protobufData));
|
||||||
|
// console.log(hex);
|
||||||
// // let Data: Data = {
|
// // let Data: Data = {
|
||||||
// // header: {
|
// // header: {
|
||||||
// // GroupNumber: 0,
|
// // GroupNumber: 0,
|
||||||
@@ -192,6 +194,7 @@ export class NapCatOnebot11 {
|
|||||||
// // 732 17 GroupRecall
|
// // 732 17 GroupRecall
|
||||||
// // 732 20 GroupCommonTips
|
// // 732 20 GroupCommonTips
|
||||||
// // 732 21 EssenceMessage
|
// // 732 21 EssenceMessage
|
||||||
|
// // 732 16 16 GrayTips ->Busi->GroupEmjioLike
|
||||||
// } catch (e) {
|
// } catch (e) {
|
||||||
// log('解析SysMsg异常', e);
|
// log('解析SysMsg异常', e);
|
||||||
// // console.log(e);
|
// // console.log(e);
|
||||||
@@ -209,7 +212,7 @@ export class NapCatOnebot11 {
|
|||||||
// 临时会话更新 tempGroupCodeMap uid -> source/GroupCode
|
// 临时会话更新 tempGroupCodeMap uid -> source/GroupCode
|
||||||
};
|
};
|
||||||
msgListener.onRecvMsg = async (msg) => {
|
msgListener.onRecvMsg = async (msg) => {
|
||||||
|
|
||||||
//console.log('ob11 onRecvMsg', JSON.stringify(msg, null, 2));
|
//console.log('ob11 onRecvMsg', JSON.stringify(msg, null, 2));
|
||||||
// logDebug('收到消息', msg);
|
// logDebug('收到消息', msg);
|
||||||
for (const m of msg) {
|
for (const m of msg) {
|
||||||
@@ -291,7 +294,7 @@ export class NapCatOnebot11 {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
groupListener.onMemberInfoChange = async (groupCode: string, changeType: number, members: Map<string, GroupMember>) => {
|
groupListener.onMemberInfoChange = async (groupCode: string, changeType: number, members: Map<string, GroupMember>) => {
|
||||||
// console.log("ob11 onMemberInfoChange", groupCode, changeType, members)
|
// console.log("ob11 onMemberInfoChange", groupCode, changeType, members)
|
||||||
if (changeType === 1) {
|
if (changeType === 1) {
|
||||||
let member;
|
let member;
|
||||||
for (const [key, value] of members) {
|
for (const [key, value] of members) {
|
||||||
|
Reference in New Issue
Block a user