-
-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pyrofork: Add media_areas parameter to {send,edit}_story methods
Signed-off-by: wulan17 <wulan17@nusantararom.org>
- Loading branch information
Showing
9 changed files
with
160 additions
and
22 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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,40 @@ | ||
# Pyrofork - Telegram MTProto API Client Library for Python | ||
# Copyright (C) 2022-present Mayuri-Chan <https://github.com/Mayuri-Chan> | ||
# | ||
# This file is part of Pyrofork. | ||
# | ||
# Pyrofork is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Lesser General Public License as published | ||
# by the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# Pyrofork 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 General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Lesser General Public License | ||
# along with Pyrofork. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
from pyrogram import types | ||
|
||
from ..object import Object | ||
|
||
|
||
class InputMediaArea(Object): | ||
"""Content of a media area to be included in story. | ||
Pyrofork currently supports the following types: | ||
- :obj:`~pyrogram.types.InputMediaAreaChannelPost` | ||
""" | ||
|
||
# TODO: InputMediaAreaVenue | ||
|
||
def __init__( | ||
self, | ||
coordinates: "types.MediaAreaCoordinates" | ||
): | ||
super().__init__() | ||
|
||
self.coordinates = coordinates |
58 changes: 58 additions & 0 deletions
58
pyrogram/types/input_media/input_media_area_channel_post.py
This file contains 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,58 @@ | ||
# Pyrofork - Telegram MTProto API Client Library for Python | ||
# Copyright (C) 2022-present Mayuri-Chan <https://github.com/Mayuri-Chan> | ||
# | ||
# This file is part of Pyrofork. | ||
# | ||
# Pyrofork is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Lesser General Public License as published | ||
# by the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# Pyrofork 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 General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Lesser General Public License | ||
# along with Pyrofork. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
import pyrogram | ||
|
||
from pyrogram import raw, types | ||
|
||
from .input_media_area import InputMediaArea | ||
|
||
from typing import Union | ||
|
||
class InputMediaAreaChannelPost(InputMediaArea): | ||
"""A channel post media area. | ||
Parameters: | ||
coordinates (:obj:`~pyrogram.types.MediaAreaCoordinates`): | ||
Media area coordinates. | ||
chat_id (``int`` | ``str``): | ||
Unique identifier (int) or username (str) of the target channel. | ||
message_id (``int``): | ||
A single message id. | ||
""" | ||
|
||
def __init__( | ||
self, | ||
coordinates: "types.MediaAreaCoordinates", | ||
chat_id: Union[int, str], | ||
message_id: int | ||
): | ||
super().__init__(coordinates=coordinates) | ||
|
||
self.coordinates = coordinates | ||
self.chat_id = chat_id | ||
self.message_id = message_id | ||
|
||
async def write(self, client: "pyrogram.Client"): | ||
return raw.types.InputMediaAreaChannelPost( | ||
coordinates=self.coordinates, | ||
channel=await client.resolve_peer(self.chat_id), | ||
msg_id=self.message_id | ||
) |
This file contains 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
This file contains 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
This file contains 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