-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Make tests more generic #16
Comments
I want to learn how the module handles the declared commands assigned by botfather and be able to route them to the desired action. |
Hi @Jzarecta, it doesn't. Bot API doesn't provide methods to get declared commands, you have to create your own handlers parsing text messages when polling updates from their servers. Have a look at examples folder from this repository, hopefully it will be a good start. Feel free to reach out me for any further questions. |
Actually the example folder didn't gave me much insight. Perhaps I didnt read it right, but I was able to declare updates on the api, but that was it, the rest was a lonely def that supposely was the command to use, but it didnt work as expected. I had the following code: def p(value):
#Buscamos el API
bitapeso=urllib2.urlopen("http://bitapeso.com/json/").read()
jobject = json.loads(mxn, 'utf-8')
val=jobject['mxn']
if val == None:
peso = float(val)
else:
peso = float(val) * value
return peso.strip() Maybe I miss something, or a lot. |
We could get the token from an env-var |
are these tests https://travis-ci.org/leandrotoledo/python-telegram-bot/jobs/87105084 from #87 failing due to a testing token issue? |
there are a lot of hardcoded things, right? message/file ids, message contents |
The way it's writen atm I'm the only one who can see the bot interation (as it sends messages to chat_id corresponding my telegram user). @jh0ker has suggested a public channel so anyone planning to submit a feature can see the results for their thats. In order to accomplish that we would need to change some tests and avoid hardcoding as @franciscod mentioned. I'll spend some time on it this week. |
Seems like the amount of efforts to have the same result does justify this rework right now. |
The way it is right now it will fail if not ToledosPalaceBot, if more generic Travis could run all the tests when pull requesting, etc.
The text was updated successfully, but these errors were encountered: