6

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.

Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135
OmG
  • 18,337
  • 10
  • 57
  • 90

2 Answers2

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."

LazerStackr
  • 163
  • 1
  • 10
  • "?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? – OmG Nov 04 '16 at 18:27
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

Matteo Enna
  • 1,285
  • 1
  • 15
  • 36
  • 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. – OmG Feb 13 '17 at 09:44
  • Yes, We, too, are comparing them with the assistance we found soloist That way – Matteo Enna Feb 13 '17 at 12:05