bot telegram using node.js ending the message sending

0

Hello, I am doing a service to alert me of possible errors that may occur on my server, my doubt is, after I send the message how do I end the execution or the way it is presented in the image below is normal? end 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]);

In the cmd I execute as follows

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

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

    
asked by anonymous 17.06.2016 / 15:39

1 answer

0

Hello, have you tried using the command:

process.exit(1);
    
22.07.2016 / 19:06