Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
c3e07b1
Add switch_inline_query_current_chat
jsmnbom Oct 3, 2016
f7ede4b
Add caption fields to voice and audio
jsmnbom Oct 3, 2016
868d921
Add WebhookInfo and getWebhookInfo
jsmnbom Oct 3, 2016
34c62a6
Add url to answerCallbackQuery
jsmnbom Oct 3, 2016
e8a34d8
cosmetic fixes and documentation for getWebhookInfo
tsnoam Oct 3, 2016
9e9309e
Add all new Game related classes
jsmnbom Oct 3, 2016
f3b8a3a
Merge remote-tracking branch 'origin/october3' into october3
jsmnbom Oct 3, 2016
8737b5d
fix syntax error by some weird char
tsnoam Oct 3, 2016
1f67623
Fix import order
tsnoam Oct 3, 2016
151a441
Add send_game
jsmnbom Oct 3, 2016
358dd79
Add the rest of game_ methods to bot.
jsmnbom Oct 3, 2016
ae17eb3
Add InlineQueryResultGame
jsmnbom Oct 3, 2016
551f6c5
Add game parameters in various places
jsmnbom Oct 3, 2016
5e2d96b
Make tests actually run at all
jsmnbom Oct 3, 2016
8234321
Fix tests for Inline Voice Queries
jsmnbom Oct 3, 2016
c2b8c4b
Fix regexGroupHandlerCallbackQuery test
jsmnbom Oct 3, 2016
3c88965
Allow http url as a file_id
tsnoam Oct 3, 2016
3a0f219
inputfile: define the file types as constant and use iterator
tsnoam Oct 3, 2016
4180c06
InputFile: use self instead of explicit class name
tsnoam Oct 3, 2016
9b74625
answerCallbackQuery: fix copy/paste: show_alert -> url
tsnoam Oct 3, 2016
7cf5009
small documentation fixes
tsnoam Oct 3, 2016
2463b4b
New exception: RetryAfter
tsnoam Oct 3, 2016
d5567cd
sendGame(): mall fixes
tsnoam Oct 3, 2016
34748ec
callbackgame: small documentation fix
tsnoam Oct 3, 2016
3619291
setGameScore: fixes
tsnoam Oct 3, 2016
d70fc48
getGameHighScores(): added documentation + fixed copy-paste errors
tsnoam Oct 3, 2016
fab97df
GameHighScore: added attributes documentation
tsnoam Oct 3, 2016
837e9d2
Animation: use explicit keyword args + added documentation
tsnoam Oct 3, 2016
1f9d316
Game: use explicit keyword args + added docmentation
tsnoam Oct 3, 2016
6b77885
Add tests for captions in audio and voice
jsmnbom Oct 5, 2016
976f340
Add possibly good-enough test for all_members_are_admin
jsmnbom Oct 5, 2016
1db1b76
fix test_video unitest
tsnoam Oct 5, 2016
01a5a1c
small documentation fix
tsnoam Oct 5, 2016
bfb4c63
add unitest for getWebhookInfo
tsnoam Oct 5, 2016
8cab735
small fix for game related parts
PH89 Oct 6, 2016
e672625
add myself to AUTHORS.rst
PH89 Oct 6, 2016
67b98e3
Merge pull request #433 from PH89/october3
jsmnbom Oct 7, 2016
ade8977
Fix tests
jsmnbom Oct 7, 2016
b7c7612
Add game filter
jsmnbom Oct 7, 2016
d1ddfad
Add tests for Game, Animation and sendGame.
jsmnbom Oct 7, 2016
7ad92dc
Add test for set_game_score
jsmnbom Oct 9, 2016
8dc10fc
fixes broken test cases with PhotoSize, Game and Animation classes (#…
PH89 Oct 10, 2016
04feeef
Update test cases
jsmnbom Oct 12, 2016
32a7872
yapf fixes
tsnoam Oct 12, 2016
d07a1c3
yapf: use our own mirror of yapf & update to version 0.12.2
tsnoam Oct 12, 2016
5b8efe0
upgrade yapf to ver 0.12.2
tsnoam Oct 12, 2016
53a574b
Improve unitests coverage
tsnoam Oct 13, 2016
de96cc8
Only build master branch and PRs on travis. Yapf only on py3.5.
jsmnbom Oct 14, 2016
a68cf8d
Respect RetryAfter with polling Updater
tsnoam Oct 15, 2016
305ff93
set_game_score might return True
jsmnbom Oct 16, 2016
3754cda
send_game has differnt kwargs.
jsmnbom Oct 16, 2016
62dd3a3
Better kwargs defaults.
jsmnbom Oct 16, 2016
7fafaa1
Update support date in readme.
jsmnbom Oct 16, 2016
78088f4
Fix grammer: 'a object' -> 'an object'
tsnoam Oct 16, 2016
960862c
Merge branch 'master' into october3
jsmnbom Oct 19, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,6 @@ telegram.mp4
telegram.ogg
telegram.png
telegram.webp

# original files from merges
*.orig
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
- repo: git://github.com/pre-commit/mirrors-yapf
sha: v0.11.0
- repo: git://github.com/python-telegram-bot/mirrors-yapf
sha: v0.12.2
hooks:
- id: yapf
files: ^(telegram|tests)/.*\.py$
Expand Down
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@ python:
- "3.5"
- "pypy"
- "pypy3"
branches:
only:
- master
install:
- pip install coveralls
- pip install -r requirements.txt
- pip install -r requirements-dev.txt
- if [[ $TRAVIS_PYTHON_VERSION != 'pypy'* ]]; then pip install ujson; fi
script:
- nosetests -v --with-flaky --no-flaky-report --with-coverage --cover-package=telegram/
- if [ $TRAVIS_PYTHON_VERSION != 3.3 ] && [ $TRAVIS_PYTHON_VERSION != pypy3 ]; then pre-commit run --all-files; fi
- if [[ $TRAVIS_PYTHON_VERSION == 3.5 ]]; then pre-commit run --all-files; fi
after_success:
coveralls
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ The following wonderful people contributed directly or indirectly to this projec
- `Noam Meltzer <https://github.com/tsnoam>`_
- `Oleg Shlyazhko <https://github.com/ollmer>`_
- `overquota <https://github.com/overquota>`_
- `Patrick Hofmann <https://github.com/PH89>`_
- `Rahiel Kasim <https://github.com/rahiel>`_
- `Shelomentsev D <https://github.com/shelomentsevd>`_
- `sooyhwang <https://github.com/sooyhwang>`_
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ make the development of bots easy and straightforward. These classes are contain
Telegram API support
====================

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

==========
Installing
Expand Down
45 changes: 26 additions & 19 deletions telegram/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
from .emoji import Emoji
from .parsemode import ParseMode
from .messageentity import MessageEntity
from .animation import Animation
from .game import Game
from .message import Message
from .inputmessagecontent import InputMessageContent
from .callbackquery import CallbackQuery
Expand Down Expand Up @@ -73,10 +75,13 @@
from .inlinequeryresultvenue import InlineQueryResultVenue
from .inlinequeryresultvideo import InlineQueryResultVideo
from .inlinequeryresultvoice import InlineQueryResultVoice
from .inlinequeryresultgame import InlineQueryResultGame
from .inputtextmessagecontent import InputTextMessageContent
from .inputlocationmessagecontent import InputLocationMessageContent
from .inputvenuemessagecontent import InputVenueMessageContent
from .inputcontactmessagecontent import InputContactMessageContent
from .webhookinfo import WebhookInfo
from .gamehighscore import GameHighScore
from .update import Update
from .bot import Bot
from .constants import (MAX_MESSAGE_LENGTH, MAX_CAPTION_LENGTH, SUPPORTED_WEBHOOK_PORTS,
Expand All @@ -87,22 +92,24 @@

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

__all__ = ['Audio', 'Bot', 'Chat', 'ChatMember', 'ChatAction', 'ChosenInlineResult',
'CallbackQuery', 'Contact', 'Document', 'Emoji', 'File', 'ForceReply',
'InlineKeyboardButton', 'InlineKeyboardMarkup', 'InlineQuery', 'InlineQueryResult',
'InlineQueryResult', 'InlineQueryResultArticle', 'InlineQueryResultAudio',
'InlineQueryResultCachedAudio', 'InlineQueryResultCachedDocument',
'InlineQueryResultCachedGif', 'InlineQueryResultCachedMpeg4Gif',
'InlineQueryResultCachedPhoto', 'InlineQueryResultCachedSticker',
'InlineQueryResultCachedVideo', 'InlineQueryResultCachedVoice',
'InlineQueryResultContact', 'InlineQueryResultDocument', 'InlineQueryResultGif',
'InlineQueryResultLocation', 'InlineQueryResultMpeg4Gif', 'InlineQueryResultPhoto',
'InlineQueryResultVenue', 'InlineQueryResultVideo', 'InlineQueryResultVoice',
'InputContactMessageContent', 'InputFile', 'InputLocationMessageContent',
'InputMessageContent', 'InputTextMessageContent', 'InputVenueMessageContent',
'KeyboardButton', 'Location', 'Message', 'MessageEntity', 'ParseMode', 'PhotoSize',
'ReplyKeyboardHide', 'ReplyKeyboardMarkup', 'ReplyMarkup', 'Sticker', 'TelegramError',
'TelegramObject', 'Update', 'User', 'UserProfilePhotos', 'Venue', 'Video', 'Voice',
'MAX_MESSAGE_LENGTH', 'MAX_CAPTION_LENGTH', 'SUPPORTED_WEBHOOK_PORTS',
'MAX_FILESIZE_DOWNLOAD', 'MAX_FILESIZE_UPLOAD', 'MAX_MESSAGES_PER_SECOND_PER_CHAT',
'MAX_MESSAGES_PER_SECOND', 'MAX_MESSAGES_PER_MINUTE_PER_GROUP']
__all__ = [
'Audio', 'Bot', 'Chat', 'ChatMember', 'ChatAction', 'ChosenInlineResult', 'CallbackQuery',
'Contact', 'Document', 'Emoji', 'File', 'ForceReply', 'InlineKeyboardButton',
'InlineKeyboardMarkup', 'InlineQuery', 'InlineQueryResult', 'InlineQueryResult',
'InlineQueryResultArticle', 'InlineQueryResultAudio', 'InlineQueryResultCachedAudio',
'InlineQueryResultCachedDocument', 'InlineQueryResultCachedGif',
'InlineQueryResultCachedMpeg4Gif', 'InlineQueryResultCachedPhoto',
'InlineQueryResultCachedSticker', 'InlineQueryResultCachedVideo',
'InlineQueryResultCachedVoice', 'InlineQueryResultContact', 'InlineQueryResultDocument',
'InlineQueryResultGif', 'InlineQueryResultLocation', 'InlineQueryResultMpeg4Gif',
'InlineQueryResultPhoto', 'InlineQueryResultVenue', 'InlineQueryResultVideo',
'InlineQueryResultVoice', 'InlineQueryResultGame', 'InputContactMessageContent', 'InputFile',
'InputLocationMessageContent', 'InputMessageContent', 'InputTextMessageContent',
'InputVenueMessageContent', 'KeyboardButton', 'Location', 'Message', 'MessageEntity',
'ParseMode', 'PhotoSize', 'ReplyKeyboardHide', 'ReplyKeyboardMarkup', 'ReplyMarkup', 'Sticker',
'TelegramError', 'TelegramObject', 'Update', 'User', 'UserProfilePhotos', 'Venue', 'Video',
'Voice', 'MAX_MESSAGE_LENGTH', 'MAX_CAPTION_LENGTH', 'SUPPORTED_WEBHOOK_PORTS',
'MAX_FILESIZE_DOWNLOAD', 'MAX_FILESIZE_UPLOAD', 'MAX_MESSAGES_PER_SECOND_PER_CHAT',
'MAX_MESSAGES_PER_SECOND', 'MAX_MESSAGES_PER_MINUTE_PER_GROUP', 'WebhookInfo', 'Animation',
'Game', 'GameHighScore'
]
60 changes: 60 additions & 0 deletions telegram/animation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2016
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser Public License for more details.
#
# You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/].
"""This module contains an object that represents a Telegram Animation."""
from telegram import PhotoSize
from telegram import TelegramObject


class Animation(TelegramObject):
"""This object represents a Telegram Animation.

Attributes:
file_id (str): Unique file identifier.

Keyword Args:
thumb (Optional[:class:`telegram.PhotoSize`]): Animation thumbnail as defined by sender.
file_name (Optional[str]): Original animation filename as defined by sender.
mime_type (Optional[str]): MIME type of the file as defined by sender.
file_size (Optional[int]): File size.

"""

def __init__(self, file_id, **kwargs):
self.file_id = file_id
self.thumb = kwargs.get('thumb')
self.file_name = kwargs.get('file_name')
self.mime_type = kwargs.get('mime_type')
self.file_size = kwargs.get('file_size')

@staticmethod
def de_json(data, bot):
"""
Args:
data (dict):
bot (telegram.Bot):

Returns:
telegram.Game:
"""
if not data:
return None

data['thumb'] = PhotoSize.de_json(data.get('thumb'), bot)

return Animation(**data)
2 changes: 1 addition & 1 deletion telegram/audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#
# You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/].
"""This module contains a object that represents a Telegram Audio."""
"""This module contains an object that represents a Telegram Audio."""

from telegram import TelegramObject

Expand Down
Loading