Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node-red #7

Closed
davidebene opened this issue Jul 7, 2015 · 3 comments
Closed

Node-red #7

davidebene opened this issue Jul 7, 2015 · 3 comments

Comments

@davidebene
Copy link

@davidebene davidebene commented Jul 7, 2015

Hi. Has anyone tested the use of the module within node-red?
I declared globally the module within the settings.js of node-red, and I put the following sample code in a function node:

var TelegramBot = context.global.telegram;
var token = 'my-bot-token';
var bot = new TelegramBot(token, {polling: true});
bot.on('message', function (msg) {
var chatId = msg.chat.id;
var testMsg = "test message";
bot.sendMessage(chatId, testMsg, {caption: "I'm a bot!"});
});

But the debugger gives me the following error:

Unhandled rejection Error: 409 {"ok":false,"error_code":409,"description":"Error: Conflict: terminated by other long poll or webhook"}
at /usr/local/lib/node_modules/node-red/node_modules/node-telegram-bot-api/src/telegram.js:131:15
at tryCatcher (/usr/local/lib/node_modules/node-red/node_modules/node-telegram-bot-api/node_modules/bluebird/js/main/util.js:24:31)
at Promise._settlePromiseFromHandler (/usr/local/lib/node_modules/node-red/node_modules/node-telegram-bot-api/node_modules/bluebird/js/main/promise.js:489:31)
at Promise._settlePromiseAt (/usr/local/lib/node_modules/node-red/node_modules/node-telegram-bot-api/node_modules/bluebird/js/main/promise.js:565:18)
at Promise._settlePromises (/usr/local/lib/node_modules/node-red/node_modules/node-telegram-bot-api/node_modules/bluebird/js/main/promise.js:681:14)
at Async._drainQueue (/usr/local/lib/node_modules/node-red/node_modules/node-telegram-bot-api/node_modules/bluebird/js/main/async.js:123:16)
at Async._drainQueues (/usr/local/lib/node_modules/node-red/node_modules/node-telegram-bot-api/node_modules/bluebird/js/main/async.js:133:10)
at Async.drainQueues (/usr/local/lib/node_modules/node-red/node_modules/node-telegram-bot-api/node_modules/bluebird/js/main/async.js:15:14)
at process._tickCallback (node.js:442:13)

Thanks!

@mahrens917
Copy link

@mahrens917 mahrens917 commented Aug 14, 2015

I am using a Python API to telegram and occasionally receive the same error, 409.

@Waterloo
Copy link
Contributor

@Waterloo Waterloo commented Sep 3, 2015

This happens when to program with same token polls the telegram bots api. you can run only one bot with same token at the same time.

@litinskii
Copy link
Contributor

@litinskii litinskii commented Jun 8, 2016

@davidebene This was done by this merge #117

@yagop yagop closed this Jun 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.