Pyrofork: Update MessageStory to layer 164

Signed-off-by: wulan17 <wulan17@nusantararom.org>
This commit is contained in:
wulan17 2023-09-22 17:04:07 +07:00
parent 6a99126485
commit 0c79eb27db
No known key found for this signature in database
GPG key ID: 318CD6CD3A6AC0A5

View file

@ -16,10 +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 Pyrofork. If not, see <http://www.gnu.org/licenses/>. # along with Pyrofork. If not, see <http://www.gnu.org/licenses/>.
from typing import Optional, List from pyrogram import raw
import pyrogram
from pyrogram import raw, types
from ..object import Object from ..object import Object
@ -27,28 +24,31 @@ class MessageStory(Object):
"""Contains information about a forwarded story. """Contains information about a forwarded story.
Parameters: Parameters:
user_id (``int``): from_id (``int``):
Unique user identifier of story sender. Unique user/channel identifier of story sender.
story_id (``int``): story_id (``int``):
Unique story identifier. Unique story identifier.
""" """
def __init__( def __init__(
self, self,
*, *,
user_id: int, from_id: int,
story_id: int story_id: int
): ):
super().__init__() super().__init__()
self.user_id = user_id self.from_id = from_id
self.story_id = story_id self.story_id = story_id
@staticmethod @staticmethod
def _parse(message_story: "raw.types.MessageMediaStory") -> "MessageStory": def _parse(message_story: "raw.types.MessageMediaStory") -> "MessageStory":
if isinstance(message_story.peer, raw.types.PeerChannel):
from_id = message_story.peer.channel_id
else:
from_id = message_story.peer.user_id
return MessageStory( return MessageStory(
user_id=message_story.user_id, from_id=from_id,
story_id=message_story.id story_id=message_story.id
) )