-
Notifications
You must be signed in to change notification settings - Fork 225
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/NapNeko/NapCatQQ
- Loading branch information
Showing
6 changed files
with
87 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { ActionName } from '../types'; | ||
import BaseAction from '../BaseAction'; | ||
import { dbUtil } from '@/common/utils/db'; | ||
import { NTQQMsgApi } from '@/core/apis'; | ||
|
||
interface Payload { | ||
message_id: number, | ||
emoji_id: string | ||
} | ||
|
||
export class SetMsgEmojiLike extends BaseAction<Payload, any> { | ||
actionName = ActionName.SetMsgEmojiLike; | ||
|
||
protected async _handle(payload: Payload) { | ||
const msg = await dbUtil.getMsgByShortId(payload.message_id); | ||
if (!msg) { | ||
throw new Error('msg not found'); | ||
} | ||
if (!payload.emoji_id){ | ||
throw new Error('emojiId not found'); | ||
} | ||
return await NTQQMsgApi.setEmojiLike({ | ||
chatType: msg.chatType, | ||
peerUid: msg.peerUid | ||
}, msg.msgSeq, payload.emoji_id, true); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import {OB11GroupNoticeEvent} from "./OB11GroupNoticeEvent"; | ||
|
||
export interface MsgEmojiLike { | ||
emoji_id: string, | ||
count: number | ||
} | ||
|
||
export class OB11GroupMsgEmojiLikeEvent extends OB11GroupNoticeEvent { | ||
notice_type = "group_msg_emoji_like"; | ||
message_id: number; | ||
sub_type: "ban" | "lift_ban"; | ||
likes: MsgEmojiLike[] | ||
|
||
constructor(groupId: number, userId: number, messageId: number, likes: MsgEmojiLike[]) { | ||
super(); | ||
this.group_id = groupId; | ||
this.user_id = userId; // 可为空,表示是对别人的消息操作,如果是对bot自己的消息则不为空 | ||
this.message_id = messageId; | ||
this.likes = likes; | ||
} | ||
} |