How set the Url of the created game in Telegram BotFather?
Asked Answered
E

2

7

I have created a new game in BotFather Telegram. But there was not any question about game link. Also, there is not any parameter to set game url in "sendGame" function. How can I set my gameUrl behind the created game in BotFather?

I should say, I am using the Microsoft Bot Framework to develope my bot.

Ethridge answered 11/10, 2016 at 21:15 Comment(1)
you managed to solve?Officiant
I
0

They say you have to use the answerCallbackQuery method

"URL that will be opened by the user's client. If you have created a Game and accepted the conditions via @Botfather, specify the URL that opens your game – note that this will only work if the query comes from a callback_game button.

Otherwise, you may use links like telegram.me/your_bot?start=XXXX that open your bot with a parameter."

Ieper answered 3/11, 2016 at 23:43 Comment(1)
"?start=xxxx" is not related to my question. Anyhow, as I found from your solution, you said that I should respond to a wanted game via an inline bot? Is it true? Could you write a sample code to clarify your solution?Ethridge
O
0

i solve in this way:

if(isset($update["callback_query"])) {
  $parameters["method"] = "answerCallbackQuery";
  $parameters["callback_query_id"] = $update["callback_query"]["id"];
  $parameters["url"] = "<url_game>";
  echo json_encode($parameters);
}

$parameters = array('chat_id' => $chatId);
// method è il metodo per l'invio di un messaggio (cfr. API di Telegram)
$parameters["method"] = "sendGame";
$parameters["game_short_name"] = "prova";

Explanation: In the first part is sent to the photo set from botfather. When you decide to play a callback_query you are created. We must send then the url of our html5 code

Officiant answered 12/2, 2017 at 15:29 Comment(2)
Do you mean we should send two methods to do this? If I want send a game directly to a user, I will not have any callback_query id.Ethridge
Yes, We, too, are comparing them with the assistance we found soloist That wayOfficiant

© 2022 - 2025 — McMap. All rights reserved.