storycraft/node-kakao

로그인시 'Session closed before response' 발생

williameom5678 opened this issue · 1 comments

node --unhandled-rejections=strict --trace-warnings index.js
D:\loco\node_modules\node-kakao\dist\network\request-session.js:95
throw new Error(Session closed before response #${req.header.id});
^

Error: Session closed before response #2
at LocoSession.request (D:\loco\node_modules\node-kakao\dist\network\request-session.js:95:23)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async TalkClientSession.login (D:\loco\node_modules\node-kakao\dist\talk\client\talk-client-session.js:45:30)
at async TalkClient.login (D:\loco\node_modules\node-kakao\dist\talk\client\index.js:88:30)

==소스코드==

const LOCO = require('node-kakao');
const fs = require('fs');
const cp = require('child_process');

//stable(3.1)
const client = new LOCO.TalkClient('asdfing','UUID==');
client.login("ID", "BeeBun");

client.on('message', (chat) => {
let userInfo = chat.Channel.getUserInfo(chat.Sender);
if (!userInfo) return;

if (chat.Type === LOCO.ChatType.Search) {
    let attachment = chat.AttachmentList[0];

    chat.replyText(`${userInfo.Nickname}님이 샵 검색 전송 ${attachment.Question}. 리다이렉트 경로: ${attachment.RedirectURL}`);
}

if (chat.Text === '$안녕하세요') {
    chat.replyText('안녕하세요 '); // 일반 채팅
    chat.replyText('안녕하세요 ', new LOCO.ChatMention(userInfo)); // Ex) 안녕하세요 @storycraft
    chat.Channel.sendTemplate(new LOCO.AttachmentTemplate(LOCO.ReplyAttachment.fromChat(chat), '안녕하세요 '));
}

console.log(chat.Sender.id+" "+userInfo.Nickname+":"+chat.Text+"\n"+chat.attachmentList.map(v=>v.$).join("\n") );
blankFunc(chat)

});

해당 코드는 v3에서만 작동하는 코드로 보입니다.
NodeKakao v3은 더이상 지원되지 않습니다.
examples 폴더를 참고하여 코드를 작성해주세요