rapierorg / telegram-bot-swift

Telegram Bot SDK for Swift (unofficial)
https://github.com/rapierorg/telegram-bot-swift/wiki
Apache License 2.0
374 stars 63 forks source link

./build/debug not working #4

Closed simonnarang closed 8 years ago

simonnarang commented 8 years ago

Sorry to give you another issue...

-----
ERROR
-----
Please create either:
  - an environment variable named 347784237:QAElES4HpRi36MxR-wDT6-hYWTDhp4fgKAMY
  - a file named 347784237:QAElES4HpRi36MxR-wDT6-hYWTDhp4fgKAMY
containing your bot's token.

I'm not quite sure what to do, I followed the instructions in the wiki and swift build worked fine, I got this error after running ./build/debug/Fun-Bot

zmeyc commented 8 years ago

No problem, feedback is very welcome. :)

I think you've pasted the token instead of environment variable name. I.e. if the code contains: ` let token = readToken("MY_BOT_TOKEN") the bot will try to read the token from MY_BOT_TOKEN environment variable or from a file named MY_BOT_TOKEN.

So, add export MY_BOT_TOKEN="347784237.....etc" to ~/.profile

then reload the environment by calling source ~/.profile

If you're using Xcode, add it to Environment variables in Xcode instead.

Optionally, create a file named MY_BOT_TOKEN in the directory from which the bot is started and put the token into the file.

You'll probably want to regenerate the bot's token now as it's been exposed.

simonnarang commented 8 years ago

Ok thanks... 😅 I assumed that the export command just changed that bit of code in main.swift