Telegram bot using Node.js finishing sending the message

Asked

Viewed 351 times

1

Hello, I’m doing a service to warn me of possible errors that may occur on my server,my doubt is , after I send the message how I finish the execution or the way this presenting in the image below is normal ? For to finish the task I have to give a Ctrl + c

code:

var util = require('util');

var TelegramBot = require('node-telegram-bot-api');

var token = '237907874:AAG8hK1lPWi1WRlqQT2';

var bot = new TelegramBot(token, {polling: true});

var millisecondsToWait = 5000;


robot = {
    "alert" : function teste(message) {
        var toId = '-103822200';
        var resp = util.format('Alerta: %s', message);
        bot.sendMessage(toId, resp);


    }
}

robot.alert(process.argv[2]);

cmd executed as follows

    node.exe bot.js 'texto que quero enviar'

Tela do CMD - Apos envio da msg

have already used the codes , Exit() , exitprocess() , close() - Unsuccessful

1 answer

0

Hi, have you tried using the command:

process.exit(1);
  • Consider adding a brief explanation to enrich the answer.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.