Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
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
28 changes: 3 additions & 25 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,19 @@ on:
pull_request:
branches:
- master
- v13.x
push:
branches:
- master
- v13.x

jobs:
pytest:
name: pytest
runs-on: ${{matrix.os}}
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: [3.7, 3.8, 3.9]
os: [ubuntu-latest, windows-latest, macos-latest]
fail-fast: False
steps:
Expand Down Expand Up @@ -94,27 +96,3 @@ jobs:
env:
TEST_OFFICIAL: "true"
shell: bash --noprofile --norc {0}
test_pre_commit:
name: test-pre-commit
runs-on: ${{matrix.os}}
strategy:
matrix:
python-version: [3.7]
os: [ubuntu-latest]
fail-fast: False
steps:
- uses: actions/checkout@v2
- name: Initialize vendored libs
run:
git submodule update --init --recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -W ignore -m pip install --upgrade pip
python -W ignore -m pip install -r requirements.txt
python -W ignore -m pip install -r requirements-dev.txt
- name: Run pre-commit tests
run: pre-commit run --all-files
7 changes: 6 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
# Make sure that
# * the revs specified here match requirements-dev.txt
# * the additional_dependencies here match requirements.txt

ci:
# We currently only need this behavior on the v13.x branch were we have the vendored urllib
submodules: true

repos:
- repo: https://github.com/psf/black
rev: 20.8b1
rev: 22.3.0
hooks:
- id: black
args:
Expand Down
7 changes: 4 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ We have a vibrant community of developers helping each other in our `Telegram gr
:target: https://pypi.org/project/python-telegram-bot/
:alt: Supported Python versions

.. image:: https://img.shields.io/badge/Bot%20API-5.7-blue?logo=telegram
.. image:: https://img.shields.io/badge/Bot%20API-6.0-blue?logo=telegram
:target: https://core.telegram.org/bots/api-changelog
:alt: Supported Bot API versions

Expand Down Expand Up @@ -87,13 +87,14 @@ Table of contents

- `License`_


============
Introduction
============

This library provides a pure Python interface for the
`Telegram Bot API <https://core.telegram.org/bots/api>`_.
It's compatible with Python versions 3.6.8+. PTB might also work on `PyPy <http://pypy.org/>`_, though there have been a lot of issues before. Hence, PyPy is not officially supported.
It's compatible with Python versions 3.7+. PTB might also work on `PyPy <http://pypy.org/>`_, though there have been a lot of issues before. Hence, PyPy is not officially supported.

In addition to the pure API implementation, this library features a number of high-level classes to
make the development of bots easy and straightforward. These classes are contained in the
Expand All @@ -111,7 +112,7 @@ Installing both ``python-telegram-bot`` and ``python-telegram-bot-raw`` in conju
Telegram API support
====================

All types and methods of the Telegram Bot API **5.7** are supported.
All types and methods of the Telegram Bot API **6.0** are supported.

==========
Installing
Expand Down
6 changes: 3 additions & 3 deletions README_RAW.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ We have a vibrant community of developers helping each other in our `Telegram gr
:target: https://pypi.org/project/python-telegram-bot-raw/
:alt: Supported Python versions

.. image:: https://img.shields.io/badge/Bot%20API-5.7-blue?logo=telegram
.. image:: https://img.shields.io/badge/Bot%20API-6.0-blue?logo=telegram
:target: https://core.telegram.org/bots/api-changelog
:alt: Supported Bot API versions

Expand Down Expand Up @@ -91,7 +91,7 @@ Introduction

This library provides a pure Python, lightweight interface for the
`Telegram Bot API <https://core.telegram.org/bots/api>`_.
It's compatible with Python versions 3.6.8+. PTB-Raw might also work on `PyPy <http://pypy.org/>`_, though there have been a lot of issues before. Hence, PyPy is not officially supported.
It's compatible with Python versions 3.7+. PTB-Raw might also work on `PyPy <http://pypy.org/>`_, though there have been a lot of issues before. Hence, PyPy is not officially supported.

``python-telegram-bot-raw`` is part of the `python-telegram-bot <https://python-telegram-bot.org>`_ ecosystem and provides the pure API functionality extracted from PTB. It therefore does *not* have independent release schedules, changelogs or documentation. Please consult the PTB resources.

Expand All @@ -105,7 +105,7 @@ Installing both ``python-telegram-bot`` and ``python-telegram-bot-raw`` in conju
Telegram API support
====================

All types and methods of the Telegram Bot API **5.7** are supported.
All types and methods of the Telegram Bot API **6.0** are supported.

==========
Installing
Expand Down
8 changes: 8 additions & 0 deletions docs/source/telegram.chatadministratorrights.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
:github_url: https://github.com/python-telegram-bot/python-telegram-bot/blob/master/telegram/chatadministratorrights.py

telegram.ChatAdministratorRights
================================

.. autoclass:: telegram.ChatAdministratorRights
:members:
:show-inheritance:
8 changes: 8 additions & 0 deletions docs/source/telegram.menubutton.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
:github_url: https://github.com/python-telegram-bot/python-telegram-bot/blob/master/telegram/menubutton.py

telegram.MenuButton
===================

.. autoclass:: telegram.MenuButton
:members:
:show-inheritance:
8 changes: 8 additions & 0 deletions docs/source/telegram.menubuttoncommands.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
:github_url: https://github.com/python-telegram-bot/python-telegram-bot/blob/master/telegram/menubutton.py

telegram.MenuButtonCommands
===========================

.. autoclass:: telegram.MenuButtonCommands
:members:
:show-inheritance:
8 changes: 8 additions & 0 deletions docs/source/telegram.menubuttondefault.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
:github_url: https://github.com/python-telegram-bot/python-telegram-bot/blob/master/telegram/menubutton.py

telegram.MenuButtonDefault
==========================

.. autoclass:: telegram.MenuButtonDefault
:members:
:show-inheritance:
8 changes: 8 additions & 0 deletions docs/source/telegram.menubuttonwebapp.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
:github_url: https://github.com/python-telegram-bot/python-telegram-bot/blob/master/telegram/menubutton.py

telegram.MenuButtonWebApp
=========================

.. autoclass:: telegram.MenuButtonWebApp
:members:
:show-inheritance:
12 changes: 12 additions & 0 deletions docs/source/telegram.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ telegram package
telegram.botcommandscopechatmember
telegram.callbackquery
telegram.chat
telegram.chatadministratorrights
telegram.chataction
telegram.chatinvitelink
telegram.chatjoinrequest
Expand Down Expand Up @@ -51,6 +52,10 @@ telegram package
telegram.keyboardbuttonpolltype
telegram.location
telegram.loginurl
telegram.menubutton
telegram.menubuttoncommands
telegram.menubuttondefault
telegram.menubuttonwebapp
telegram.message
telegram.messageautodeletetimerchanged
telegram.messageid
Expand All @@ -64,18 +69,25 @@ telegram package
telegram.replykeyboardremove
telegram.replykeyboardmarkup
telegram.replymarkup
telegram.sentwebappmessage
telegram.telegramobject
telegram.update
telegram.user
telegram.userprofilephotos
telegram.venue
telegram.video
telegram.videochatended
telegram.videochatparticipantsinvited
telegram.videochatscheduled
telegram.videochatstarted
telegram.videonote
telegram.voice
telegram.voicechatstarted
telegram.voicechatended
telegram.voicechatscheduled
telegram.voicechatparticipantsinvited
telegram.webappdata
telegram.webappinfo
telegram.webhookinfo

Stickers
Expand Down
8 changes: 8 additions & 0 deletions docs/source/telegram.sentwebappmessage.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
:github_url: https://github.com/python-telegram-bot/python-telegram-bot/blob/master/telegram/sentwebappmessage.py

telegram.SentWebAppMessage
==========================

.. autoclass:: telegram.SentWebAppMessage
:members:
:show-inheritance:
9 changes: 9 additions & 0 deletions docs/source/telegram.videochatended.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
:github_url: https://github.com/python-telegram-bot/python-telegram-bot/blob/master/telegram/videochatended.py

telegram.VideoChatEnded
=======================

.. autoclass:: telegram.VideoChatEnded
:members:
:show-inheritance:

8 changes: 8 additions & 0 deletions docs/source/telegram.videochatparticipantsinvited.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
:github_url: https://github.com/python-telegram-bot/python-telegram-bot/blob/master/telegram/videochatparticipantsinvited.py

telegram.VideoChatParticipantsInvited
=====================================

.. autoclass:: telegram.VideoChatParticipantsInvited
:members:
:show-inheritance:
8 changes: 8 additions & 0 deletions docs/source/telegram.videochatscheduled.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
:github_url: https://github.com/python-telegram-bot/python-telegram-bot/blob/master/telegram/videochatscheduled.py

telegram.VideoChatScheduled
===========================

.. autoclass:: telegram.VideoChatScheduled
:members:
:show-inheritance:
8 changes: 8 additions & 0 deletions docs/source/telegram.videochatstarted.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
:github_url: https://github.com/python-telegram-bot/python-telegram-bot/blob/master/telegram/videochatstarted.py

telegram.VideoChatStarted
=========================

.. autoclass:: telegram.VideoChatStarted
:members:
:show-inheritance:
2 changes: 2 additions & 0 deletions docs/source/telegram.voicechatended.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ telegram.VoiceChatEnded
:members:
:show-inheritance:

.. versionchanged:: v13.12
Since Bot API 6.0, voice chat was renamed to video chat.
2 changes: 2 additions & 0 deletions docs/source/telegram.voicechatparticipantsinvited.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ telegram.VoiceChatParticipantsInvited
:members:
:show-inheritance:

.. versionchanged:: v13.12
Since Bot API 6.0, voice chat was renamed to video chat.
2 changes: 2 additions & 0 deletions docs/source/telegram.voicechatscheduled.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ telegram.VoiceChatScheduled
:members:
:show-inheritance:

.. versionchanged:: v13.12
Since Bot API 6.0, voice chat was renamed to video chat.
2 changes: 2 additions & 0 deletions docs/source/telegram.voicechatstarted.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ telegram.VoiceChatStarted
:members:
:show-inheritance:

.. versionchanged:: v13.12
Since Bot API 6.0, voice chat was renamed to video chat.
8 changes: 8 additions & 0 deletions docs/source/telegram.webappdata.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
:github_url: https://github.com/python-telegram-bot/python-telegram-bot/blob/master/telegram/webappdata.py

telegram.WebAppData
===================

.. autoclass:: telegram.WebAppData
:members:
:show-inheritance:
8 changes: 8 additions & 0 deletions docs/source/telegram.webappinfo.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
:github_url: https://github.com/python-telegram-bot/python-telegram-bot/blob/master/telegram/webappinfo.py

telegram.WebAppInfo
===================

.. autoclass:: telegram.WebAppInfo
:members:
:show-inheritance:
28 changes: 10 additions & 18 deletions examples/chatmemberbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,16 @@ def extract_status_change(
return None

old_status, new_status = status_change
was_member = (
old_status
in [
ChatMember.MEMBER,
ChatMember.CREATOR,
ChatMember.ADMINISTRATOR,
]
or (old_status == ChatMember.RESTRICTED and old_is_member is True)
)
is_member = (
new_status
in [
ChatMember.MEMBER,
ChatMember.CREATOR,
ChatMember.ADMINISTRATOR,
]
or (new_status == ChatMember.RESTRICTED and new_is_member is True)
)
was_member = old_status in [
ChatMember.MEMBER,
ChatMember.CREATOR,
ChatMember.ADMINISTRATOR,
] or (old_status == ChatMember.RESTRICTED and old_is_member is True)
is_member = new_status in [
ChatMember.MEMBER,
ChatMember.CREATOR,
ChatMember.ADMINISTRATOR,
] or (new_status == ChatMember.RESTRICTED and new_is_member is True)

return was_member, is_member

Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cryptography!=3.4,!=3.4.1,!=3.4.2,!=3.4.3

pre-commit
# Make sure that the versions specified here match the pre-commit settings!
black==20.8b1
black==22.3.0
flake8==3.9.2
pylint==2.8.3
mypy==0.812
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ def get_setup_kwargs(raw=False):
'Topic :: Internet',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
Expand Down
Loading