Global Configuration of Chatbot

#1

Hi,
I have tried this Example for a Global Configuration.

`functionGlobalContext: { 
//Preformatted text
// os:require('os'), 
// jfive:require("johnny-five"), 
// j5board:require("johnny-five").Board({repl:false})
 telegram: { 'MyBot': {
 token: '1234567:my-token', 
 polling: 1000,
 parseMode: 'none',
 authorizedUsernames: 444
 } 
} 
},`

And this is Now my functionGlobalConfiguration. What am I doing wrong so that the Username does not appear in the Configuration of the Bot in the Chatbot

Thnaks a lot!

0 Likes

#2

The forum has messed up the formatting of your paste. Edit the post and insert a line containing three backtick characters before the paste and another such line after it.

0 Likes

#3

With a quick look, it looks like you are missing a slash at the beginning
functionGlobalContext: { /Preformatted text
should probably be:
'functionGlobalContext: {//Preformatted text'

and you have a comma at the end of the last option:
authorizedUsernames: 444, } } },
should probably be:
authorizedUsernames: 444 } } },

what kind of error are you getting?
Waht bot are you trying to connect to?

0 Likes

#4

As a Error at the start I get:

node-telegram-bot-api deprecated Automatic enabling of cancellation of promises is deprecated.
In the future, you will have to enable it yourself.
See https://github.com/yagop/node-telegram-bot-api/issues/319. module.js:653:30

And what do you mean with the kind of Bot?

0 Likes

#5

Ok it works but is there a way to inject something there from the flow?

0 Likes

#6

When you say '...is there a way to inject something there from the flow?' do you mean you want to send a message to telegram?
If so, have you looked at the nodes that you now have once you installed node-red-contrib-chatbot?

0 Likes

#7

No not that I have a text input wich adds UserIds to a Array and I want that array in the configuration so that I can Add UserIds to the Telegram Bot

0 Likes

#8

Unless you need something that only chatbot provides, personally I recommend using the other Telegram node, it is a lot easier to comprehend and work with. I've always had issues with Chatbot.

0 Likes

#9

But have you an Example how this will work for the other node?

0 Likes

#10

Or could I read files in the settings.js?
And if yes which kind of files?

0 Likes

#11

I have a fairly extensive example I think on the flows site so just search there for telegram.

This is the node you want:

And this is my example:

https://flows.nodered.org/flow/c092bc6bcd4131a59cab52e82afbc7be

0 Likes