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

Bot API 3.4: new methods for live locations, new objects.

This commit is contained in:
Evgeny Petrov
2017-10-22 19:50:51 +03:00
parent aaa968c27f
commit 5f8d99664e
3 changed files with 98 additions and 7 deletions

View File

@@ -407,6 +407,32 @@ class TeleBot:
result = apihelper.get_chat_members_count(self.token, chat_id)
return result
def set_chat_sticker_set(self, chat_id, sticker_set_name):
"""
Use this method to set a new group sticker set for a supergroup. The bot must be an administrator
in the chat for this to work and must have the appropriate admin rights.
Use the field can_set_sticker_set optionally returned in getChat requests to check
if the bot can use this method. Returns True on success.
:param chat_id: Unique identifier for the target chat or username of the target supergroup
(in the format @supergroupusername)
:param sticker_set_name: Name of the sticker set to be set as the group sticker set
:return:
"""
result = apihelper.set_chat_sticker_set(self.token, chat_id, sticker_set_name)
return result
def delete_chat_sticker_set(self, chat_id):
"""
Use this method to delete a group sticker set from a supergroup. The bot must be an administrator in the chat
for this to work and must have the appropriate admin rights. Use the field can_set_sticker_set
optionally returned in getChat requests to check if the bot can use this method. Returns True on success.
:param chat_id: Unique identifier for the target chat or username of the target supergroup
(in the format @supergroupusername)
:return:
"""
result = apihelper.delete_chat_sticker_set(self.token, chat_id)
return result
def get_chat_member(self, chat_id, user_id):
"""
Use this method to get information about a member of a chat. Returns a ChatMember object on success.
@@ -568,19 +594,20 @@ class TeleBot:
apihelper.send_video_note(self.token, chat_id, data, duration, length, reply_to_message_id, reply_markup,
disable_notification, timeout))
def send_location(self, chat_id, latitude, longitude, reply_to_message_id=None, reply_markup=None,
def send_location(self, chat_id, latitude, longitude, live_period=None, reply_to_message_id=None, reply_markup=None,
disable_notification=None):
"""
Use this method to send point on the map.
:param chat_id:
:param latitude:
:param longitude:
:param live_period
:param reply_to_message_id:
:param reply_markup:
:return: API reply.
"""
return types.Message.de_json(
apihelper.send_location(self.token, chat_id, latitude, longitude, reply_to_message_id, reply_markup,
apihelper.send_location(self.token, chat_id, latitude, longitude, live_period, reply_to_message_id, reply_markup,
disable_notification))
def send_venue(self, chat_id, latitude, longitude, title, address, foursquare_id=None, disable_notification=None,
@@ -1245,6 +1272,14 @@ class AsyncTeleBot(TeleBot):
def get_chat_members_count(self, *args):
return TeleBot.get_chat_members_count(self, *args)
@util.async()
def set_chat_sticker_set(self, *args):
return TeleBot.set_chat_sticker_set(self, *args)
@util.async()
def delete_chat_sticker_set(self, *args):
return TeleBot.delete_chat_sticker_set(self, *args)
@util.async()
def get_chat_member(self, *args):
return TeleBot.get_chat_member(self, *args)