Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -177,18 +177,19 @@
"redis": "npm:@karinjs/redis@1.1.3",
"sqlite3": "npm:@karinjs/sqlite3@0.4.3",
"ws": "npm:@karinjs/ws@1.0.4",
"yaml": "2.7.0"
"yaml": "2.7.0",
"jsonwebtoken": "^9.0.3"
},
"devDependencies": {
"@karinjs/node-pty": "^1.1.3",
"@karinjs/onebot": "workspace:*",
"@karinjs/plugin-webui-network-monitor": "^1.0.3",
"@karinjs/plugins-list": "^1.7.0",
"@types/express": "^5.0.3",
"@types/jsonwebtoken": "^9.0.10",
"@types/lodash": "^4.17.16",
"cross-env": "^7.0.3",
"dotenv": "npm:@karinjs/dotenv@^1.1.2",
"jsonwebtoken": "npm:@karinjs/jsonwebtoken@^1.1.1"
"dotenv": "npm:@karinjs/dotenv@^1.1.2"
},
"engines": {
"node": ">=18"
Expand All @@ -198,4 +199,4 @@
"registry": "https://registry.npmjs.org"
},
"time": "2025-10-08T06:35:20.005Z"
}
}
8 changes: 6 additions & 2 deletions packages/core/src/adapter/onebot/core/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1090,12 +1090,14 @@ export class AdapterOneBot<T extends OneBotType> extends AdapterBase {
}

if (typeof elem.options === 'object') {
if (elem.options.news) node.data.news = elem.options.news
if (elem.options.prompt) node.data.prompt = elem.options.prompt
if (elem.options.summary) node.data.summary = elem.options.summary
if (elem.options.source) node.data.source = elem.options.source
}

if (options && messages.length === 0) {
node.data.news = options.news
node.data.prompt = options.prompt
node.data.summary = options.summary
node.data.source = options.source
Expand All @@ -1119,14 +1121,16 @@ export class AdapterOneBot<T extends OneBotType> extends AdapterBase {
if (contact.scene === 'group') {
return this._onebot.sendGroupForwardMsg(
Number(contact.peer),
this.forwardKarinConvertAdapter(elements, options)
this.forwardKarinConvertAdapter(elements, options),
options
)
}

if (contact.scene === 'friend') {
return this._onebot.sendPrivateForwardMsg(
Number(contact.peer),
this.forwardKarinConvertAdapter(elements, options)
this.forwardKarinConvertAdapter(elements, options),
options
)
}

Expand Down
24 changes: 24 additions & 0 deletions packages/onebot/src/api/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,14 @@ export interface OneBotMessageApi {
action: 'send_forward_msg',
params: {
messages: NodeMessage[]
/** napcat拓展: 小卡片中间的外显 */
news?: Array<{ text: string }>
/** napcat拓展: 消息列表的外显 */
prompt?: string
/** napcat拓展: 小卡片底下文本: 查看1条转发消息 */
summary?: string
/** napcat拓展: 小卡片标题 */
source?: string
},
response: {
message_id: string
Expand All @@ -262,6 +270,14 @@ export interface OneBotMessageApi {
params: {
group_id: number,
messages: NodeMessage[]
/** napcat拓展: 小卡片中间的外显 */
news?: Array<{ text: string }>
/** napcat拓展: 消息列表的外显 */
prompt?: string
/** napcat拓展: 小卡片底下文本: 查看1条转发消息 */
summary?: string
/** napcat拓展: 小卡片标题 */
source?: string
},
response: {
message_id: string
Expand All @@ -277,6 +293,14 @@ export interface OneBotMessageApi {
params: {
user_id: number,
messages: NodeMessage[]
/** napcat拓展: 小卡片中间的外显 */
news?: Array<{ text: string }>
/** napcat拓展: 消息列表的外显 */
prompt?: string
/** napcat拓展: 小卡片底下文本: 查看1条转发消息 */
summary?: string
/** napcat拓展: 小卡片标题 */
source?: string
},
response: {
message_id: string
Expand Down
15 changes: 12 additions & 3 deletions packages/onebot/src/core/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -544,45 +544,54 @@ export abstract class OneBotCore extends EventEmitter {
/**
* GoCQ扩展: 发送合并转发消息
* @param messages - 消息节点列表
* @param options - 外显参数
* @returns 消息ID
*/
async sendForwardMsg (
messages: NodeMessage[]
messages: NodeMessage[],
options?: { news?: Array<{ text: string }>, prompt?: string, summary?: string, source?: string }
) {
return this.sendApi(OneBotMessageApiAction.sendForwardMsg, {
messages,
...options,
})
}

/**
* GoCQ扩展: 发送合并转发(群聊)
* @param group_id - 群ID
* @param messages - 消息节点列表
* @param options - 外显参数
* @returns 消息ID
*/
async sendGroupForwardMsg (
group_id: number,
messages: NodeMessage[]
messages: NodeMessage[],
options?: { news?: Array<{ text: string }>, prompt?: string, summary?: string, source?: string }
) {
return this.sendApi(OneBotMessageApiAction.sendGroupForwardMsg, {
group_id,
messages,
...options,
})
}

/**
* GoCQ扩展: 发送合并转发(好友)
* @param user_id - 用户ID
* @param messages - 消息节点列表
* @param options - 外显参数
* @returns 消息ID
*/
async sendPrivateForwardMsg (
user_id: number,
messages: NodeMessage[]
messages: NodeMessage[],
options?: { news?: Array<{ text: string }>, prompt?: string, summary?: string, source?: string }
) {
return this.sendApi(OneBotMessageApiAction.sendPrivateForwardMsg, {
user_id,
messages,
...options,
})
}

Expand Down
2 changes: 2 additions & 0 deletions packages/onebot/src/message/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,8 @@ export interface NodeCustomMessage extends MessageBase {
user_id: string,
nickname: string,
content: OneBotMessage[]
/** napcat拓展: 小卡片中间的外显 */
news?: Array<{ text: string }>
/** napcat拓展: 消息列表的外显 */
prompt?: string
/** napcat拓展: 小卡片底下文本: 查看1条转发消息 */
Expand Down
Loading
Loading