Giter Site home page Giter Site logo

remote-kakao / core Goto Github PK

View Code? Open in Web Editor NEW
107.0 4.0 8.0 554 KB

A Node.js module to make unofficial KakaoTalk bots (within the legal scope).

Home Page: https://npmjs.com/package/@remote-kakao/core

License: MIT License

TypeScript 100.00%
remote-kakao module node-module nodejs-module node-modules nodejs-modules npm-module npm-package npm-modules kakao

core's Introduction

remote-kakao banner

remote-kakao (alpha)

Discord Server

About

remote-kakao is a Node.js module that makes it easier to create unofficial KakaoTalk bots by bridging MessengerBot and Node.js, over UDP.

Requirements

Client

You have to create a new bot in MessengerBot, and paste the client code into the new bot`s code. Then change the values of the config object on top of the file.

Example

import { UDPServer } from "@remote-kakao/core";

const prefix = ">";
const server = new UDPServer({ serviceName: "Example Service" });

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.replyText("Pong!");
    msg.replyText(`${Date.now() - timestamp}ms`);
  }
});

server.start();

Plugins

@remote-kakao/rkeval-plugin

core's People

Contributors

thoratica avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

core's Issues

구조 변경 및 아이디어 제안

안녕하세요 좋은 라이브러리 개발해주셔서 잘 사용하고 있습니다.

다만 사용간에 불편한 점을 몇가지 발견하여 의견 남깁니다.

  1. TCP 연결 지원
    일부 네트워크 환경에서는 UDP 데이터그램의 수신이 불가하거나, 제한되는 경우가 많습니다.
    그리고 전송해야 하는 데이터가 영상 스트리밍과 같이 실시간성과 비신뢰성의 특징을 가지기보다는
    메시지 이벤트 전송이라는 신뢰성이 필요한 쪽에 더 가깝고, UDP로 얻을 수 있는 시간상 이익이 TCP보다 크지 않기 때문에
    TCP 소켓 서버로 구현하는 것이 더 좋을 것 같습니다.
    또한 이 경우 메신저봇 코드쪽에서 전송 실패한 메시지들을 큐에 가지고 있다가. 일정 시간 간격으로 재전송하는 로직을 추가하여 메시지 유실에 대한 보완도 가능해 보입니다.

  2. 메신저봇 코드 간소화
    메신저봇의 구조를 잘 알지는 못하지만 아마 자바에 내장된 자바스크립트 엔진(Nashorn, Rhino)이나 자바 기반 스크립트 엔진(Rhino)을 사용하는 것으로 생각됩니다.
    따라서 자바 API에 접근이 전부 되는 것 같은데 이 점을 이용해서 GitHub의 Raw source를 HTTP Get으로 로딩한 뒤 eval하는 방식을 사용하면 업데이트의 편의성도 챙기고, 메신저봇측 코드를 간소화할 수 있을 것 같습니다.

  3. GitHub wiki 또는 README.md에 메신저봇 코드 가이드 포함
    외부 사이트(네이버 카페 등)을 이용하지 않고 이 Repository에서 개발에 관한 모든 정보를 얻을 수 있으면 좋겠습니다.

  4. reply 외의 메시지 전송 수단 추가
    보통 메신저 봇(Discord, IRC, Telegram 등의 봇)의 용례는 명령에 대한 응답만 있는 것이 아니라, 봇이 외부 데이터 소스에서 발생한 이벤트 등을 먼저 제공해주는 방식도 존재합니다. 이런 봇을 만들기 위한 지원이 부족합니다.
    예를 들어 봇이 꺼졌다가 재시작된 경우, 이전의 채팅방을 기억하여 먼저 메시지를 보내는 것이 보통의 방법으로는 가능하지 않습니다.
    저는 Message를 serialize/deserialize 하는 커스텀 로직을 만들어서 해결할 수 있었는데, 라이브러리 단에서 조금 더 깔끔한 방법으로 지원했으면 좋겠습니다.

  • 메시지를 직렬화 가능하게 만드는 방법
  • {room, address, port}를 Info 클래스로 모델링하고 server 클래스에서 server.send(info:Info, msg:string)과 같은 메소드를 만드는 방법
    위와 같은 방법들이 있을 것 같습니다.
  1. JSDoc 지원
    구조에 대한 설명이 조금 더 자세했으면 좋겠습니다. 추가적으로 server.on('ready', ) 이벤트에 대한 설명이 README.md 등에 추가되면 좋을 것 같습니다.

안녕하세요 기능 제안입니다

안녕하세요 리모트 카카오덕분에 편하게 카카오톡 주식 챗봇을 만들어 사용중입니다.

근데 딱 1가지 아쉬운점이 있습니다 채팅세션이 대략 300개정도 밖에 유지 되지 않는다는것입니다.

예를 들어 아침 9시마다 채팅방에 특정글을 올려주고싶은데 어떤방( 최근 채팅 300개 이내에 포함된 방)은 전송이되고 어떤 방은 undefined 오류가 뜨면서 전송되지 않습니다 한번이라도 채팅을 했던방은 세션을 유지시켜주는 기능이 있었으면 좋겠습니다...

API 혼선이 있는 거 같습니다..?

현재 client code 를 보면 API2 에서 만 작동하는 onMessage 와 Legacy API 에서 만 작동하는 onNotificationPosted 를 사용하는 데 이 경우에 사용이 불가능합니다.

아직 어떻게 해야할 지를 모르겠습니다..

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.