mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-29 13:27:47 +00:00
Rename PyrogramType to Object
This commit is contained in:
parent
d5517f4d5f
commit
9a44c79a82
@ -22,12 +22,12 @@ import pyrogram
|
|||||||
from pyrogram.api import types
|
from pyrogram.api import types
|
||||||
from .inline_query_result import InlineQueryResult
|
from .inline_query_result import InlineQueryResult
|
||||||
from ..messages_and_media import Location
|
from ..messages_and_media import Location
|
||||||
from ..pyrogram_type import PyrogramType
|
from ..object import Object
|
||||||
from ..update import Update
|
from ..update import Update
|
||||||
from ..user_and_chats import User
|
from ..user_and_chats import User
|
||||||
|
|
||||||
|
|
||||||
class InlineQuery(PyrogramType, Update):
|
class InlineQuery(Object, Update):
|
||||||
"""An incoming inline query.
|
"""An incoming inline query.
|
||||||
|
|
||||||
When the user sends an empty query, your bot could return some default or trending results.
|
When the user sends an empty query, your bot could return some default or trending results.
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from ..pyrogram_type import PyrogramType
|
from ..object import Object
|
||||||
|
|
||||||
"""- :obj:`InlineQueryResultCachedAudio`
|
"""- :obj:`InlineQueryResultCachedAudio`
|
||||||
- :obj:`InlineQueryResultCachedDocument`
|
- :obj:`InlineQueryResultCachedDocument`
|
||||||
@ -39,7 +39,7 @@ from ..pyrogram_type import PyrogramType
|
|||||||
- :obj:`InlineQueryResultVoice`"""
|
- :obj:`InlineQueryResultVoice`"""
|
||||||
|
|
||||||
|
|
||||||
class InlineQueryResult(PyrogramType):
|
class InlineQueryResult(Object):
|
||||||
"""One result of an inline query.
|
"""One result of an inline query.
|
||||||
|
|
||||||
Pyrogram currently supports results of the following 20 types:
|
Pyrogram currently supports results of the following 20 types:
|
||||||
|
@ -16,10 +16,10 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from pyrogram.client.types.pyrogram_type import PyrogramType
|
from pyrogram.client.types.object import Object
|
||||||
|
|
||||||
|
|
||||||
class InlineQueryResultAudio(PyrogramType):
|
class InlineQueryResultAudio(Object):
|
||||||
"""Represents a link to an mp3 audio file. By default, this audio file will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the audio.
|
"""Represents a link to an mp3 audio file. By default, this audio file will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the audio.
|
||||||
|
|
||||||
Attributes:
|
Attributes:
|
||||||
|
@ -23,10 +23,10 @@ from pyrogram.api import types
|
|||||||
from pyrogram.errors import FileIdInvalid
|
from pyrogram.errors import FileIdInvalid
|
||||||
from pyrogram.client.ext import utils, BaseClient
|
from pyrogram.client.ext import utils, BaseClient
|
||||||
from pyrogram.client.style import HTML, Markdown
|
from pyrogram.client.style import HTML, Markdown
|
||||||
from pyrogram.client.types.pyrogram_type import PyrogramType
|
from pyrogram.client.types.object import Object
|
||||||
|
|
||||||
|
|
||||||
class InlineQueryResultCachedAudio(PyrogramType):
|
class InlineQueryResultCachedAudio(Object):
|
||||||
"""Represents a link to an audio file stored on the Telegram servers.
|
"""Represents a link to an audio file stored on the Telegram servers.
|
||||||
By default, this audio file will be sent by the user. Alternatively, you can use *input_message_content* to send a
|
By default, this audio file will be sent by the user. Alternatively, you can use *input_message_content* to send a
|
||||||
message with the specified content instead of the audio.
|
message with the specified content instead of the audio.
|
||||||
|
@ -16,10 +16,10 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from pyrogram.client.types.pyrogram_type import PyrogramType
|
from pyrogram.client.types.object import Object
|
||||||
|
|
||||||
|
|
||||||
class InlineQueryResultCachedDocument(PyrogramType):
|
class InlineQueryResultCachedDocument(Object):
|
||||||
"""Represents a link to a file stored on the Telegram servers. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the file.
|
"""Represents a link to a file stored on the Telegram servers. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the file.
|
||||||
|
|
||||||
Attributes:
|
Attributes:
|
||||||
|
@ -16,10 +16,10 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from pyrogram.client.types.pyrogram_type import PyrogramType
|
from pyrogram.client.types.object import Object
|
||||||
|
|
||||||
|
|
||||||
class InlineQueryResultCachedGif(PyrogramType):
|
class InlineQueryResultCachedGif(Object):
|
||||||
"""Represents a link to an animated GIF file stored on the Telegram servers. By default, this animated GIF file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with specified content instead of the animation.
|
"""Represents a link to an animated GIF file stored on the Telegram servers. By default, this animated GIF file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with specified content instead of the animation.
|
||||||
|
|
||||||
Attributes:
|
Attributes:
|
||||||
|
@ -16,10 +16,10 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from pyrogram.client.types.pyrogram_type import PyrogramType
|
from pyrogram.client.types.object import Object
|
||||||
|
|
||||||
|
|
||||||
class InlineQueryResultCachedMpeg4Gif(PyrogramType):
|
class InlineQueryResultCachedMpeg4Gif(Object):
|
||||||
"""Represents a link to a video animation (H.264/MPEG-4 AVC video without sound) stored on the Telegram servers. By default, this animated MPEG-4 file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation.
|
"""Represents a link to a video animation (H.264/MPEG-4 AVC video without sound) stored on the Telegram servers. By default, this animated MPEG-4 file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation.
|
||||||
|
|
||||||
Attributes:
|
Attributes:
|
||||||
|
@ -16,10 +16,10 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from pyrogram.client.types.pyrogram_type import PyrogramType
|
from pyrogram.client.types.object import Object
|
||||||
|
|
||||||
|
|
||||||
class InlineQueryResultCachedPhoto(PyrogramType):
|
class InlineQueryResultCachedPhoto(Object):
|
||||||
"""Represents a link to a photo stored on the Telegram servers. By default, this photo will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the photo.
|
"""Represents a link to a photo stored on the Telegram servers. By default, this photo will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the photo.
|
||||||
|
|
||||||
Attributes:
|
Attributes:
|
||||||
|
@ -16,10 +16,10 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from pyrogram.client.types.pyrogram_type import PyrogramType
|
from pyrogram.client.types.object import Object
|
||||||
|
|
||||||
|
|
||||||
class InlineQueryResultCachedSticker(PyrogramType):
|
class InlineQueryResultCachedSticker(Object):
|
||||||
"""Represents a link to a sticker stored on the Telegram servers. By default, this sticker will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the sticker.
|
"""Represents a link to a sticker stored on the Telegram servers. By default, this sticker will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the sticker.
|
||||||
|
|
||||||
Attributes:
|
Attributes:
|
||||||
|
@ -16,10 +16,10 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from pyrogram.client.types.pyrogram_type import PyrogramType
|
from pyrogram.client.types.object import Object
|
||||||
|
|
||||||
|
|
||||||
class InlineQueryResultCachedVideo(PyrogramType):
|
class InlineQueryResultCachedVideo(Object):
|
||||||
"""Represents a link to a video file stored on the Telegram servers. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the video.
|
"""Represents a link to a video file stored on the Telegram servers. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the video.
|
||||||
|
|
||||||
Attributes:
|
Attributes:
|
||||||
|
@ -16,10 +16,10 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from pyrogram.client.types.pyrogram_type import PyrogramType
|
from pyrogram.client.types.object import Object
|
||||||
|
|
||||||
|
|
||||||
class InlineQueryResultCachedVoice(PyrogramType):
|
class InlineQueryResultCachedVoice(Object):
|
||||||
"""Represents a link to a voice message stored on the Telegram servers. By default, this voice message will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the voice message.
|
"""Represents a link to a voice message stored on the Telegram servers. By default, this voice message will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the voice message.
|
||||||
|
|
||||||
Attributes:
|
Attributes:
|
||||||
|
@ -16,10 +16,10 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from pyrogram.client.types.pyrogram_type import PyrogramType
|
from pyrogram.client.types.object import Object
|
||||||
|
|
||||||
|
|
||||||
class InlineQueryResultContact(PyrogramType):
|
class InlineQueryResultContact(Object):
|
||||||
"""Represents a contact with a phone number. By default, this contact will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the contact.
|
"""Represents a contact with a phone number. By default, this contact will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the contact.
|
||||||
|
|
||||||
Attributes:
|
Attributes:
|
||||||
|
@ -16,10 +16,10 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from pyrogram.client.types.pyrogram_type import PyrogramType
|
from pyrogram.client.types.object import Object
|
||||||
|
|
||||||
|
|
||||||
class InlineQueryResultDocument(PyrogramType):
|
class InlineQueryResultDocument(Object):
|
||||||
"""Represents a link to a file. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the file. Currently, only .PDF and .ZIP files can be sent using this method.
|
"""Represents a link to a file. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the file. Currently, only .PDF and .ZIP files can be sent using this method.
|
||||||
|
|
||||||
Attributes:
|
Attributes:
|
||||||
|
@ -16,10 +16,10 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from pyrogram.client.types.pyrogram_type import PyrogramType
|
from pyrogram.client.types.object import Object
|
||||||
|
|
||||||
|
|
||||||
class InlineQueryResultGame(PyrogramType):
|
class InlineQueryResultGame(Object):
|
||||||
"""Represents a Game.
|
"""Represents a Game.
|
||||||
|
|
||||||
Attributes:
|
Attributes:
|
||||||
|
@ -16,10 +16,10 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from pyrogram.client.types.pyrogram_type import PyrogramType
|
from pyrogram.client.types.object import Object
|
||||||
|
|
||||||
|
|
||||||
class InlineQueryResultGif(PyrogramType):
|
class InlineQueryResultGif(Object):
|
||||||
"""Represents a link to an animated GIF file. By default, this animated GIF file will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation.
|
"""Represents a link to an animated GIF file. By default, this animated GIF file will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation.
|
||||||
|
|
||||||
Attributes:
|
Attributes:
|
||||||
|
@ -16,10 +16,10 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from pyrogram.client.types.pyrogram_type import PyrogramType
|
from pyrogram.client.types.object import Object
|
||||||
|
|
||||||
|
|
||||||
class InlineQueryResultLocation(PyrogramType):
|
class InlineQueryResultLocation(Object):
|
||||||
"""Represents a location on a map. By default, the location will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the location.
|
"""Represents a location on a map. By default, the location will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the location.
|
||||||
|
|
||||||
Attributes:
|
Attributes:
|
||||||
|
@ -16,10 +16,10 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from pyrogram.client.types.pyrogram_type import PyrogramType
|
from pyrogram.client.types.object import Object
|
||||||
|
|
||||||
|
|
||||||
class InlineQueryResultMpeg4Gif(PyrogramType):
|
class InlineQueryResultMpeg4Gif(Object):
|
||||||
"""Represents a link to a video animation (H.264/MPEG-4 AVC video without sound). By default, this animated MPEG-4 file will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation.
|
"""Represents a link to a video animation (H.264/MPEG-4 AVC video without sound). By default, this animated MPEG-4 file will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation.
|
||||||
|
|
||||||
Attributes:
|
Attributes:
|
||||||
|
@ -18,10 +18,10 @@
|
|||||||
|
|
||||||
from pyrogram.api import types
|
from pyrogram.api import types
|
||||||
from pyrogram.client.style import HTML, Markdown
|
from pyrogram.client.style import HTML, Markdown
|
||||||
from pyrogram.client.types.pyrogram_type import PyrogramType
|
from pyrogram.client.types.object import Object
|
||||||
|
|
||||||
|
|
||||||
class InlineQueryResultPhoto(PyrogramType):
|
class InlineQueryResultPhoto(Object):
|
||||||
"""Represents a link to a photo. By default, this photo will be sent by the user with optional caption.
|
"""Represents a link to a photo. By default, this photo will be sent by the user with optional caption.
|
||||||
Alternatively, you can use input_message_content to send a message with the specified content instead of the photo.
|
Alternatively, you can use input_message_content to send a message with the specified content instead of the photo.
|
||||||
|
|
||||||
|
@ -16,10 +16,10 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from pyrogram.client.types.pyrogram_type import PyrogramType
|
from pyrogram.client.types.object import Object
|
||||||
|
|
||||||
|
|
||||||
class InlineQueryResultVenue(PyrogramType):
|
class InlineQueryResultVenue(Object):
|
||||||
"""Represents a venue. By default, the venue will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the venue.
|
"""Represents a venue. By default, the venue will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the venue.
|
||||||
|
|
||||||
Attributes:
|
Attributes:
|
||||||
|
@ -16,10 +16,10 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from pyrogram.client.types.pyrogram_type import PyrogramType
|
from pyrogram.client.types.object import Object
|
||||||
|
|
||||||
|
|
||||||
class InlineQueryResultVideo(PyrogramType):
|
class InlineQueryResultVideo(Object):
|
||||||
"""Represents a link to a page containing an embedded video player or a video file. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the video.
|
"""Represents a link to a page containing an embedded video player or a video file. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the video.
|
||||||
|
|
||||||
Attributes:
|
Attributes:
|
||||||
|
@ -16,10 +16,10 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from pyrogram.client.types.pyrogram_type import PyrogramType
|
from pyrogram.client.types.object import Object
|
||||||
|
|
||||||
|
|
||||||
class InlineQueryResultVoice(PyrogramType):
|
class InlineQueryResultVoice(Object):
|
||||||
"""Represents a link to a voice recording in an .ogg container encoded with OPUS. By default, this voice recording will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the the voice message.
|
"""Represents a link to a voice recording in an .ogg container encoded with OPUS. By default, this voice recording will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the the voice message.
|
||||||
|
|
||||||
Attributes:
|
Attributes:
|
||||||
|
@ -16,10 +16,10 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from ..pyrogram_type import PyrogramType
|
from ..object import Object
|
||||||
|
|
||||||
|
|
||||||
class InputMedia(PyrogramType):
|
class InputMedia(Object):
|
||||||
"""Content of a media message to be sent.
|
"""Content of a media message to be sent.
|
||||||
|
|
||||||
It should be one of:
|
It should be one of:
|
||||||
|
@ -18,10 +18,10 @@
|
|||||||
|
|
||||||
from pyrogram.api.types import InputPhoneContact as RawInputPhoneContact
|
from pyrogram.api.types import InputPhoneContact as RawInputPhoneContact
|
||||||
from pyrogram.session.internals import MsgId
|
from pyrogram.session.internals import MsgId
|
||||||
from ..pyrogram_type import PyrogramType
|
from ..object import Object
|
||||||
|
|
||||||
|
|
||||||
class InputPhoneContact(PyrogramType):
|
class InputPhoneContact(Object):
|
||||||
"""A Phone Contact to be added in your Telegram address book.
|
"""A Phone Contact to be added in your Telegram address book.
|
||||||
It is intended to be used with :meth:`~Client.add_contacts() <pyrogram.Client.add_contacts>`
|
It is intended to be used with :meth:`~Client.add_contacts() <pyrogram.Client.add_contacts>`
|
||||||
|
|
||||||
|
@ -16,14 +16,14 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from ..pyrogram_type import PyrogramType
|
from ..object import Object
|
||||||
|
|
||||||
"""- :obj:`InputLocationMessageContent`
|
"""- :obj:`InputLocationMessageContent`
|
||||||
- :obj:`InputVenueMessageContent`
|
- :obj:`InputVenueMessageContent`
|
||||||
- :obj:`InputContactMessageContent`"""
|
- :obj:`InputContactMessageContent`"""
|
||||||
|
|
||||||
|
|
||||||
class InputMessageContent(PyrogramType):
|
class InputMessageContent(Object):
|
||||||
"""Content of a message to be sent as a result of an inline query.
|
"""Content of a message to be sent as a result of an inline query.
|
||||||
|
|
||||||
Pyrogram currently supports the following 4 types:
|
Pyrogram currently supports the following 4 types:
|
||||||
|
@ -16,10 +16,10 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from ..pyrogram_type import PyrogramType
|
from ..object import Object
|
||||||
|
|
||||||
|
|
||||||
class CallbackGame(PyrogramType):
|
class CallbackGame(Object):
|
||||||
"""Placeholder, currently holds no information.
|
"""Placeholder, currently holds no information.
|
||||||
|
|
||||||
Use BotFather to set up your game.
|
Use BotFather to set up your game.
|
||||||
|
@ -22,12 +22,12 @@ from typing import Union
|
|||||||
|
|
||||||
import pyrogram
|
import pyrogram
|
||||||
from pyrogram.api import types
|
from pyrogram.api import types
|
||||||
from ..pyrogram_type import PyrogramType
|
from ..object import Object
|
||||||
from ..update import Update
|
from ..update import Update
|
||||||
from ..user_and_chats import User
|
from ..user_and_chats import User
|
||||||
|
|
||||||
|
|
||||||
class CallbackQuery(PyrogramType, Update):
|
class CallbackQuery(Object, Update):
|
||||||
"""An incoming callback query from a callback button in an inline keyboard.
|
"""An incoming callback query from a callback button in an inline keyboard.
|
||||||
|
|
||||||
If the button that originated the query was attached to a message sent by the bot, the field *message*
|
If the button that originated the query was attached to a message sent by the bot, the field *message*
|
||||||
|
@ -17,10 +17,10 @@
|
|||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from pyrogram.api.types import ReplyKeyboardForceReply
|
from pyrogram.api.types import ReplyKeyboardForceReply
|
||||||
from ..pyrogram_type import PyrogramType
|
from ..object import Object
|
||||||
|
|
||||||
|
|
||||||
class ForceReply(PyrogramType):
|
class ForceReply(Object):
|
||||||
"""Object used to force clients to show a reply interface.
|
"""Object used to force clients to show a reply interface.
|
||||||
|
|
||||||
Upon receiving a message with this object, Telegram clients will display a reply interface to the user.
|
Upon receiving a message with this object, Telegram clients will display a reply interface to the user.
|
||||||
|
@ -19,11 +19,11 @@
|
|||||||
import pyrogram
|
import pyrogram
|
||||||
|
|
||||||
from pyrogram.api import types
|
from pyrogram.api import types
|
||||||
from pyrogram.client.types.pyrogram_type import PyrogramType
|
from pyrogram.client.types.object import Object
|
||||||
from pyrogram.client.types.user_and_chats import User
|
from pyrogram.client.types.user_and_chats import User
|
||||||
|
|
||||||
|
|
||||||
class GameHighScore(PyrogramType):
|
class GameHighScore(Object):
|
||||||
"""One row of the high scores table for a game.
|
"""One row of the high scores table for a game.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
|
@ -20,11 +20,11 @@ from typing import List
|
|||||||
|
|
||||||
import pyrogram
|
import pyrogram
|
||||||
from pyrogram.api import types
|
from pyrogram.api import types
|
||||||
from pyrogram.client.types.pyrogram_type import PyrogramType
|
from pyrogram.client.types.object import Object
|
||||||
from .game_high_score import GameHighScore
|
from .game_high_score import GameHighScore
|
||||||
|
|
||||||
|
|
||||||
class GameHighScores(PyrogramType):
|
class GameHighScores(Object):
|
||||||
"""The high scores table for a game.
|
"""The high scores table for a game.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
|
@ -23,10 +23,10 @@ from pyrogram.api.types import (
|
|||||||
KeyboardButtonSwitchInline, KeyboardButtonGame
|
KeyboardButtonSwitchInline, KeyboardButtonGame
|
||||||
)
|
)
|
||||||
from .callback_game import CallbackGame
|
from .callback_game import CallbackGame
|
||||||
from ..pyrogram_type import PyrogramType
|
from ..object import Object
|
||||||
|
|
||||||
|
|
||||||
class InlineKeyboardButton(PyrogramType):
|
class InlineKeyboardButton(Object):
|
||||||
"""One button of an inline keyboard.
|
"""One button of an inline keyboard.
|
||||||
|
|
||||||
You must use exactly one of the optional fields.
|
You must use exactly one of the optional fields.
|
||||||
|
@ -20,10 +20,10 @@ from typing import List
|
|||||||
|
|
||||||
from pyrogram.api.types import ReplyInlineMarkup, KeyboardButtonRow
|
from pyrogram.api.types import ReplyInlineMarkup, KeyboardButtonRow
|
||||||
from . import InlineKeyboardButton
|
from . import InlineKeyboardButton
|
||||||
from ..pyrogram_type import PyrogramType
|
from ..object import Object
|
||||||
|
|
||||||
|
|
||||||
class InlineKeyboardMarkup(PyrogramType):
|
class InlineKeyboardMarkup(Object):
|
||||||
"""An inline keyboard that appears right next to the message it belongs to.
|
"""An inline keyboard that appears right next to the message it belongs to.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
|
@ -18,10 +18,10 @@
|
|||||||
|
|
||||||
from pyrogram.api.types import KeyboardButton as RawKeyboardButton
|
from pyrogram.api.types import KeyboardButton as RawKeyboardButton
|
||||||
from pyrogram.api.types import KeyboardButtonRequestPhone, KeyboardButtonRequestGeoLocation
|
from pyrogram.api.types import KeyboardButtonRequestPhone, KeyboardButtonRequestGeoLocation
|
||||||
from ..pyrogram_type import PyrogramType
|
from ..object import Object
|
||||||
|
|
||||||
|
|
||||||
class KeyboardButton(PyrogramType):
|
class KeyboardButton(Object):
|
||||||
"""One button of the reply keyboard.
|
"""One button of the reply keyboard.
|
||||||
For simple text buttons String can be used instead of this object to specify text of the button.
|
For simple text buttons String can be used instead of this object to specify text of the button.
|
||||||
Optional fields are mutually exclusive.
|
Optional fields are mutually exclusive.
|
||||||
|
@ -21,10 +21,10 @@ from typing import List, Union
|
|||||||
from pyrogram.api.types import KeyboardButtonRow
|
from pyrogram.api.types import KeyboardButtonRow
|
||||||
from pyrogram.api.types import ReplyKeyboardMarkup as RawReplyKeyboardMarkup
|
from pyrogram.api.types import ReplyKeyboardMarkup as RawReplyKeyboardMarkup
|
||||||
from . import KeyboardButton
|
from . import KeyboardButton
|
||||||
from ..pyrogram_type import PyrogramType
|
from ..object import Object
|
||||||
|
|
||||||
|
|
||||||
class ReplyKeyboardMarkup(PyrogramType):
|
class ReplyKeyboardMarkup(Object):
|
||||||
"""A custom keyboard with reply options.
|
"""A custom keyboard with reply options.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
|
@ -17,10 +17,10 @@
|
|||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from pyrogram.api.types import ReplyKeyboardHide
|
from pyrogram.api.types import ReplyKeyboardHide
|
||||||
from ..pyrogram_type import PyrogramType
|
from ..object import Object
|
||||||
|
|
||||||
|
|
||||||
class ReplyKeyboardRemove(PyrogramType):
|
class ReplyKeyboardRemove(Object):
|
||||||
"""Object used to tell clients to remove a bot keyboard.
|
"""Object used to tell clients to remove a bot keyboard.
|
||||||
|
|
||||||
Upon receiving a message with this object, Telegram clients will remove the current custom keyboard and display
|
Upon receiving a message with this object, Telegram clients will remove the current custom keyboard and display
|
||||||
|
@ -16,17 +16,17 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from .pyrogram_type import PyrogramType
|
from .object import Object
|
||||||
|
|
||||||
|
|
||||||
class PyrogramList(list):
|
class List(list):
|
||||||
__slots__ = []
|
__slots__ = []
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
# noinspection PyCallByClass
|
# noinspection PyCallByClass
|
||||||
return PyrogramType.__str__(self)
|
return Object.__str__(self)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "pyrogram.client.types.pyrogram_list.PyrogramList([{}])".format(
|
return "pyrogram.client.types.pyrogram_list.PyrogramList([{}])".format(
|
||||||
",".join(PyrogramType.__repr__(i) for i in self)
|
",".join(Object.__repr__(i) for i in self)
|
||||||
)
|
)
|
@ -22,11 +22,11 @@ from typing import List
|
|||||||
import pyrogram
|
import pyrogram
|
||||||
from pyrogram.api import types
|
from pyrogram.api import types
|
||||||
from .thumbnail import Thumbnail
|
from .thumbnail import Thumbnail
|
||||||
from ..pyrogram_type import PyrogramType
|
from ..object import Object
|
||||||
from ...ext.utils import encode
|
from ...ext.utils import encode
|
||||||
|
|
||||||
|
|
||||||
class Animation(PyrogramType):
|
class Animation(Object):
|
||||||
"""An animation file (GIF or H.264/MPEG-4 AVC video without sound).
|
"""An animation file (GIF or H.264/MPEG-4 AVC video without sound).
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
|
@ -22,11 +22,11 @@ from typing import List
|
|||||||
import pyrogram
|
import pyrogram
|
||||||
from pyrogram.api import types
|
from pyrogram.api import types
|
||||||
from .thumbnail import Thumbnail
|
from .thumbnail import Thumbnail
|
||||||
from ..pyrogram_type import PyrogramType
|
from ..object import Object
|
||||||
from ...ext.utils import encode
|
from ...ext.utils import encode
|
||||||
|
|
||||||
|
|
||||||
class Audio(PyrogramType):
|
class Audio(Object):
|
||||||
"""An audio file to be treated as music by the Telegram clients.
|
"""An audio file to be treated as music by the Telegram clients.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
|
@ -19,10 +19,10 @@
|
|||||||
import pyrogram
|
import pyrogram
|
||||||
|
|
||||||
from pyrogram.api import types
|
from pyrogram.api import types
|
||||||
from ..pyrogram_type import PyrogramType
|
from ..object import Object
|
||||||
|
|
||||||
|
|
||||||
class Contact(PyrogramType):
|
class Contact(Object):
|
||||||
"""A phone contact.
|
"""A phone contact.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
|
@ -22,11 +22,11 @@ from typing import List
|
|||||||
import pyrogram
|
import pyrogram
|
||||||
from pyrogram.api import types
|
from pyrogram.api import types
|
||||||
from .thumbnail import Thumbnail
|
from .thumbnail import Thumbnail
|
||||||
from ..pyrogram_type import PyrogramType
|
from ..object import Object
|
||||||
from ...ext.utils import encode
|
from ...ext.utils import encode
|
||||||
|
|
||||||
|
|
||||||
class Document(PyrogramType):
|
class Document(Object):
|
||||||
"""A generic file (as opposed to photos, voice messages, audio files, ...).
|
"""A generic file (as opposed to photos, voice messages, audio files, ...).
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
|
@ -20,10 +20,10 @@ import pyrogram
|
|||||||
from pyrogram.api import types
|
from pyrogram.api import types
|
||||||
from .animation import Animation
|
from .animation import Animation
|
||||||
from .photo import Photo
|
from .photo import Photo
|
||||||
from ..pyrogram_type import PyrogramType
|
from ..object import Object
|
||||||
|
|
||||||
|
|
||||||
class Game(PyrogramType):
|
class Game(Object):
|
||||||
"""A game.
|
"""A game.
|
||||||
Use BotFather to create and edit games, their short names will act as unique identifiers.
|
Use BotFather to create and edit games, their short names will act as unique identifiers.
|
||||||
|
|
||||||
|
@ -19,10 +19,10 @@
|
|||||||
import pyrogram
|
import pyrogram
|
||||||
|
|
||||||
from pyrogram.api import types
|
from pyrogram.api import types
|
||||||
from ..pyrogram_type import PyrogramType
|
from ..object import Object
|
||||||
|
|
||||||
|
|
||||||
class Location(PyrogramType):
|
class Location(Object):
|
||||||
"""A point on the map.
|
"""A point on the map.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
|
@ -27,7 +27,7 @@ from .contact import Contact
|
|||||||
from .location import Location
|
from .location import Location
|
||||||
from .message_entity import MessageEntity
|
from .message_entity import MessageEntity
|
||||||
from ..messages_and_media.photo import Photo
|
from ..messages_and_media.photo import Photo
|
||||||
from ..pyrogram_type import PyrogramType
|
from ..object import Object
|
||||||
from ..update import Update
|
from ..update import Update
|
||||||
from ..user_and_chats.chat import Chat
|
from ..user_and_chats.chat import Chat
|
||||||
from ..user_and_chats.user import User
|
from ..user_and_chats.user import User
|
||||||
@ -59,7 +59,7 @@ class Str(str):
|
|||||||
return self._client.html.unparse(self, self._entities)
|
return self._client.html.unparse(self, self._entities)
|
||||||
|
|
||||||
|
|
||||||
class Message(PyrogramType, Update):
|
class Message(Object, Update):
|
||||||
"""A message.
|
"""A message.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
|
@ -19,11 +19,11 @@
|
|||||||
import pyrogram
|
import pyrogram
|
||||||
|
|
||||||
from pyrogram.api import types
|
from pyrogram.api import types
|
||||||
from ..pyrogram_type import PyrogramType
|
from ..object import Object
|
||||||
from ..user_and_chats.user import User
|
from ..user_and_chats.user import User
|
||||||
|
|
||||||
|
|
||||||
class MessageEntity(PyrogramType):
|
class MessageEntity(Object):
|
||||||
"""One special entity in a text message.
|
"""One special entity in a text message.
|
||||||
For example, hashtags, usernames, URLs, etc.
|
For example, hashtags, usernames, URLs, etc.
|
||||||
|
|
||||||
|
@ -21,12 +21,12 @@ from typing import List, Union
|
|||||||
import pyrogram
|
import pyrogram
|
||||||
from pyrogram.api import types
|
from pyrogram.api import types
|
||||||
from .message import Message
|
from .message import Message
|
||||||
from ..pyrogram_type import PyrogramType
|
from ..object import Object
|
||||||
from ..update import Update
|
from ..update import Update
|
||||||
from ..user_and_chats import Chat
|
from ..user_and_chats import Chat
|
||||||
|
|
||||||
|
|
||||||
class Messages(PyrogramType, Update):
|
class Messages(Object, Update):
|
||||||
"""Contains a chat's messages.
|
"""Contains a chat's messages.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
|
@ -22,11 +22,11 @@ from typing import List
|
|||||||
import pyrogram
|
import pyrogram
|
||||||
from pyrogram.api import types
|
from pyrogram.api import types
|
||||||
from .thumbnail import Thumbnail
|
from .thumbnail import Thumbnail
|
||||||
from ..pyrogram_type import PyrogramType
|
from ..object import Object
|
||||||
from ...ext.utils import encode
|
from ...ext.utils import encode
|
||||||
|
|
||||||
|
|
||||||
class Photo(PyrogramType):
|
class Photo(Object):
|
||||||
"""A Photo.
|
"""A Photo.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
|
@ -20,10 +20,10 @@ from typing import List
|
|||||||
|
|
||||||
import pyrogram
|
import pyrogram
|
||||||
from .photo import Photo
|
from .photo import Photo
|
||||||
from ..pyrogram_type import PyrogramType
|
from ..object import Object
|
||||||
|
|
||||||
|
|
||||||
class Photos(PyrogramType):
|
class Photos(Object):
|
||||||
"""Contains a user's profile pictures.
|
"""Contains a user's profile pictures.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
|
@ -21,11 +21,11 @@ from typing import List, Union
|
|||||||
import pyrogram
|
import pyrogram
|
||||||
from pyrogram.api import types
|
from pyrogram.api import types
|
||||||
from .poll_option import PollOption
|
from .poll_option import PollOption
|
||||||
from ..pyrogram_type import PyrogramType
|
from ..object import Object
|
||||||
from ..update import Update
|
from ..update import Update
|
||||||
|
|
||||||
|
|
||||||
class Poll(PyrogramType, Update):
|
class Poll(Object, Update):
|
||||||
"""A Poll.
|
"""A Poll.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
|
@ -17,10 +17,10 @@
|
|||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import pyrogram
|
import pyrogram
|
||||||
from ..pyrogram_type import PyrogramType
|
from ..object import Object
|
||||||
|
|
||||||
|
|
||||||
class PollOption(PyrogramType):
|
class PollOption(Object):
|
||||||
"""Contains information about one answer option in a poll.
|
"""Contains information about one answer option in a poll.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
|
@ -24,11 +24,11 @@ import pyrogram
|
|||||||
from pyrogram.api import types, functions
|
from pyrogram.api import types, functions
|
||||||
from pyrogram.errors import StickersetInvalid
|
from pyrogram.errors import StickersetInvalid
|
||||||
from .thumbnail import Thumbnail
|
from .thumbnail import Thumbnail
|
||||||
from ..pyrogram_type import PyrogramType
|
from ..object import Object
|
||||||
from ...ext.utils import encode
|
from ...ext.utils import encode
|
||||||
|
|
||||||
|
|
||||||
class Sticker(PyrogramType):
|
class Sticker(Object):
|
||||||
"""A sticker.
|
"""A sticker.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
|
@ -18,10 +18,10 @@
|
|||||||
|
|
||||||
import pyrogram
|
import pyrogram
|
||||||
from pyrogram.api import types
|
from pyrogram.api import types
|
||||||
from ..pyrogram_type import PyrogramType
|
from ..object import Object
|
||||||
|
|
||||||
|
|
||||||
class StrippedThumbnail(PyrogramType):
|
class StrippedThumbnail(Object):
|
||||||
"""A stripped thumbnail
|
"""A stripped thumbnail
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
|
@ -23,10 +23,10 @@ import pyrogram
|
|||||||
from pyrogram.api import types
|
from pyrogram.api import types
|
||||||
from pyrogram.client.ext.utils import encode
|
from pyrogram.client.ext.utils import encode
|
||||||
from .stripped_thumbnail import StrippedThumbnail
|
from .stripped_thumbnail import StrippedThumbnail
|
||||||
from ..pyrogram_type import PyrogramType
|
from ..object import Object
|
||||||
|
|
||||||
|
|
||||||
class Thumbnail(PyrogramType):
|
class Thumbnail(Object):
|
||||||
"""One size of a photo or a file/sticker thumbnail.
|
"""One size of a photo or a file/sticker thumbnail.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
|
@ -19,10 +19,10 @@
|
|||||||
import pyrogram
|
import pyrogram
|
||||||
from pyrogram.api import types
|
from pyrogram.api import types
|
||||||
from .location import Location
|
from .location import Location
|
||||||
from ..pyrogram_type import PyrogramType
|
from ..object import Object
|
||||||
|
|
||||||
|
|
||||||
class Venue(PyrogramType):
|
class Venue(Object):
|
||||||
"""A venue.
|
"""A venue.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
|
@ -22,11 +22,11 @@ from typing import List
|
|||||||
import pyrogram
|
import pyrogram
|
||||||
from pyrogram.api import types
|
from pyrogram.api import types
|
||||||
from .thumbnail import Thumbnail
|
from .thumbnail import Thumbnail
|
||||||
from ..pyrogram_type import PyrogramType
|
from ..object import Object
|
||||||
from ...ext.utils import encode
|
from ...ext.utils import encode
|
||||||
|
|
||||||
|
|
||||||
class Video(PyrogramType):
|
class Video(Object):
|
||||||
"""A video file.
|
"""A video file.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
|
@ -22,11 +22,11 @@ from typing import List
|
|||||||
import pyrogram
|
import pyrogram
|
||||||
from pyrogram.api import types
|
from pyrogram.api import types
|
||||||
from .thumbnail import Thumbnail
|
from .thumbnail import Thumbnail
|
||||||
from ..pyrogram_type import PyrogramType
|
from ..object import Object
|
||||||
from ...ext.utils import encode
|
from ...ext.utils import encode
|
||||||
|
|
||||||
|
|
||||||
class VideoNote(PyrogramType):
|
class VideoNote(Object):
|
||||||
"""A video note.
|
"""A video note.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
|
@ -20,11 +20,11 @@ from struct import pack
|
|||||||
|
|
||||||
import pyrogram
|
import pyrogram
|
||||||
from pyrogram.api import types
|
from pyrogram.api import types
|
||||||
from ..pyrogram_type import PyrogramType
|
from ..object import Object
|
||||||
from ...ext.utils import encode
|
from ...ext.utils import encode
|
||||||
|
|
||||||
|
|
||||||
class Voice(PyrogramType):
|
class Voice(Object):
|
||||||
"""A voice note.
|
"""A voice note.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
|
@ -23,7 +23,12 @@ from json import dumps
|
|||||||
import pyrogram
|
import pyrogram
|
||||||
|
|
||||||
|
|
||||||
class PyrogramType:
|
class Meta(type, metaclass=type("", (type,), {"__str__": lambda _: "~hi"})):
|
||||||
|
def __str__(self):
|
||||||
|
return "<class 'pyrogram.{}'>".format(self.__name__)
|
||||||
|
|
||||||
|
|
||||||
|
class Object(metaclass=Meta):
|
||||||
__slots__ = ["_client"]
|
__slots__ = ["_client"]
|
||||||
|
|
||||||
def __init__(self, client: "pyrogram.BaseClient" = None):
|
def __init__(self, client: "pyrogram.BaseClient" = None):
|
||||||
@ -32,19 +37,11 @@ class PyrogramType:
|
|||||||
if self._client is None:
|
if self._client is None:
|
||||||
del self._client
|
del self._client
|
||||||
|
|
||||||
def __eq__(self, other: "PyrogramType") -> bool:
|
@staticmethod
|
||||||
for attr in self.__slots__:
|
def default(obj: "Object"):
|
||||||
try:
|
if isinstance(obj, bytes):
|
||||||
if getattr(self, attr) != getattr(other, attr):
|
return repr(obj)
|
||||||
return False
|
|
||||||
except AttributeError:
|
|
||||||
return False
|
|
||||||
|
|
||||||
return True
|
|
||||||
|
|
||||||
def __str__(self) -> str:
|
|
||||||
def default(obj: PyrogramType):
|
|
||||||
try:
|
|
||||||
return OrderedDict(
|
return OrderedDict(
|
||||||
[("_", "pyrogram." + obj.__class__.__name__)]
|
[("_", "pyrogram." + obj.__class__.__name__)]
|
||||||
+ [
|
+ [
|
||||||
@ -57,10 +54,9 @@ class PyrogramType:
|
|||||||
if getattr(obj, attr) is not None
|
if getattr(obj, attr) is not None
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
except AttributeError:
|
|
||||||
return repr(obj)
|
|
||||||
|
|
||||||
return dumps(self, indent=4, default=default, ensure_ascii=False)
|
def __str__(self) -> str:
|
||||||
|
return dumps(self, indent=4, default=Object.default, ensure_ascii=False)
|
||||||
|
|
||||||
def __repr__(self) -> str:
|
def __repr__(self) -> str:
|
||||||
return "pyrogram.{}({})".format(
|
return "pyrogram.{}({})".format(
|
||||||
@ -72,5 +68,18 @@ class PyrogramType:
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def __eq__(self, other: "Object") -> bool:
|
||||||
|
for attr in self.__slots__:
|
||||||
|
try:
|
||||||
|
if getattr(self, attr) != getattr(other, attr):
|
||||||
|
return False
|
||||||
|
except AttributeError:
|
||||||
|
return False
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
def __getitem__(self, item):
|
def __getitem__(self, item):
|
||||||
return getattr(self, item)
|
return getattr(self, item)
|
||||||
|
|
||||||
|
def __setitem__(self, key, value):
|
||||||
|
setattr(self, key, value)
|
@ -22,10 +22,10 @@ import pyrogram
|
|||||||
from pyrogram.api import types
|
from pyrogram.api import types
|
||||||
from .chat_permissions import ChatPermissions
|
from .chat_permissions import ChatPermissions
|
||||||
from .chat_photo import ChatPhoto
|
from .chat_photo import ChatPhoto
|
||||||
from ..pyrogram_type import PyrogramType
|
from ..object import Object
|
||||||
|
|
||||||
|
|
||||||
class Chat(PyrogramType):
|
class Chat(Object):
|
||||||
"""A chat.
|
"""A chat.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
|
@ -19,10 +19,10 @@
|
|||||||
import pyrogram
|
import pyrogram
|
||||||
|
|
||||||
from pyrogram.api import types
|
from pyrogram.api import types
|
||||||
from ..pyrogram_type import PyrogramType
|
from ..object import Object
|
||||||
|
|
||||||
|
|
||||||
class ChatMember(PyrogramType):
|
class ChatMember(Object):
|
||||||
"""Contains information about one member of a chat.
|
"""Contains information about one member of a chat.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
|
@ -21,10 +21,10 @@ from typing import List
|
|||||||
import pyrogram
|
import pyrogram
|
||||||
from pyrogram.api import types
|
from pyrogram.api import types
|
||||||
from .chat_member import ChatMember
|
from .chat_member import ChatMember
|
||||||
from ..pyrogram_type import PyrogramType
|
from ..object import Object
|
||||||
|
|
||||||
|
|
||||||
class ChatMembers(PyrogramType):
|
class ChatMembers(Object):
|
||||||
"""Contains information about the members list of a chat.
|
"""Contains information about the members list of a chat.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
|
@ -19,10 +19,10 @@
|
|||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
from pyrogram.api import types
|
from pyrogram.api import types
|
||||||
from ..pyrogram_type import PyrogramType
|
from ..object import Object
|
||||||
|
|
||||||
|
|
||||||
class ChatPermissions(PyrogramType):
|
class ChatPermissions(Object):
|
||||||
"""A chat default permissions and a single member permissions within a chat.
|
"""A chat default permissions and a single member permissions within a chat.
|
||||||
|
|
||||||
Some permissions make sense depending on the context: default chat permissions, restricted/kicked member or
|
Some permissions make sense depending on the context: default chat permissions, restricted/kicked member or
|
||||||
|
@ -20,11 +20,11 @@ from struct import pack
|
|||||||
|
|
||||||
import pyrogram
|
import pyrogram
|
||||||
from pyrogram.api import types
|
from pyrogram.api import types
|
||||||
from ..pyrogram_type import PyrogramType
|
from ..object import Object
|
||||||
from ...ext.utils import encode
|
from ...ext.utils import encode
|
||||||
|
|
||||||
|
|
||||||
class ChatPhoto(PyrogramType):
|
class ChatPhoto(Object):
|
||||||
"""A chat photo.
|
"""A chat photo.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
|
@ -21,11 +21,11 @@ from typing import List
|
|||||||
import pyrogram
|
import pyrogram
|
||||||
from pyrogram.api import types
|
from pyrogram.api import types
|
||||||
from .chat_photo import ChatPhoto
|
from .chat_photo import ChatPhoto
|
||||||
from ..pyrogram_type import PyrogramType
|
from ..object import Object
|
||||||
from ..user_and_chats.user import User
|
from ..user_and_chats.user import User
|
||||||
|
|
||||||
|
|
||||||
class ChatPreview(PyrogramType):
|
class ChatPreview(Object):
|
||||||
"""A chat preview.
|
"""A chat preview.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
|
@ -19,11 +19,11 @@
|
|||||||
import pyrogram
|
import pyrogram
|
||||||
|
|
||||||
from pyrogram.api import types
|
from pyrogram.api import types
|
||||||
from ..pyrogram_type import PyrogramType
|
from ..object import Object
|
||||||
from ..user_and_chats import Chat
|
from ..user_and_chats import Chat
|
||||||
|
|
||||||
|
|
||||||
class Dialog(PyrogramType):
|
class Dialog(Object):
|
||||||
"""A user's dialog.
|
"""A user's dialog.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
|
@ -22,10 +22,10 @@ import pyrogram
|
|||||||
from pyrogram.api import types
|
from pyrogram.api import types
|
||||||
from .dialog import Dialog
|
from .dialog import Dialog
|
||||||
from ..messages_and_media import Message
|
from ..messages_and_media import Message
|
||||||
from ..pyrogram_type import PyrogramType
|
from ..object import Object
|
||||||
|
|
||||||
|
|
||||||
class Dialogs(PyrogramType):
|
class Dialogs(Object):
|
||||||
"""Contains a user's dialogs chunk.
|
"""Contains a user's dialogs chunk.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
|
@ -20,10 +20,10 @@ import pyrogram
|
|||||||
from pyrogram.api import types
|
from pyrogram.api import types
|
||||||
from .chat_photo import ChatPhoto
|
from .chat_photo import ChatPhoto
|
||||||
from .user_status import UserStatus
|
from .user_status import UserStatus
|
||||||
from ..pyrogram_type import PyrogramType
|
from ..object import Object
|
||||||
|
|
||||||
|
|
||||||
class User(PyrogramType):
|
class User(Object):
|
||||||
"""A Telegram user or bot.
|
"""A Telegram user or bot.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
|
@ -19,11 +19,11 @@
|
|||||||
import pyrogram
|
import pyrogram
|
||||||
|
|
||||||
from pyrogram.api import types
|
from pyrogram.api import types
|
||||||
from ..pyrogram_type import PyrogramType
|
from ..object import Object
|
||||||
from ..update import Update
|
from ..update import Update
|
||||||
|
|
||||||
|
|
||||||
class UserStatus(PyrogramType, Update):
|
class UserStatus(Object, Update):
|
||||||
"""A User status (Last Seen privacy).
|
"""A User status (Last Seen privacy).
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
Loading…
x
Reference in New Issue
Block a user