Created
April 17, 2017 13:09
-
-
Save Hoi15A/d54066708ae82114588a7b9a8ac99e5c to your computer and use it in GitHub Desktop.
Quick NodeJS echo bot
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
var TelegramBot = require('node-telegram-bot-api'); | |
var token = "abcdefghijk:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; | |
bot = new TelegramBot(token, {polling: true}); | |
bot.onText(/\/echo (.+)/, function(msg, match) { | |
var chatId = msg.chat.id; | |
var resp = match[1]; | |
bot.sendMessage(chatId, resp, {"parse_mode":"Markdown"}); | |
}); |
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
{ | |
"name": "echo-bot", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"dependencies": { | |
"node-telegram-bot-api": "^0.24.0" | |
}, | |
"devDependencies": {}, | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1", | |
"start": "node index.js" | |
}, | |
"author": "Hoi15A", | |
"license": "GPL-3.0", | |
"homepage": "https://github.com/Hoi15A" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment