@@ -72,33 +72,35 @@ For comparison, a minimum example was used with sending a message to the chat an
7272 - Refresh Request: 1 second
7373
7474## Content
75- - [ installation] (# Install)
76- - [ initialization] (#init)
77- - [ documentation] (#docs)
78- - [ use] (#usage)
79- - [ sending messages] (# SEND)
80- - [ Parsing messages] (#inbox)
81- - [ ticker] (#tick)
82- - [ Minimum example] (# Example)
83- - [ appeal to messages] (#msgid)
84- - [ System Settlement] (#sticker)
85- - [ menu] (#menu)
86- - [ ordinary menu] (# BASIC)
87- - [ Inline menu] (#inline)
88- - [ Inline menu with collbe] (#callb)
89- - [ response to collback] (# Anter)
90- - [ time module] (#unix)
91- - [ The time of receipt of the message] (#time)
92- - [ Real Time Watch] (# RTC)
93- - [ Chat firmware update] (# OTA)
94- - [ text design] (#textmode)
95- - [ Sending files] (#files)
96- - [ download files] (#download)
97- - [ all sorts of tricks] (#tricks)
98- - [ versions] (#varsions)
99- - [ bugs and feedback] (#fedback)
100-
101- <a id =" install " > </a >
75+ - [ Install] ( #install )
76+ - [ Initialization] ( #init )
77+ - [ Documentation] ( #docs )
78+ - [ Usage] ( #usage )
79+ - [ Sending messages] ( #send )
80+ - [ Message Parsing] ( #inbox )
81+ - [ Ticker] ( #tick )
82+ - [ Minimal Example] ( #example )
83+ - [ Referring to messages] ( #msgid )
84+ - [ Send stickers] ( #sticker )
85+ - [ Menu] ( #menu )
86+ - [ Normal menu] ( #basic )
87+ - [ Inline menu] ( #inline )
88+ - [ Inline menu with callback] ( #callb )
89+ - [ Response to callback] ( #answer )
90+ - [ Time module] ( #unix )
91+ - [ Time to receive message] ( #time )
92+ - [ Real Time Clock] ( #rtc )
93+ - [ Firmware update from chat] ( #ota ) Cranberry
94+ - [ Text styling] ( #textmode )
95+ - [ Sending files] ( #files )
96+ - [ Download files] ( #download )
97+ - [ Location] ( #location )
98+ - [ All sorts of tricks] ( #tricks )
99+ - [ Versions] ( #versions )
100+ - [ Bugs and feedback] ( #feedback )
101+
102+ <a id =" install " ></a >
103+
102104## Installation
103105- The library can be found by the name ** farbot ** and installed through the library manager in:
104106 - Arduino ide
@@ -361,13 +363,14 @@ Int64_T FB_STR64 (COST String & S);// Translating from String to Int64_T
361363String fb_64str (int64_t ID);// Translation from int64_t to string
362364
363365
364- // ========== The defines of settings ==============
365- // announce before connecting the library
366- #define fb_no_unicode // Disable Unicode converting for incoming messages (slightly accelerate the program)
367- #define fb_no_urlencode // Disable Urlencode converting for outgoing messages (slightly accelerate the program)
368- #define fb_no_ota // Disable OTA support for updates from chat
369- #define fb_dynamic // Turn on the dynamic mode: the library executes a query longer, but takes 10 kb less memory in SRAM
370- `` `
366+ // ========== DEFINE SETTINGS ===========
367+ // declare BEFORE linking the library
368+ #define FB_NO_UNICODE // disable Unicode conversion for incoming messages (slightly speed up the program)
369+ #define FB_NO_URLENCODE // disable urlencode conversion for outgoing messages (slightly speeds up the program)
370+ #define FB_NO_OTA // disable support for OTA updates from chat
371+ #define FB_DYNAMIC // enable dynamic mode: the library takes longer to execute the request, but takes up 10 kb less memory in SRAM
372+ #define FB_WITH_LOCATION // enable location fields in message (FB_msg)
373+ ```
371374
372375<a id="usage"> </a>
373376## Usage
@@ -738,7 +741,31 @@ VOID NewMSG (FB_MSG & MSG) {
738741}
739742`` `
740743
741- <a id =" tricks " > </a >
744+ <a id="location"></a>
745+ ## Location
746+ If defined `#define FB_WITH_LOCATION` bot append `location` field into message (FB_msg):
747+
748+ ```cpp
749+ struct FB_Location {
750+ String &latitude;
751+ String &longitude;
752+ };
753+ ```
754+
755+ Fields latitude/longitude will be filled if bot received location from user.
756+
757+ ``` cpp
758+ void newMsg (FB_msg& msg) {
759+ if (msg.location.latitude.length() > 0 && msg.location.longitude.length() > 0) {
760+ bot.sendMessage("Lat: " + msg.location.latitude + ", Lon: " + msg.location.longitude, msg.chatID);
761+ }
762+ }
763+ ```
764+
765+ See examples in `examples/location` and `examples/sunPosition`.
766+
767+ <a id="tricks"></a>
768+
742769## Tricks
743770### Reboot
744771Messages are noted read at the next (relative to the current message processor) update in Tick (), that is, after at least a tuned timeout.
0 commit comments