mirror of
https://github.com/MarshalX/telegram-crawler.git
synced 2024-12-05 14:35:02 +01:00
178 lines
14 KiB
HTML
178 lines
14 KiB
HTML
<!DOCTYPE html>
|
|
<html class="">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Live geolocation</title>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta property="description" content="Telegram allows sending the live geolocation of a user in a chat, optionally setting a proximity alert.">
|
|
<meta property="og:title" content="Live geolocation">
|
|
<meta property="og:image" content="">
|
|
<meta property="og:description" content="Telegram allows sending the live geolocation of a user in a chat, optionally setting a proximity alert.">
|
|
<link rel="shortcut icon" href="/favicon.ico?4" type="image/x-icon" />
|
|
|
|
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
|
|
|
|
<link href="/css/telegram.css?212" rel="stylesheet" media="screen">
|
|
<style>
|
|
</style>
|
|
</head>
|
|
<body class="preload">
|
|
<div class="dev_page_wrap">
|
|
<div class="dev_page_head navbar navbar-static-top navbar-tg">
|
|
<div class="navbar-inner">
|
|
<div class="container clearfix">
|
|
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
|
|
<ul class="nav navbar-nav">
|
|
<li><a href="//telegram.org/">Home</a></li>
|
|
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
|
|
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
|
|
<li class="active"><a href="/api">API</a></li>
|
|
<li class=""><a href="/mtproto">Protocol</a></li>
|
|
<li class=""><a href="/schema">Schema</a></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="container clearfix">
|
|
<div class="dev_page">
|
|
<div id="dev_page_content_wrap" class=" ">
|
|
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/live-location" >Live geolocation</a></li></ul></div>
|
|
<h1 id="dev_page_title">Live geolocation</h1>
|
|
|
|
<div id="dev_page_content"><!-- scroll_nav -->
|
|
|
|
<p>Telegram allows sending the live geolocation of a user in a chat, optionally setting a proximity alert. </p>
|
|
<h3><a class="anchor" href="#sending-live-locations" id="sending-live-locations" name="sending-live-locations"><i class="anchor-icon"></i></a>Sending live locations</h3>
|
|
<pre><code><a href='/constructor/inputGeoPointEmpty'>inputGeoPointEmpty</a>#e4c123d6 = <a href='/type/InputGeoPoint'>InputGeoPoint</a>;
|
|
|
|
<a href='/constructor/inputGeoPoint'>inputGeoPoint</a>#48222faf flags:<a href='/type/%23'>#</a> lat:<a href='/type/double'>double</a> long:<a href='/type/double'>double</a> accuracy_radius:flags.0?<a href='/type/int'>int</a> = <a href='/type/InputGeoPoint'>InputGeoPoint</a>;
|
|
|
|
<a href='/constructor/inputMediaGeoLive'>inputMediaGeoLive</a>#971fa843 flags:<a href='/type/%23'>#</a> stopped:flags.0?<a href='/constructor/true'>true</a> geo_point:<a href='/type/InputGeoPoint'>InputGeoPoint</a> heading:flags.2?<a href='/type/int'>int</a> period:flags.1?<a href='/type/int'>int</a> proximity_notification_radius:flags.3?<a href='/type/int'>int</a> = <a href='/type/InputMedia'>InputMedia</a>;
|
|
|
|
---functions---
|
|
|
|
<a href='/method/messages.sendMedia'>messages.sendMedia</a>#3491eba9 flags:<a href='/type/%23'>#</a> silent:flags.5?<a href='/constructor/true'>true</a> background:flags.6?<a href='/constructor/true'>true</a> clear_draft:flags.7?<a href='/constructor/true'>true</a> peer:<a href='/type/InputPeer'>InputPeer</a> reply_to_msg_id:flags.0?<a href='/type/int'>int</a> media:<a href='/type/InputMedia'>InputMedia</a> message:<a href='/type/string'>string</a> random_id:<a href='/type/long'>long</a> reply_markup:flags.2?<a href='/type/ReplyMarkup'>ReplyMarkup</a> entities:flags.3?<a href='/type/Vector%20t'>Vector</a><<a href='/type/MessageEntity'>MessageEntity</a>> schedule_date:flags.10?<a href='/type/int'>int</a> = <a href='/type/Updates'>Updates</a>;
|
|
|
|
<a href='/method/messages.editMessage'>messages.editMessage</a>#48f71778 flags:<a href='/type/%23'>#</a> no_webpage:flags.1?<a href='/constructor/true'>true</a> peer:<a href='/type/InputPeer'>InputPeer</a> id:<a href='/type/int'>int</a> message:flags.11?<a href='/type/string'>string</a> media:flags.14?<a href='/type/InputMedia'>InputMedia</a> reply_markup:flags.2?<a href='/type/ReplyMarkup'>ReplyMarkup</a> entities:flags.3?<a href='/type/Vector%20t'>Vector</a><<a href='/type/MessageEntity'>MessageEntity</a>> schedule_date:flags.15?<a href='/type/int'>int</a> = <a href='/type/Updates'>Updates</a>;</code></pre>
|
|
<p>To send a live geolocation, use <a href="/method/messages.sendMedia">messages.sendMedia</a> with an <a href="/constructor/inputMediaGeoLive">inputMediaGeoLive</a> <code>media</code> . </p>
|
|
<p>The <a href="/constructor/inputMediaGeoLive">inputMediaGeoLive</a> allows sending the geolocation as an <a href="/constructor/inputGeoPoint">inputGeoPoint</a> with floating point latitude and longitude, with an optional <code>accuracy_radius</code> in meters.<br>
|
|
Clients can also provide a <code>heading</code>, a direction in degrees (1-360) that can be used to indicate the direction of the user, a validity <code>period</code> for the current location, and a <code>proximity_notification_radius</code> . </p>
|
|
<p>The sent geolocation should be updated perioducally using <a href="/method/messages.editMessage">messages.editMessage</a> <strong>at most</strong> every <code>period</code> seconds, in order to implement the "live" part of live geolocations. </p>
|
|
<p>To stop sharing the location, pass <a href="/constructor/inputGeoPointEmpty">inputGeoPointEmpty</a> as location and set the <code>stopped</code> flag to true in a last <a href="/method/messages.editMessage">messages.editMessage</a> call. </p>
|
|
<h3><a class="anchor" href="#receiving-live-locations" id="receiving-live-locations" name="receiving-live-locations"><i class="anchor-icon"></i></a>Receiving live locations</h3>
|
|
<pre><code><a href='/constructor/geoPoint'>geoPoint</a>#b2a2f663 flags:<a href='/type/%23'>#</a> long:<a href='/type/double'>double</a> lat:<a href='/type/double'>double</a> access_hash:<a href='/type/long'>long</a> accuracy_radius:flags.0?<a href='/type/int'>int</a> = <a href='/type/GeoPoint'>GeoPoint</a>;
|
|
<a href='/constructor/messageMediaGeoLive'>messageMediaGeoLive</a>#b940c666 flags:<a href='/type/%23'>#</a> geo:<a href='/type/GeoPoint'>GeoPoint</a> heading:flags.0?<a href='/type/int'>int</a> period:<a href='/type/int'>int</a> proximity_notification_radius:flags.1?<a href='/type/int'>int</a> = <a href='/type/MessageMedia'>MessageMedia</a>;
|
|
|
|
<a href='/constructor/updateGeoLiveViewed'>updateGeoLiveViewed</a>#871fb939 peer:<a href='/type/Peer'>Peer</a> msg_id:<a href='/type/int'>int</a> = <a href='/type/Update'>Update</a>;</code></pre>
|
|
<p>Clients will receive a message with a <a href="/constructor/messageMediaGeoLive">messageMediaGeoLive</a>, containing the information passed by the sender; when the geolocation message is marked as read, an <a href="/constructor/updateGeoLiveViewed">updateGeoLiveViewed</a> is generated. </p>
|
|
<p>Periodically, the geolocation will be updated with <a href="/constructor/updateEditMessage">updateEditMessage</a>/<a href="/constructor/updateEditChannelMessage">updateEditChannelMessage</a> updates. </p>
|
|
<h4><a class="anchor" href="#live-location-previews" id="live-location-previews" name="live-location-previews"><i class="anchor-icon"></i></a>Live location previews</h4>
|
|
<pre><code><a href='/constructor/inputWebFileGeoPointLocation'>inputWebFileGeoPointLocation</a>#9f2221c9 geo_point:<a href='/type/InputGeoPoint'>InputGeoPoint</a> access_hash:<a href='/type/long'>long</a> w:<a href='/type/int'>int</a> h:<a href='/type/int'>int</a> zoom:<a href='/type/int'>int</a> scale:<a href='/type/int'>int</a> = <a href='/type/InputWebFileLocation'>InputWebFileLocation</a>;
|
|
|
|
<a href='/constructor/inputGeoPoint'>inputGeoPoint</a>#48222faf flags:<a href='/type/%23'>#</a> lat:<a href='/type/double'>double</a> long:<a href='/type/double'>double</a> accuracy_radius:flags.0?<a href='/type/int'>int</a> = <a href='/type/InputGeoPoint'>InputGeoPoint</a>;
|
|
|
|
---functions---
|
|
|
|
<a href='/method/upload.getWebFile'>upload.getWebFile</a>#24e6818d location:<a href='/type/InputWebFileLocation'>InputWebFileLocation</a> offset:<a href='/type/int'>int</a> limit:<a href='/type/int'>int</a> = <a href='/type/upload.WebFile'>upload.WebFile</a>;</code></pre>
|
|
<p>A map preview can be generated by passing the received <a href="/constructor/geoPoint">geoPoint</a> to <a href="/api/files#downloading-webfiles">upload.getWebFile</a>, to download an image preview of the map. </p>
|
|
<ul>
|
|
<li><code>geo_point</code> is generated from the <code>lat</code> , <code>long</code> <code>accuracy_radius</code> parameters of the <a href="/constructor/geoPoint">geoPoint</a></li>
|
|
<li><code>access_hash</code> is the access hash of the <a href="/constructor/geoPoint">geoPoint</a></li>
|
|
<li><code>w</code> - Map width in pixels before applying scale; 16-1024</li>
|
|
<li><code>h</code> - Map height in pixels before applying scale; 16-1024</li>
|
|
<li><code>zoom</code> - Map zoom level; 13-20</li>
|
|
<li><code>scale</code> - Map scale; 1-3</li>
|
|
</ul>
|
|
<p>The image is then downloaded as specified <a href="/api/files">here » </a></p>
|
|
<h3><a class="anchor" href="#proximity-alert" id="proximity-alert" name="proximity-alert"><i class="anchor-icon"></i></a>Proximity alert</h3>
|
|
<pre><code><a href='/constructor/messageActionGeoProximityReached'>messageActionGeoProximityReached</a>#98e0d697 from_id:<a href='/type/Peer'>Peer</a> to_id:<a href='/type/Peer'>Peer</a> distance:<a href='/type/int'>int</a> = <a href='/type/MessageAction'>MessageAction</a>;
|
|
|
|
<a href='/constructor/messageService'>messageService</a>#2b085862 flags:<a href='/type/%23'>#</a> out:flags.1?<a href='/constructor/true'>true</a> mentioned:flags.4?<a href='/constructor/true'>true</a> media_unread:flags.5?<a href='/constructor/true'>true</a> silent:flags.13?<a href='/constructor/true'>true</a> post:flags.14?<a href='/constructor/true'>true</a> legacy:flags.19?<a href='/constructor/true'>true</a> id:<a href='/type/int'>int</a> from_id:flags.8?<a href='/type/Peer'>Peer</a> peer_id:<a href='/type/Peer'>Peer</a> reply_to:flags.3?<a href='/type/MessageReplyHeader'>MessageReplyHeader</a> date:<a href='/type/int'>int</a> action:<a href='/type/MessageAction'>MessageAction</a> ttl_period:flags.25?<a href='/type/int'>int</a> = <a href='/type/Message'>Message</a>;</code></pre>
|
|
<p>If:</p>
|
|
<ul>
|
|
<li>A user sets a <code>proximity_notification_radius</code> when sending a location</li>
|
|
<li>Multiple users share their location within the same chat</li>
|
|
<li>One of the other users comes within <code>proximity_notification_radius</code> meters of the first user, and updates their location accordingly</li>
|
|
</ul>
|
|
<p>An <a href="/constructor/updateNewMessage">updateNewMessage</a>/<a href="/constructor/updateNewChannelMessage">updateNewChannelMessage</a> is generated for all chat members, containing a <a href="/constructor/messageService">messageService</a> with action <a href="/constructor/messageActionGeoProximityReached">messageActionGeoProximityReached</a>:</p>
|
|
<ul>
|
|
<li><code>messageActionGeoProximityReached.to_id</code> is the peer that enabled proximity alerts</li>
|
|
<li><code>messageActionGeoProximityReached.from_id</code> is the peer that is now in proximity of <code>messageActionGeoProximityReached.to_id</code></li>
|
|
<li><code>messageActionGeoProximityReached.distance</code> is the distance between them, in meters</li>
|
|
</ul></div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
<div class="footer_wrap">
|
|
<div class="footer_columns_wrap footer_desktop">
|
|
<div class="footer_column footer_column_telegram">
|
|
<h5>Telegram</h5>
|
|
<div class="footer_telegram_description"></div>
|
|
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
|
|
</div>
|
|
|
|
<div class="footer_column">
|
|
<h5><a href="//telegram.org/faq">About</a></h5>
|
|
<ul>
|
|
<li><a href="//telegram.org/faq">FAQ</a></li>
|
|
<li><a href="//telegram.org/blog">Blog</a></li>
|
|
<li><a href="//telegram.org/jobs">Jobs</a></li>
|
|
</ul>
|
|
</div>
|
|
<div class="footer_column">
|
|
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
|
|
<ul>
|
|
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
|
|
<li><a href="//telegram.org/dl/android">Android</a></li>
|
|
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
|
|
</ul>
|
|
</div>
|
|
<div class="footer_column">
|
|
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
|
|
<ul>
|
|
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
|
|
<li><a href="//macos.telegram.org/">macOS</a></li>
|
|
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
|
|
</ul>
|
|
</div>
|
|
<div class="footer_column footer_column_platform">
|
|
<h5><a href="//core.telegram.org/">Platform</a></h5>
|
|
<ul>
|
|
<li><a href="//core.telegram.org/api">API</a></li>
|
|
<li><a href="//translations.telegram.org/">Translations</a></li>
|
|
<li><a href="//instantview.telegram.org/">Instant View</a></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class="footer_columns_wrap footer_mobile">
|
|
<div class="footer_column">
|
|
<h5><a href="//telegram.org/faq">About</a></h5>
|
|
</div>
|
|
<div class="footer_column">
|
|
<h5><a href="//telegram.org/blog">Blog</a></h5>
|
|
</div>
|
|
<div class="footer_column">
|
|
<h5><a href="//telegram.org/apps">Apps</a></h5>
|
|
</div>
|
|
<div class="footer_column">
|
|
<h5><a href="//core.telegram.org/">Platform</a></h5>
|
|
</div>
|
|
<div class="footer_column">
|
|
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script src="/js/main.js?42"></script>
|
|
<script src="/js/jquery.min.js?1"></script>
|
|
<script src="/js/bootstrap.min.js"></script>
|
|
|
|
<script>window.initDevPageNav&&initDevPageNav();
|
|
backToTopInit("Go up");
|
|
removePreloadInit();
|
|
</script>
|
|
</body>
|
|
</html>
|
|
|