This is a playground to test JavaScript. It runs a completely standard copy of Node.js on a virtual server created just for you. Every one of npm’s 300,000+ packages are pre-installed, so try it out:
// Let's show where the Internation Space Station currently is.
console.log("Let's see where the ISS is with Node " + process.version);
// We can use any package from NPM since they are all built in.
var getJSON = require("async-get-json");
// And we can use ES7 async/await to pull the ISS's position from the open API.
var result = await getJSON("http://api.open-notify.org/iss-now.json");
// RunKit will automatically display the last statement and try to find its best representation:
result.iss_position;
const TelegramBot=require("node-telegram-bot-api");
const token="6233188081:AAFJ9tSA94D8XfupRwACMzl7gei7Nz6FzHM";
const bot = new TelegramBot(token, {polling: true});
// Matches "/echo [whatever]"
bot.onText(/\/echo (.+)/, (msg, match) => {
// 'msg' is the received Message from Telegram
// 'match' is the result of executing the regexp above on the text content
// of the message
const chatId = msg.chat.id;
const resp = match[1]; // the captured "whatever"
// send back the matched "whatever" to the chat
bot.sendMessage(chatId, resp);
});
// Listen for any kind of message. There are different kinds of
// messages.
bot.on('message', (msg) => {
const chatId = msg.chat.id;
// send a message to the chat acknowledging receipt of their message
bot.sendMessage(chatId, 'Received your message');
});
bot.on('message', (msg) => {
var Hi = "hi";
if (msg.text.toString().toLowerCase().indexOf(Hi) === 0) {
bot.sendMessage(msg.chat.id, "Welcome to Bisman Dear " + msg.from.first_name);
}
var bye = "yes";
if (msg.text.toString().toLowerCase().includes(bye)) {
bot.sendMessage(msg.chat.id, " Install the App using the following link: https://play.google.com/store/apps/details?id=com.bisma.onlineshop&hl=en-gb&gl=et ");
}
var sendpic = "sendpic";
if (msg.text.toString().toLowerCase().includes(sendpic)) {
bot.sendPhoto(msg.chat.id, " https://www.somesite.com/image.jpg");
}
});
bot.onText(/\/join/, (msg) => {
bot.sendMessage(msg.chat.id, "Welcome", {
"reply_markup": {
"keyboard": [["view bisman App", "Rate Bisman App"], ["Share With Friends"], ["Reward"]]
}
});
bot.onText(/\/sendpic/, (msg) => {
bot.sendPhoto(msg.chat.id,"https://www.somesite.com/image.jpg" );
});
});