informatica:programacion:python:modulos:python-telegram-bot
¡Esta es una revisión vieja del documento!
Tabla de Contenidos
Python: python-telegram-bot
Módulo para interactuar con la API de Telegram a través de Python.
Mensajes
Los mensajes que se reciben mediante Telegram, este módulo los encapsula en un objeto de tipo telegram.Message. Dependiendo del tipo de mensaje que se trate, tendrá una serie de atributos y métodos.
Mensajes
{
'message_id': 1001,
'date': 1613301503,
'chat': {
'id': 123456,
'type': 'private',
'username': 'foo',
'first_name': 'bar'
},
'text': 'ping',
'entities': [],
'caption_entities': [],
'photo': [],
'new_chat_members': [],
'new_chat_photo': [],
'delete_chat_photo': False,
'group_chat_created': False,
'supergroup_chat_created': False,
'channel_chat_created': False,
'from': {
'id': 123456,
'first_name': 'bar',
'is_bot': False,
'username': 'foo',
'language_code': 'es'
}
}
Fotos
La estructura de un mensaje:
{
'message_id': 1000,
'date': 1613300902,
'chat': {
'id': 123456,
'type': 'private',
'username': 'foo',
'first_name': 'bar'
},
'entities': [],
'caption_entities': [],
'photo': [
{
'file_id': 'AgACAgQAAxkDAAID6GApBKZS-8S0nLV5RG6bEw7xp3__AAINrDEbC8BMUVM-v_GTUAW1H7RJJ10AAwEAAwIAA20AA99BBQABHgQ',
'file_unique_id': 'AQADH7RJJ10AA99BBQAB',
'width': 320,
'height': 180,
'file_size': 4643
},
{
'file_id': 'AgACAgQAAxkDAAID6GApBKZS-8S0nLV5RG6bEw7xp3__AAINrDEbC8BMUVM-v_GTUAW1H7RJJ10AAwEAAwIAA3gAA-BBBQABHgQ',
'file_unique_id': 'AQADH7RJJ10AA-BBBQAB',
'width': 800,
'height': 451,
'file_size': 17870
},
{
'file_id': 'AgACAgQAAxkDAAID6GApBKZS-8S0nLV5RG6bEw7xp3__AAINrDEbC8BMUVM-v_GTUAW1H7RJJ10AAwEAAwIAA3kAA-FBBQABHgQ',
'file_unique_id': 'AQADH7RJJ10AA-FBBQAB',
'width': 1280,
'height': 721,
'file_size': 35816
},
{
'file_id': 'AgACAgQAAxkDAAID6GApBKZS-8S0nLV5RG6bEw7xp3__AAINrDEbC8BMUVM-v_GTUAW1H7RJJ10AAwEAAwIAA3cAA-JBBQABHgQ',
'file_unique_id': 'AQADH7RJJ10AA-JBBQAB',
'width': 1984,
'height': 1117,
'file_size': 61820
}
],
'new_chat_members': [],
'new_chat_photo': [],
'delete_chat_photo': False,
'group_chat_created': False,
'supergroup_chat_created': False,
'channel_chat_created': False,
'from': {
'id': 654321,
'first_name': 'unbot',
'is_bot': True,
'username': 'unbot'
}
}
informatica/programacion/python/modulos/python-telegram-bot.1613303369.txt.gz · Última modificación: por tempwin
