X Tutup
Skip to content

Commit 61fe438

Browse files
authored
Merge pull request python-telegram-bot#431 from python-telegram-bot/october3
Add api changes as of october 3
2 parents 4e5f458 + 960862c commit 61fe438

File tree

110 files changed

+1241
-305
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+1241
-305
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,6 @@ telegram.mp4
6868
telegram.ogg
6969
telegram.png
7070
telegram.webp
71+
72+
# original files from merges
73+
*.orig

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
- repo: git://github.com/pre-commit/mirrors-yapf
2-
sha: v0.11.0
1+
- repo: git://github.com/python-telegram-bot/mirrors-yapf
2+
sha: v0.12.2
33
hooks:
44
- id: yapf
55
files: ^(telegram|tests)/.*\.py$

.travis.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,16 @@ python:
66
- "3.5"
77
- "pypy"
88
- "pypy3"
9+
branches:
10+
only:
11+
- master
912
install:
1013
- pip install coveralls
1114
- pip install -r requirements.txt
1215
- pip install -r requirements-dev.txt
1316
- if [[ $TRAVIS_PYTHON_VERSION != 'pypy'* ]]; then pip install ujson; fi
1417
script:
1518
- nosetests -v --with-flaky --no-flaky-report --with-coverage --cover-package=telegram/
16-
- if [ $TRAVIS_PYTHON_VERSION != 3.3 ] && [ $TRAVIS_PYTHON_VERSION != pypy3 ]; then pre-commit run --all-files; fi
19+
- if [[ $TRAVIS_PYTHON_VERSION == 3.5 ]]; then pre-commit run --all-files; fi
1720
after_success:
1821
coveralls

AUTHORS.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ The following wonderful people contributed directly or indirectly to this projec
2727
- `Noam Meltzer <https://github.com/tsnoam>`_
2828
- `Oleg Shlyazhko <https://github.com/ollmer>`_
2929
- `overquota <https://github.com/overquota>`_
30+
- `Patrick Hofmann <https://github.com/PH89>`_
3031
- `Rahiel Kasim <https://github.com/rahiel>`_
3132
- `Shelomentsev D <https://github.com/shelomentsevd>`_
3233
- `sooyhwang <https://github.com/sooyhwang>`_

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ make the development of bots easy and straightforward. These classes are contain
8484
Telegram API support
8585
====================
8686

87-
As of **28. May 2016**, all types and methods of the Telegram Bot API are supported.
87+
As of **3. Oct 2016**, all types and methods of the Telegram Bot API are supported.
8888

8989
==========
9090
Installing

telegram/__init__.py

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
from .emoji import Emoji
4747
from .parsemode import ParseMode
4848
from .messageentity import MessageEntity
49+
from .animation import Animation
50+
from .game import Game
4951
from .message import Message
5052
from .inputmessagecontent import InputMessageContent
5153
from .callbackquery import CallbackQuery
@@ -73,10 +75,13 @@
7375
from .inlinequeryresultvenue import InlineQueryResultVenue
7476
from .inlinequeryresultvideo import InlineQueryResultVideo
7577
from .inlinequeryresultvoice import InlineQueryResultVoice
78+
from .inlinequeryresultgame import InlineQueryResultGame
7679
from .inputtextmessagecontent import InputTextMessageContent
7780
from .inputlocationmessagecontent import InputLocationMessageContent
7881
from .inputvenuemessagecontent import InputVenueMessageContent
7982
from .inputcontactmessagecontent import InputContactMessageContent
83+
from .webhookinfo import WebhookInfo
84+
from .gamehighscore import GameHighScore
8085
from .update import Update
8186
from .bot import Bot
8287
from .constants import (MAX_MESSAGE_LENGTH, MAX_CAPTION_LENGTH, SUPPORTED_WEBHOOK_PORTS,
@@ -87,22 +92,24 @@
8792

8893
__author__ = 'devs@python-telegram-bot.org'
8994

90-
__all__ = ['Audio', 'Bot', 'Chat', 'ChatMember', 'ChatAction', 'ChosenInlineResult',
91-
'CallbackQuery', 'Contact', 'Document', 'Emoji', 'File', 'ForceReply',
92-
'InlineKeyboardButton', 'InlineKeyboardMarkup', 'InlineQuery', 'InlineQueryResult',
93-
'InlineQueryResult', 'InlineQueryResultArticle', 'InlineQueryResultAudio',
94-
'InlineQueryResultCachedAudio', 'InlineQueryResultCachedDocument',
95-
'InlineQueryResultCachedGif', 'InlineQueryResultCachedMpeg4Gif',
96-
'InlineQueryResultCachedPhoto', 'InlineQueryResultCachedSticker',
97-
'InlineQueryResultCachedVideo', 'InlineQueryResultCachedVoice',
98-
'InlineQueryResultContact', 'InlineQueryResultDocument', 'InlineQueryResultGif',
99-
'InlineQueryResultLocation', 'InlineQueryResultMpeg4Gif', 'InlineQueryResultPhoto',
100-
'InlineQueryResultVenue', 'InlineQueryResultVideo', 'InlineQueryResultVoice',
101-
'InputContactMessageContent', 'InputFile', 'InputLocationMessageContent',
102-
'InputMessageContent', 'InputTextMessageContent', 'InputVenueMessageContent',
103-
'KeyboardButton', 'Location', 'Message', 'MessageEntity', 'ParseMode', 'PhotoSize',
104-
'ReplyKeyboardHide', 'ReplyKeyboardMarkup', 'ReplyMarkup', 'Sticker', 'TelegramError',
105-
'TelegramObject', 'Update', 'User', 'UserProfilePhotos', 'Venue', 'Video', 'Voice',
106-
'MAX_MESSAGE_LENGTH', 'MAX_CAPTION_LENGTH', 'SUPPORTED_WEBHOOK_PORTS',
107-
'MAX_FILESIZE_DOWNLOAD', 'MAX_FILESIZE_UPLOAD', 'MAX_MESSAGES_PER_SECOND_PER_CHAT',
108-
'MAX_MESSAGES_PER_SECOND', 'MAX_MESSAGES_PER_MINUTE_PER_GROUP']
95+
__all__ = [
96+
'Audio', 'Bot', 'Chat', 'ChatMember', 'ChatAction', 'ChosenInlineResult', 'CallbackQuery',
97+
'Contact', 'Document', 'Emoji', 'File', 'ForceReply', 'InlineKeyboardButton',
98+
'InlineKeyboardMarkup', 'InlineQuery', 'InlineQueryResult', 'InlineQueryResult',
99+
'InlineQueryResultArticle', 'InlineQueryResultAudio', 'InlineQueryResultCachedAudio',
100+
'InlineQueryResultCachedDocument', 'InlineQueryResultCachedGif',
101+
'InlineQueryResultCachedMpeg4Gif', 'InlineQueryResultCachedPhoto',
102+
'InlineQueryResultCachedSticker', 'InlineQueryResultCachedVideo',
103+
'InlineQueryResultCachedVoice', 'InlineQueryResultContact', 'InlineQueryResultDocument',
104+
'InlineQueryResultGif', 'InlineQueryResultLocation', 'InlineQueryResultMpeg4Gif',
105+
'InlineQueryResultPhoto', 'InlineQueryResultVenue', 'InlineQueryResultVideo',
106+
'InlineQueryResultVoice', 'InlineQueryResultGame', 'InputContactMessageContent', 'InputFile',
107+
'InputLocationMessageContent', 'InputMessageContent', 'InputTextMessageContent',
108+
'InputVenueMessageContent', 'KeyboardButton', 'Location', 'Message', 'MessageEntity',
109+
'ParseMode', 'PhotoSize', 'ReplyKeyboardHide', 'ReplyKeyboardMarkup', 'ReplyMarkup', 'Sticker',
110+
'TelegramError', 'TelegramObject', 'Update', 'User', 'UserProfilePhotos', 'Venue', 'Video',
111+
'Voice', 'MAX_MESSAGE_LENGTH', 'MAX_CAPTION_LENGTH', 'SUPPORTED_WEBHOOK_PORTS',
112+
'MAX_FILESIZE_DOWNLOAD', 'MAX_FILESIZE_UPLOAD', 'MAX_MESSAGES_PER_SECOND_PER_CHAT',
113+
'MAX_MESSAGES_PER_SECOND', 'MAX_MESSAGES_PER_MINUTE_PER_GROUP', 'WebhookInfo', 'Animation',
114+
'Game', 'GameHighScore'
115+
]

telegram/animation.py

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/usr/bin/env python
2+
#
3+
# A library that provides a Python interface to the Telegram Bot API
4+
# Copyright (C) 2015-2016
5+
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
6+
#
7+
# This program is free software: you can redistribute it and/or modify
8+
# it under the terms of the GNU Lesser Public License as published by
9+
# the Free Software Foundation, either version 3 of the License, or
10+
# (at your option) any later version.
11+
#
12+
# This program is distributed in the hope that it will be useful,
13+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
# GNU Lesser Public License for more details.
16+
#
17+
# You should have received a copy of the GNU Lesser Public License
18+
# along with this program. If not, see [http://www.gnu.org/licenses/].
19+
"""This module contains an object that represents a Telegram Animation."""
20+
from telegram import PhotoSize
21+
from telegram import TelegramObject
22+
23+
24+
class Animation(TelegramObject):
25+
"""This object represents a Telegram Animation.
26+
27+
Attributes:
28+
file_id (str): Unique file identifier.
29+
30+
Keyword Args:
31+
thumb (Optional[:class:`telegram.PhotoSize`]): Animation thumbnail as defined by sender.
32+
file_name (Optional[str]): Original animation filename as defined by sender.
33+
mime_type (Optional[str]): MIME type of the file as defined by sender.
34+
file_size (Optional[int]): File size.
35+
36+
"""
37+
38+
def __init__(self, file_id, **kwargs):
39+
self.file_id = file_id
40+
self.thumb = kwargs.get('thumb')
41+
self.file_name = kwargs.get('file_name')
42+
self.mime_type = kwargs.get('mime_type')
43+
self.file_size = kwargs.get('file_size')
44+
45+
@staticmethod
46+
def de_json(data, bot):
47+
"""
48+
Args:
49+
data (dict):
50+
bot (telegram.Bot):
51+
52+
Returns:
53+
telegram.Game:
54+
"""
55+
if not data:
56+
return None
57+
58+
data['thumb'] = PhotoSize.de_json(data.get('thumb'), bot)
59+
60+
return Animation(**data)

telegram/audio.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#
1717
# You should have received a copy of the GNU Lesser Public License
1818
# along with this program. If not, see [http://www.gnu.org/licenses/].
19-
"""This module contains a object that represents a Telegram Audio."""
19+
"""This module contains an object that represents a Telegram Audio."""
2020

2121
from telegram import TelegramObject
2222

0 commit comments

Comments
 (0)
X Tutup