{"action":"opened","issue":{"url":"https://api.github.com/repos/henriquebastos/autonobot/issues/5","repository_url":"https://api.github.com/repos/henriquebastos/autonobot","labels_url":"https://api.github.com/repos/henriquebastos/autonobot/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/henriquebastos/autonobot/issues/5/comments","events_url":"https://api.github.com/repos/henriquebastos/autonobot/issues/5/events","html_url":"https://github.com/henriquebastos/autonobot/issues/5","id":279588808,"number":5,"title":"Eliminar o comando /newsletter e registrar toda e qualquer url nas mensagens","user":{"login":"henriquebastos","id":12066,"avatar_url":"https://avatars1.githubusercontent.com/u/12066?v=4","gravatar_id":"","url":"https://api.github.com/users/henriquebastos","html_url":"https://github.com/henriquebastos","followers_url":"https://api.github.com/users/henriquebastos/followers","following_url":"https://api.github.com/users/henriquebastos/following{/other_user}","gists_url":"https://api.github.com/users/henriquebastos/gists{/gist_id}","starred_url":"https://api.github.com/users/henriquebastos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henriquebastos/subscriptions","organizations_url":"https://api.github.com/users/henriquebastos/orgs","repos_url":"https://api.github.com/users/henriquebastos/repos","events_url":"https://api.github.com/users/henriquebastos/events{/privacy}","received_events_url":"https://api.github.com/users/henriquebastos/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-12-06T01:08:32Z","updated_at":"2017-12-06T01:08:32Z","closed_at":null,"author_association":"OWNER","body":"O Telegram tem o conceito de `entities` e `url` é um deles.\r\n\r\nCom isso, quando uma mensagem tem uma `url` no corpo o json do telegram informa a existência de uma `entity` indicando também o _offset_ e _length_ do texto que compõe a `url`.\r\n\r\nVeja por exemplo:\r\n\r\n```\r\n{\r\n  'update_id': 120915766,\r\n  'message': {\r\n    'message_id': 93146,\r\n    'date': 1512521771,\r\n    'chat': {\r\n      'id': -1001093143218,\r\n      'type': 'supergroup',\r\n      'title': 'Welcome to the Django'\r\n    },\r\n    'reply_to_message': {\r\n      'message_id': 93015,\r\n      'date': 1512516314,\r\n      'chat': {\r\n        'id': -1001093143218,\r\n        'type': 'supergroup',\r\n        'title': 'Welcome to the Django'\r\n      },\r\n      'text': 'Acho que não resolve teu problema, mas achei bacanuda essa lib pra trabalhar com datas: http://arrow.readthedocs.io/en/latest/',\r\n      'entities': [\r\n        {\r\n          'type': 'url',\r\n          'offset': 88,\r\n          'length': 38\r\n        }\r\n      ],\r\n      'photo': [],\r\n      'new_chat_members': [],\r\n      'new_chat_photo': [],\r\n      'delete_chat_photo': False,\r\n      'group_chat_created': False,\r\n      'supergroup_chat_created': False,\r\n      'channel_chat_created': False,\r\n      'from': {\r\n        'id': 349558896,\r\n        'first_name': 'Ronaldo',\r\n        'last_name': 'Oliveira'\r\n      },\r\n      'new_chat_member': None\r\n    },\r\n    'text': 'Consegui resolver de outra forma mais simples possivel',\r\n    'entities': [],\r\n    'photo': [],\r\n    'new_chat_members': [],\r\n    'new_chat_photo': [],\r\n    'delete_chat_photo': False,\r\n    'group_chat_created': False,\r\n    'supergroup_chat_created': False,\r\n    'channel_chat_created': False,\r\n    'from': {\r\n      'id': 166710110,\r\n      'first_name': 'Adriano',\r\n      'last_name': 'Margarin',\r\n      'username': 'adrianomargarin'\r\n    },\r\n    'new_chat_member': None\r\n  }\r\n}\r\n```\r\n\r\nPara simplificar o registro de links, não precisamos processar as entidades, mas sim registrar no github toda e qualquer mensagem que contém ao menos 1 `entity url`."}}
{"actor":{"display_login":"henriquebastos"}}