Skip to content

Instantly share code, notes, and snippets.

@Hoi15A
Created April 17, 2017 13:09
Show Gist options
  • Save Hoi15A/d54066708ae82114588a7b9a8ac99e5c to your computer and use it in GitHub Desktop.
Save Hoi15A/d54066708ae82114588a7b9a8ac99e5c to your computer and use it in GitHub Desktop.
Quick NodeJS echo bot
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"});
});
{
"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