UNPKG

n8n-nodes-onebot-api

Version:

OneBot node for n8n workflow, now you can send message to your QQ friend or group. This version includes optimized group and private chat operations and enhanced permission grading. OneBot 节点用于 n8n 工作流,现在您可以向您的 QQ 朋友或群组发送消息。此版本包括优化的群聊和私聊操作以及增强的权限分级。

50 lines 2.06 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.executeFriendOperation = void 0; const GenericFunctions_1 = require("./GenericFunctions"); async function executeFriendOperation(index) { const operation = this.getNodeParameter('operation', index); let responseData = {}; let body = {}; let query = {}; let method = 'GET'; let endpoint = ''; switch (operation) { case 'get_friend_list': endpoint = 'get_friend_list'; method = 'GET'; break; case 'get_stranger_info': const strangerUserId = this.getNodeParameter('user_id', index); query.user_id = strangerUserId; endpoint = 'get_stranger_info'; method = 'GET'; break; case 'send_like': const likeUserId = this.getNodeParameter('user_id', index); body.user_id = likeUserId; body.times = this.getNodeParameter('times', index); endpoint = 'send_like'; method = 'POST'; break; case 'send_friend_poke': const friendPokeUserId = this.getNodeParameter('user_id', index); body.user_id = friendPokeUserId; endpoint = 'send_poke'; method = 'POST'; break; default: throw new Error(`未知的好友操作: ${operation}`); } if (method === 'GET') { console.log(`执行好友操作: ${operation}, 端点: ${endpoint}, 查询参数:`, JSON.stringify(query)); responseData = await GenericFunctions_1.apiRequest.call(this, method, endpoint, undefined, query); } else { console.log(`执行好友操作: ${operation}, 端点: ${endpoint}, 请求体:`, JSON.stringify(body)); responseData = await GenericFunctions_1.apiRequest.call(this, method, endpoint, body); } return responseData; } exports.executeFriendOperation = executeFriendOperation; //# sourceMappingURL=FriendActions.js.map