Open painhardcore opened 9 years ago
You can check existence with
if "text" in msg:
I will introduce real objects for messages and events soon, so you can assume existence.
The Message
object's text attribute then might be None
, but will exist.
The progress can be watched in the development branch.
This is happening in the developing branch.
Crush becouse of image recieved. Python3. Traceback (most recent call last): File "/home/administrator/tgbot/tgbotenv/lib/python3.4/site-packages/DictObject-0.1.1-py3.4.egg/DictObject/init.py", line 434, in getattr AttributeError: 'DictObject' object has no attribute 'text'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/home/administrator/tgbot/tgbotenv/lib/python3.4/site-packages/DictObject-0.1.1-py3.4.egg/DictObject/init.py", line 441, in getattr KeyError: 'text'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "tgbotmain.py", line 54, in
main() # executing main function # Last command of file (so everything needed is already loaded above)
File "tgbotmain.py", line 16, in main
receiver.message(example_function(sender)) # now it will call the example_function and yield the new messages.
File "/home/administrator/tgbot/tgbotenv/lib/python3.4/site-packages/pytg-0.4.1b0-py3.4.egg/pytg/utils.py", line 29, in start
File "/home/administrator/tgbot/tgbotenv/lib/python3.4/site-packages/pytg-0.4.1b0-py3.4.egg/pytg/receiver.py", line 217, in message
File "tgbotmain.py", line 36, in example_function
if msg.text is not str: # we have media instead.
File "/home/administrator/tgbot/tgbotenv/lib/python3.4/site-packages/DictObject-0.1.1-py3.4.egg/DictObject/init.py", line 455, in getattr
AttributeError: text
Terminating currently sending request.