Closed 743v45 closed 2 years ago
应该support了。你试试。 f401e1d12f9a3d2ffbf205b8ab7ccee300d58bcc
hubot-lark version: master
发了个 @bot help
TypeError: Cannot read property 'sender_id' of undefined
at /disk/ssd1/app/notify-bot/node_modules/hubot-lark/src/webhook_service.coffee:38:36, <js>:50:43
at Layer.handle [as handle_request] (/disk/ssd1/app/notify-bot/node_modules/express/lib/router/layer.js:95:5)
at next (/disk/ssd1/app/notify-bot/node_modules/express/lib/router/route.js:137:13)
at Route.dispatch (/disk/ssd1/app/notify-bot/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/disk/ssd1/app/notify-bot/node_modules/express/lib/router/layer.js:95:5)
at /disk/ssd1/app/notify-bot/node_modules/express/lib/router/index.js:281:22
at Function.process_params (/disk/ssd1/app/notify-bot/node_modules/express/lib/router/index.js:335:12)
at next (/disk/ssd1/app/notify-bot/node_modules/express/lib/router/index.js:275:10)
at /disk/ssd1/app/notify-bot/node_modules/body-parser/lib/read.js:130:5
at invokeCallback (/disk/ssd1/app/notify-bot/node_modules/raw-body/index.js:224:16)
at done (/disk/ssd1/app/notify-bot/node_modules/raw-body/index.js:213:7)
at IncomingMessage.onEnd (/disk/ssd1/app/notify-bot/node_modules/raw-body/index.js:273:7)
at IncomingMessage.emit (events.js:182:13)
at endReadableNT (_stream_readable.js:1094:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
能不能把lark过来的json数据给我看一下?
{ uuid: '927f6bdb4c27241861eb6f0d54c18057',
event:
{ app_id: 'cli_a0ffc508cf1361d014',
chat_type: 'group',
employee_id: 'a1265e3f',
is_mention: true,
lark_version: 'lark/3.46.9',
message_id: '',
msg_type: 'text',
open_chat_id: '<>',
open_id: '<>',
open_message_id: '<>',
parent_id: '',
root_id: '',
tenant_key: '2d36537b3e0f975e',
text: '<at open_id="ou_5dc8a196df42d0520b135a291084143aa">@app-base-hubot</at> help',
text_without_at_bot: ' help',
type: 'message',
union_id: '<>',
user_agent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36 Lark/3.46.9 LarkLocale/zh_CN ttnet SDK-Version/3.46.28',
user_open_id: '<>' },
token: '<>',
ts: '1619503853.515741',
type: 'event_callback' }
同样的问题
TypeError: Cannot read property 'toString' of undefined
at new User (D:\gitlab\hubot-lark\node_modules\hubot\src\user.js:33:27)
at new CoffeeScriptCompatibleClass (D:\gitlab\hubot-lark\node_modules\hubot\index.js:21:22)
at D:\gitlab\hubot-lark\node_modules\hubot-lark\src\webhook_service.coffee:37:7,
现在的数据结构长这样子了
data = {
schema: '2.0',
header: {
event_id: 'af4a343963a28fe08545a221023cacfd',
token: '',
create_time: '1644918262332',
event_type: 'im.message.receive_v1',
tenant_key: 'xxxxxxxxxxxxxx',
app_id: 'cli_xxxxxx'
},
event: {
message: {
chat_id: 'oc_adbbd6f6dc162168e50a59831550f68c',
chat_type: 'p2p',
content: '{"text":"ping"}',
create_time: '1644918262067',
message_id: 'om_e83fc19f8730cae69df6d9a4b9a612de',
message_type: 'text'
},
sender: {
sender_id: [Object],
sender_type: 'user',
tenant_key: '12f850fbf0cfd75e'
}
}
}
现在的数据结构长这样子了
data = { schema: '2.0', header: { event_id: 'af4a343963a28fe08545a221023cacfd', token: '', create_time: '1644918262332', event_type: 'im.message.receive_v1', tenant_key: 'xxxxxxxxxxxxxx', app_id: 'cli_xxxxxx' }, event: { message: { chat_id: 'oc_adbbd6f6dc162168e50a59831550f68c', chat_type: 'p2p', content: '{"text":"ping"}', create_time: '1644918262067', message_id: 'om_e83fc19f8730cae69df6d9a4b9a612de', message_type: 'text' }, sender: { sender_id: [Object], sender_type: 'user', tenant_key: '12f850fbf0cfd75e' } } }
你看一下你的 sender_id: [Object], 具体是什么内容。秘密都在 Object .
user = new User(
data.event.sender.sender_id.open_id,
name: data.event.sender.sender_id.open_id,
room: data.event.message.chat_id
)
现在是这个样子的,好像没有user那个结构体了,是2.0的结构了,现在还多了一个token
用 0.2.4 npm 应该就可以了。
用 0.2.4 npm 应该就可以了。
确实是没有上面的错误了,但是出了另 一个错误,回不了消息
我重新开一个issue,这个关了吧
hubot-lark:
v0.2.3
报错信息
接收消息文档 链接
看官方消息结构示例未提供
data.event.user
属性,猜测 lark 更新过版本,hubot-lark 没有适配。请问 owner 有没有更新意向?