mirror of
https://github.com/eternnoir/pyTelegramBotAPI.git
synced 2023-08-10 21:12:57 +03:00
Implemented getUserProfilePhotos (Though I do not see the use of it currently, because bots cannot download photos with the API)
This commit is contained in:
@@ -60,7 +60,7 @@ class TeleBot:
|
||||
def polling(self, interval=3):
|
||||
"""
|
||||
Always get updates.
|
||||
:param interval: iterval secs.
|
||||
:param interval: interval secs.
|
||||
:return:
|
||||
"""
|
||||
self.interval = interval
|
||||
@@ -91,10 +91,19 @@ class TeleBot:
|
||||
|
||||
def get_me(self):
|
||||
result = apihelper.get_me(self.token)
|
||||
if result['ok'] is not True:
|
||||
raise Exception('getMe Error.' + json.dumps(result))
|
||||
u = types.User.de_json(json.dumps(result['result']))
|
||||
return u
|
||||
return types.User.de_json(json.dumps(result['result']))
|
||||
|
||||
def get_user_profile_photos(self, user_id, offset=None, limit=None):
|
||||
"""
|
||||
Retrieves the user profile photos of the person with 'user_id'
|
||||
See https://core.telegram.org/bots/api#getuserprofilephotos
|
||||
:param user_id:
|
||||
:param offset:
|
||||
:param limit:
|
||||
:return:
|
||||
"""
|
||||
result = apihelper.get_user_profile_photos(self.token, user_id, offset, limit)
|
||||
return types.UserProfilePhotos.de_json(json.dumps(result['result']))
|
||||
|
||||
def send_message(self, chat_id, text, disable_web_page_preview=None, reply_to_message_id=None, reply_markup=None):
|
||||
"""
|
||||
@@ -199,3 +208,4 @@ class TeleBot:
|
||||
:return:
|
||||
"""
|
||||
return apihelper.send_chat_action(self.token, chat_id, action)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user