1
0
mirror of https://github.com/eternnoir/pyTelegramBotAPI.git synced 2023-08-10 21:12:57 +03:00

Add send game method.

This commit is contained in:
eternnoir 2016-10-08 20:36:48 +08:00
parent 795a00f92c
commit b8e5c43598
2 changed files with 22 additions and 1 deletions

View File

@ -549,8 +549,15 @@ class TeleBot:
return result
return types.Message.de_json(result)
def send_game(self, chat_id, game_short_name, disable_notification=None, reply_to_message_id=None,
reply_markup=None):
result = apihelper.send_game(self.token, chat_id, game_short_name, disable_notification, reply_to_message_id,
reply_markup)
return types.Message.de_json(result)
def edit_message_caption(self, caption, chat_id=None, message_id=None, inline_message_id=None, reply_markup=None):
result = apihelper.edit_message_caption(self.token, caption, chat_id, message_id, inline_message_id, reply_markup)
result = apihelper.edit_message_caption(self.token, caption, chat_id, message_id, inline_message_id,
reply_markup)
if type(result) == bool:
return result
return types.Message.de_json(result)

View File

@ -418,6 +418,20 @@ def edit_message_reply_markup(token, chat_id=None, message_id=None, inline_messa
return _make_request(token, method_url, params=payload)
# Game
def send_game(token, chat_id, game_short_name, disable_notification=None, reply_to_message_id=None, reply_markup=None):
method_url = r'sendGame'
payload = {'chat_id': chat_id, 'game_short_name': game_short_name}
if disable_notification:
payload['disable_notification'] = disable_notification
if reply_to_message_id:
payload['reply_to_message_id'] = reply_to_message_id
if reply_markup:
payload['reply_markup'] = _convert_markup(reply_markup)
return _make_request(token, method_url, params=payload)
# InlineQuery
def answer_callback_query(token, callback_query_id, text=None, show_alert=None):