- Notifications
You must be signed in to change notification settings - Fork5.7k
API 7.2#4180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
API 7.2#4180
Changes fromall commits
Commits
Show all changes
32 commits Select commitHold shift + click to select a range
1fbac17
Add new parameter to bot methods and 2 new business params in Message
harshil214b0e7fc
Remove whitespace detected by ruff
harshil21af341cc
Bump bot api version number
harshil21735ed1e
fix pre-commit
harshil219c35dbd
doc fix
harshil21badf3fc
Add new parameters to Update along with the new method
harshil216bb22f4
forgot to add method to extbot
harshil211b33dfa
Add new handlers and filters
harshil21dc3c1b9
fix doc build and improve type completeness
harshil213ff7a68
Apply Sticker method and pack changes
harshil21e942ebf
fix tests again
harshil21dcb471e
Feat: add the field `is_from_offline` to the class `Message` (#4189)
mahdyar17b295a
Merge branch 'master' into api-7.2
Bibo-Joshi6b6fcf5
Revert "Temporarily Mark Tests with `get_sticker_set` as XFAIL due to…
Bibo-Joshic67f751
Make test_drop_callback_data use NonchalantHttpxRequest to avoid floo…
harshil219250017
Add Birthdate class and field to Chat
harshil21a1f86c6
Add replace_sticker_in_set method
harshil21a9e0eda
Add can_connect_to_business field
harshil213d513ec
Add personal_chat to Chat
harshil21c350584
Add filters.IS_FROM_OFFLINE
harshil21f927ad0
Update test_official
harshil21275fd33
Improve test coverage
harshil21b3becd6
Doc fix for the new handlers
harshil219305a43
change business_connection_id test target
harshil21bb9bdb4
Business info (#4183)
aelkheir0f99ace
Request Chat Improvements (tests remaining)
clot276935e6a
fix pre-commit
clot2788bba66
Merge branch 'master' into api-7.2
Bibo-Joshi91b1da6
Review: remove business_connection_id from Message methods
harshil218addbf4
Work on UsersShared
Bibo-Joshib1af7d5
Work on tests
Bibo-Joshi0fb2322
Fix docs and add TestSharedUser
Bibo-JoshiFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
4 changes: 2 additions & 2 deletionsREADME.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletionsREADME_RAW.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
12 changes: 8 additions & 4 deletionsdocs/source/inclusions/bot_methods.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletionsdocs/source/telegram.at-tree.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletionsdocs/source/telegram.birthdate.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Birthdate | ||
========= | ||
.. autoclass:: telegram.Birthdate | ||
:members: | ||
:show-inheritance: | ||
6 changes: 6 additions & 0 deletionsdocs/source/telegram.businessconnection.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
BusinessConnection | ||
================== | ||
.. autoclass:: telegram.BusinessConnection | ||
:members: | ||
:show-inheritance: |
6 changes: 6 additions & 0 deletionsdocs/source/telegram.businessintro.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
BusinessIntro | ||
================== | ||
.. autoclass:: telegram.BusinessIntro | ||
:members: | ||
:show-inheritance: |
6 changes: 6 additions & 0 deletionsdocs/source/telegram.businesslocation.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
BusinessLocation | ||
================== | ||
.. autoclass:: telegram.BusinessLocation | ||
:members: | ||
:show-inheritance: |
6 changes: 6 additions & 0 deletionsdocs/source/telegram.businessmessagesdeleted.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
BusinessMessagesDeleted | ||
======================= | ||
.. autoclass:: telegram.BusinessMessagesDeleted | ||
:members: | ||
:show-inheritance: |
6 changes: 6 additions & 0 deletionsdocs/source/telegram.businessopeninghours.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
BusinessOpeningHours | ||
==================== | ||
.. autoclass:: telegram.BusinessOpeningHours | ||
:members: | ||
:show-inheritance: |
6 changes: 6 additions & 0 deletionsdocs/source/telegram.businessopeninghoursinterval.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
BusinessOpeningHoursInterval | ||
============================ | ||
.. autoclass:: telegram.BusinessOpeningHoursInterval | ||
:members: | ||
:show-inheritance: |
6 changes: 6 additions & 0 deletionsdocs/source/telegram.ext.businessconnectionhandler.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
BusinessConnectionHandler | ||
========================= | ||
.. autoclass:: telegram.ext.BusinessConnectionHandler | ||
:members: | ||
:show-inheritance: |
6 changes: 6 additions & 0 deletionsdocs/source/telegram.ext.businessmessagesdeletedhandler.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
BusinessMessagesDeletedHandler | ||
============================== | ||
.. autoclass:: telegram.ext.BusinessMessagesDeletedHandler | ||
:members: | ||
:show-inheritance: |
2 changes: 2 additions & 0 deletionsdocs/source/telegram.ext.handlers-tree.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletionsdocs/source/telegram.shareduser.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
SharedUser | ||
========== | ||
.. autoclass:: telegram.SharedUser | ||
:members: | ||
:show-inheritance: | ||
2 changes: 2 additions & 0 deletionsdocs/substitutions/global.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletionpyproject.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
19 changes: 18 additions & 1 deletiontelegram/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletionstelegram/_birthdate.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
#!/usr/bin/env python | ||
# | ||
# A library that provides a Python interface to the Telegram Bot API | ||
# Copyright (C) 2015-2024 | ||
# 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 Birthday.""" | ||
from datetime import datetime | ||
from typing import Optional | ||
from telegram._telegramobject import TelegramObject | ||
from telegram._utils.types import JSONDict | ||
class Birthdate(TelegramObject): | ||
""" | ||
This object represents a user's birthday. | ||
Objects of this class are comparable in terms of equality. Two objects of this class are | ||
considered equal, if their :attr:`day`, and :attr:`month` are equal. | ||
.. versionadded:: NEXT.VERSION | ||
Args: | ||
day (:obj:`int`): Day of the user's birth; 1-31. | ||
month (:obj:`int`): Month of the user's birth; 1-12. | ||
year (:obj:`int`, optional): Year of the user's birth. | ||
Attributes: | ||
day (:obj:`int`): Day of the user's birth; 1-31. | ||
month (:obj:`int`): Month of the user's birth; 1-12. | ||
year (:obj:`int`): Optional. Year of the user's birth. | ||
""" | ||
__slots__ = ("day", "month", "year") | ||
def __init__( | ||
self, | ||
day: int, | ||
month: int, | ||
year: Optional[int] = None, | ||
*, | ||
api_kwargs: Optional[JSONDict] = None, | ||
): | ||
super().__init__(api_kwargs=api_kwargs) | ||
# Required | ||
self.day: int = day | ||
self.month: int = month | ||
# Optional | ||
self.year: Optional[int] = year | ||
self._id_attrs = ( | ||
self.day, | ||
self.month, | ||
) | ||
self._freeze() | ||
def to_date(self, year: Optional[int] = None) -> datetime: | ||
"""Return the birthdate as a datetime object. | ||
Args: | ||
year (:obj:`int`, optional): The year to use. Required, if the :attr:`year` was not | ||
present. | ||
Returns: | ||
:obj:`datetime.datetime`: The birthdate as a datetime object. | ||
""" | ||
if self.year is None and year is None: | ||
raise ValueError( | ||
"The `year` argument is required if the `year` attribute was not present." | ||
) | ||
return datetime(year or self.year, self.month, self.day) # type: ignore[arg-type] |
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.