remote-kakao is a Node.js module to make unofficial (& legal) KakaoTalk bots by connecting MessengerBot with Node.js, using UDP.
- Node.js v18+ (Recommended)
- Android smartphone w/ KakaoTalk & MessengerBot
- Devoted love toward cats
A simple guide for this module is posted in the NAVER Cafe 카카오톡 봇 커뮤니티 (KakaoTalk Bot Community), in Korean.
import { Server } from '@remote-kakao/core';
const prefix = '>';
const server = new Server();
server.on('message', async (msg) => {
if (!msg.content.startsWith(prefix)) return;
const args = msg.content.split(' ');
const cmd = args.shift()?.slice(prefix.length);
if (cmd === 'ping') {
/*
this command's result is the ping between Node.js and MessengerBot,
not between MessengerBot and the KakaoTalk server.
*/
const timestamp = Date.now();
await msg.reply('Pong!');
msg.reply(`${Date.now() - timestamp}ms`);
}
});
server.start(3000);