sendGame
Oyun gönderir.
Dönüş değeri: Başarılı olduğunda Message döndürür.
Parametreler
| Parametre | Tür | Zorunlu | Açıklama |
|---|---|---|---|
business_connection_id | String | İsteğe bağlı | İşletme bağlantısı ID'si |
chat_id | Integer or String | Evet | Sohbet ID'si veya @username |
message_thread_id | Integer | İsteğe bağlı | Forum konusu ID'si |
game_short_name | String | Evet | Oyunun kısa adı |
disable_notification | Boolean | İsteğe bağlı | Sessiz gönder |
protect_content | Boolean | İsteğe bağlı | İçeriği koru |
allow_paid_broadcast | Boolean | İsteğe bağlı | Ücretli yayına izin ver |
message_effect_id | String | İsteğe bağlı | Mesaj efekti ID'si |
reply_parameters | ReplyParameters | İsteğe bağlı | JSON ReplyParameters nesnesi |
reply_markup | InlineKeyboardMarkup | İsteğe bağlı | JSON: InlineKeyboardMarkup |
Örnek istek
curl
curl -s -X POST "https://api.telegram.org/bot$TOKEN/sendGame" \
-H "Content-Type: application/json" \
-d '{"chat_id":123456789,"game_short_name":"mygame"}'
Python
import requests
TOKEN = "123456789:AAEexampleTokenReplaceWithYours"
resp = requests.post(
f"https://api.telegram.org/bot{TOKEN}/sendGame",
json={
"chat_id": 123456789,
"game_short_name": "mygame"
},
timeout=30,
)
print(resp.json())
JavaScript
const TOKEN = "123456789:AAEexampleTokenReplaceWithYours";
const res = await fetch(`https://api.telegram.org/bot${TOKEN}/sendGame`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"chat_id": 123456789,
"game_short_name": "mygame"
}),
});
console.log(await res.json());
Adım adım rehber: Telegram bot nasıl yapılır? BotFather ile adım adım bot oluşturma
İlgili metotlar
setGameScoreKullanıcının oyun skorunu ayarlar.getGameHighScoresOyunun yüksek skorlarını döndürür.