edisonchee / slimbot

Telegram Bot API for Node.js
MIT License
223 stars 37 forks source link

Error: Please provide a Telegram Bot Token when instantiating #7

Closed Joni4Games closed 7 years ago

Joni4Games commented 7 years ago

So.. I've added the first sample code. I've requested the Telegram Bot API Key via the BotFather and added it in there. Now I get the error: Error: Please provide a Telegram Bot Token when instantiating

My Key looks like:

123456789:Ab1Cd2Ef3Gh4Ij5Kl6Mn7Op8Qr9

I'm using Node v8.1.2

Nothing found in the web 1 2 PS: Anyway you whole project looks good

Joni4Games commented 7 years ago

Worked by simply removing the "process.env". 3

d-a-w commented 6 years ago

Worked by removing the "process.env". Thank u @Joni4Games

edisonchee commented 6 years ago

Sorry for not following up on this. process.env is for environment variables that are loaded into your shell, usually found in ~/.profile.

An example inside your ~/.profile would be:

export TELEGRAM_BOT_TOKEN='token string'

And you'd use it in Node like this:

const token = process.env['TELEGRAM_BOT_TOKEN']