Skip to content

Commit

Permalink
feat: ReactMessageWithEmojiRequest
Browse files Browse the repository at this point in the history
  • Loading branch information
CakmLexi committed Jun 17, 2024
1 parent 9e1c615 commit b92770b
Show file tree
Hide file tree
Showing 7 changed files with 143 additions and 45 deletions.
27 changes: 27 additions & 0 deletions lib/adapter/onebot/OneBot11.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
KarinGroupAdminChangedNotice,
KarinGroupMemberBanNotice,
KarinGroupFileUploadedNotice,
KarinGroupMessagReactionNotice,
} from '../../bot/KarinNotice.js'

import WebSocket from 'ws'
Expand Down Expand Up @@ -430,6 +431,22 @@ export class OneBot11 extends KarinAdapter {
break
}
break
case 'group_msg_emoji_like': {
const content = {
group_id: data.group_id,
operator_uid: data.user_id,
operator_uin: data.user_id,
message_id: data.message_id,
face_id: data.likes[0].emoji_id,
// llob目前只有上报点击 没有取消 暂时默认为true
is_emoji: true,
}
data = new KarinGroupMessagReactionNotice({ time, self_id, content })
break
}
default: {
return this.#logger.error('未知通知事件:', JSON.stringify(data))
}
}

this.#listener.emit('notice', data)
Expand Down Expand Up @@ -1278,6 +1295,16 @@ export class OneBot11 extends KarinAdapter {
return result
}

/**
* 对消息进行表情回应
* @param {KarinContact} Contact - 联系人信息
* @param {string} message_id - 消息ID
* @param {string} face_id - 表情ID
*/
async ReactMessageWithEmojiRequest (Contact, message_id, face_id, is_set = true) {
return await this.SendApi('set_msg_emoji_like', { message_id, emoji_id: face_id, is_set })
}

/**
* 获取 Cookies
* @param {string} domain - 需要获取 cookies 的域名
Expand Down
20 changes: 10 additions & 10 deletions lib/bot/KarinElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -496,22 +496,22 @@ export class KarinNodeElement extends KarinElement {
export class KarinXmlElement extends KarinElement {
/**
* 构建一个xml元素
* @param {String} xml - xml内容
* @param {String} data - xml内容
* @returns {KarinXmlElement}
*/
constructor (xml) {
constructor (data) {
super()
this.type = 'xml'
/**
* @type {String} xml
*/
this.xml = xml
this.data = data
}

/**
* @type {String} xml
* @type {String} data
*/
xml
data
}

/**
Expand All @@ -520,22 +520,22 @@ export class KarinXmlElement extends KarinElement {
export class KarinJsonElement extends KarinElement {
/**
* 构建一个json元素
* @param {String} json - json内容
* @param {String} data - json内容
* @returns {KarinJsonElement}
*/
constructor (json) {
constructor (data) {
super()
this.type = 'json'
/**
* @type {String} json
*/
this.json = json
this.data = data
}

/**
* @type {String} json
* @type {String} data
*/
json
data
}

/**
Expand Down
Loading

0 comments on commit b92770b

Please sign in to comment.