UNPKG

live-bot

Version:

With this module you can make an online bot to response the messages like an telegram-bot 🤖

53 lines (41 loc) • 1.39 kB
# Live-bot With this module you can make an online bot to response the messages like an telegram-bot 🤖 # Example Of Live-bot ``` chat.on('how are you','thanks') ``` # Install ``` const express = require('express'); const app = express(); const chat = require('live-chat'); const bodyParser = require('body-parser') //install the 👆 modules //then set the main server variable name to this 👇 global.sername = app; //then if you want to tell the user when a error happend try this 👇 //important to use this in the end of your code chat.notfound('Sorry ot found !!') ``` # Usage you have point the answers to your code like an telegram bot for example on this code 👇 when user send hello the bot answer Hi ``` chat.on('Hello','hi') ``` <img src="https://cdn.pbrd.co/images/HJlltrC.jpg"/> then response <img src="https://cdn.pbrd.co/images/HJllVQc.jpg"/> # How to work with this (Important)!!! if you want recieve message from client you have send the message on the Address ** /Live-Bot/Api/ ** and your sended data should be in this format 👇 ``` json({ data : user input }) ``` Then server response your request white this 👇 format ``` json({text : response text }) ``` # Examples and more for more examples and html template for live chat see my github or my website http://sina-farhadi.ir