This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Biro Administrasi Umum - Universatas Komputer Indonesia</title> | |
<script src="public/script/angular.min.js"></script> | |
<link rel="stylesheet" href="public/style/style.css"> | |
<style>@import 'https://fonts.googleapis.com/css?family=Open+Sans';</style> | |
<script type="text/javascript" src="js/suara.js"></script> | |
<script type="text/javascript" src="js/socket.io-1.4.5.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require("express"); | |
require("dotenv").config(); | |
const { middleware, Client } = require("@line/bot-sdk"); | |
const translate = require("translation-google"); | |
const app = express(); | |
const config = { | |
channelAccessToken: 'channelAccessToken', | |
channelSecret: 'channelSecret', | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.listen(process.env.PORT || 3000, console.log("Chatbot Runningg....")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.post("/webhook", middleware(config), async (req, res) => { | |
try { | |
const { type, replyToken, message } = req.body.events[0]; | |
if (type === "message") { | |
const result = await translate(message.text, { | |
from: "ar", | |
to: "id", | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const config = { | |
channelAccessToken: 'access_token', | |
channelSecret: 'channel_secret', | |
}; | |
const client = new Client(config); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require("express"); | |
const { middleware, Client } = require("@line/bot-sdk"); | |
const translate = require("translation-google"); | |
const app = express(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Telegram = require('node-telegram-bot-api'); | |
const dbot = require('dbot-js') | |
const token = 'TELEGRAM_TOKEN' | |
const ksatria_bot = new TelegramBot(token, { polling: true }); | |
ksatria_bot.on('message', function(msg) { | |
var chatId = msg.chat.id; | |
var message = msg.text.toString() | |