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

[TelegramClass.connect] Invalid token - typo bug in code #5120

Closed
b4p3p opened this issue Sep 2, 2016 · 7 comments
Closed

[TelegramClass.connect] Invalid token - typo bug in code #5120

b4p3p opened this issue Sep 2, 2016 · 7 comments

Comments

@b4p3p
Copy link

b4p3p commented Sep 2, 2016

with last commit i have an issue with TelegramTask

telegram_token is in self.config, not in self.bot.config.telegram_token

I modified
self._tbot = telegram.Bot(self.bot.config.telegram_token)
in
self._tbot = telegram.Bot(self.config.get('telegram_token'))

anyway, please add an exception message in function like this:

try:
   self.update_id = self._tbot.getUpdates()[0].update_id
except IndexError:
   self.update_id = None
   logger.error("can't create a telegram bot")

and a "seat belt"

if self.tbot:
   self.tbot.sendMessage(chat_id=master, parse_mode='Markdown', text=msg)
else:
   print "telegram in null?!!?"
@avexus
Copy link

avexus commented Sep 2, 2016

I just downloaded Telegram for my android phone, How can i find the token?
Thank you! first time using this.

@b4p3p
Copy link
Author

b4p3p commented Sep 3, 2016

  1. Here for create bot and get telegram_token
    https://core.telegram.org/bots#6-botfather
  2. Add new bot in telegram chat
  3. Ask a telegram your chat_id (aka master in config.json)
    https://api.telegram.org/bot/getUpdates
  4. Set master and token_id in config.json
  5. if you wont add a custom methods for bot, add these in telegram_handler.py like this:
...
elif event == 'bot_start':
   msg = "ok...stay sitting. I'm going to play"
...

P.S.
use a telegram web ( https://web.telegram.org ) , is more user friendly

P.P.S
Sorry for my bad english

good luck friend! :D

@avexus
Copy link

avexus commented Sep 3, 2016

Now I can send message to this bot, but when bot catches a pokemon, the bot does not send message to my telegram.

the pokemon I caught has a iv > 0.3.

my conf:

      "alert_catch": {
        "all": {"operator": "or", "cp": 10, "iv": 0.1},
        "Snorlax": {"operator": "or", "cp": 900, "iv": 0.9}
      }

@DBa2016
Copy link
Contributor

DBa2016 commented Sep 3, 2016

you need to set "master" to either a numeric value (-> I don't know how to find out the correct value...), or to "@username" (which starts to send notifications after you sent the initial "/info" to the bot).

If this does not work still, post your config (use pastebin or similar, please) and I will look into this.

@Gobberwart
Copy link
Contributor

To get the numeric value, just send a message to the bot and it will write to the log output something like "message received from username (userid): messagetext".

You can also send a message to @get_id_bot in Telegram and it will tell you your id.

@brkskn28
Copy link

para çekme işlemi yapacağım ama üyelığımı onaylamam gerekıyormus canlı destek cevap vermıyor nasıl yapabılırım

@sameer043
Copy link

Token please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants