mdibaiee / node-telegram-api

A simple API to create and control Telegram bots
MIT License
121 stars 21 forks source link

No polling, just sending messages? #25

Closed derN3rd closed 8 years ago

derN3rd commented 8 years ago

Hey there,

I want to use the node-telegram-api for sending notifications from my admin panel (of a nodejs project). I've read trough all of the docs but I couldn't find out the most efficient way to send messages without polling all time.

Should I use code like

var sendNotification = function(message){
    bot.start();
    var notification = new Message().text(message).to(adminChatID);
    bot.send(notification);
    bot.stop();
}

or is there a way to start the bot at the beginning and just stop polling updates? Or can I simply send messages without starting?

Thanks in advance

mdibaiee commented 8 years ago

Hey there!

I think it should work fine if you don't run bot.start(), bot.start essentially starts polling and nothing else.