Git Product home page Git Product logo

bot-messenger's Introduction

BOT Template

What is it?

Code ini merupakan template sederhana yang bisa digunakan untuk membuat Bot. Saat ini disediakan contoh untuk platform:

  • Facebook Messenger
  • Telegram.

Contoh yang disediakan hanya melakukan reply echo dari pesan yang dikirim oleh user.

Code disini merupakan basic code yang digunakan oleh Carik Bot, BOT Like Humans yang dibangun dengan menggunakan bahasa Pascal.

Why use it?

Ringan Tanpa Beban

BOT ini dibuat dengan sederhana, simple dan ringan. BOT ini merupakan binary application sehingga diharapkan akan lebih cepat dan ringan.

Kompatibel dengan shared hosting umumnya.

Untuk penggunaan custom, cukup dibutuhkan instalasi Apache Web Server regular.

How to use it

Requirements

Development

Gunakan Lazarus, buka file "telegram.lpi" dan compile file tersebut.

Akan terbentuk file binary di 'public_html/ai/telegram.bin'

Telegram

Buka file project dari Lazarus (atau code editor lainnya), akan dijumpai baris-baris code seperti berikut.

procedure TMainModule.Post;
var
  messageText, replyText: string;
begin
  TELEGRAM.RequestContent := Request.Content;
  TELEGRAM.Token := Config['telegram/token'];
  MessageID := TELEGRAM.MessageID;
  messageText := Telegram.Text;

  //-- your code here

  replyText := 'ECHO: ' + messageText;




  //-- send response
  TELEGRAM.SendMessage(TELEGRAM.ChatID, replyText);
  Response.Content := 'OK';
  if Config['systems/debug'] then
    Response.Content := TELEGRAM.ResultText;
end;    

Template ini hanya melakukan reply echo dari message yang dikirim oleh user. Silakan dikembangkan sesuai keperluan.

Instalasi

Compile dari Command-Line

SimpleBOT$ cd source/
source$ ./clean.sh 
source$ ./build.sh
.
.
telegram.lpr(13,124)
Assembling (pipe) lib/telegram.s
Compiling resource lib/telegram.or
Linking ../public_html/ai/telegram.bin
.
.
source$ _

Custom Build

untuk konfigurasi custom, misal untuk perubahan path tempat library berada, bisa dilakukan dengan melakukan modifikasi di file extra.cfg.

Konfigurasi

Buka file "public_html/config/config.json", akan dijumpai seperti ini

{
  .
  .
  "telegram": {
  "token": "your_telegram_token"
  },
  "facebook": {
  "token": "your_facebook_token"
  }
}

tuliskan token bot telegram atau facebook anda di dalam file config.json tersebut.

NLP

Agar lebih menarik, anda bisa melengkapi Bot anda dengan NLP (Natural Language Processing). Banyak tersedia vendor NLP yang bisa digunakan. Tetapi jika anda mencari NLP simple, ringan dan cepat, anda bisa menggunakan NLP dari SimpleAI.

BOT Sequence Diagram

Berikut ini sequence diagram sederhana dari bagaimana Bot bekerja, mulai dari user mengirim pesan dan menerima jawaban dari Bot.

User->Messenger: Send message
Messenger->BOT: Send message to Bot 
Note right of BOT: Your Process 
BOT-->Messenger: Send Reply to Messenger 
Messenger-->User:Send Reply to User

Sequence Diagram

bot-messenger's People

Contributors

luridarmawan avatar

Stargazers

Eduardo avatar

Forkers

loop80

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.