editMessageLiveLocation
Chỉnh sửa vị trí trực tiếp.
Giá trị trả về: Nếu thành công, trả về Message or True.
Tham số
| Tham số | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
business_connection_id | String | Tùy chọn | ID kết nối doanh nghiệp |
chat_id | Integer or String | Tùy chọn | ID chat |
message_id | Integer | Tùy chọn | ID tin nhắn |
inline_message_id | String | Tùy chọn | ID tin nhắn inline |
latitude | Float | Có | Vĩ độ |
longitude | Float | Có | Kinh độ |
live_period | Integer | Tùy chọn | Thời hạn vị trí trực tiếp tính bằng giây |
horizontal_accuracy | Float | Tùy chọn | Độ chính xác tính bằng mét (0-1500) |
heading | Integer | Tùy chọn | Hướng di chuyển tính bằng độ (1-360) |
proximity_alert_radius | Integer | Tùy chọn | Bán kính cảnh báo khi đến gần (1-100000) |
reply_markup | InlineKeyboardMarkup | Tùy chọn | JSON: InlineKeyboardMarkup |
Ví dụ request
curl
curl -s -X POST "https://api.telegram.org/bot$TOKEN/editMessageLiveLocation" \
-H "Content-Type: application/json" \
-d '{"latitude":51.5007,"longitude":-0.1246}'
Python
import requests
TOKEN = "123456789:AAEexampleTokenReplaceWithYours"
resp = requests.post(
f"https://api.telegram.org/bot{TOKEN}/editMessageLiveLocation",
json={
"latitude": 51.5007,
"longitude": -0.1246
},
timeout=30,
)
print(resp.json())
JavaScript
const TOKEN = "123456789:AAEexampleTokenReplaceWithYours";
const res = await fetch(`https://api.telegram.org/bot${TOKEN}/editMessageLiveLocation`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"latitude": 51.5007,
"longitude": -0.1246
}),
});
console.log(await res.json());
Hướng dẫn từng bước: Cách tạo bot Telegram từ A đến Z: BotFather, token và tin nhắn đầu tiên
Phương thức liên quan
editMessageTextChỉnh sửa nội dung tin nhắn.editMessageCaptionChỉnh sửa chú thích của media.editMessageMediaChỉnh sửa media trong tin nhắn.editMessageReplyMarkupChỉnh sửa reply markup của tin nhắn.stopMessageLiveLocationDừng chia sẻ vị trí trực tiếp.editMessageChecklistChỉnh sửa checklist.