mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2026-01-08 16:04:51 +00:00
Compare commits
3 commits
f38e6a9d1d
...
28f7137828
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
28f7137828 | ||
|
|
7c94fc8009 | ||
|
|
969a2c0f55 |
6 changed files with 36 additions and 11 deletions
|
|
@ -271,7 +271,7 @@ class SendMediaGroup:
|
||||||
w=i.width,
|
w=i.width,
|
||||||
h=i.height
|
h=i.height
|
||||||
),
|
),
|
||||||
raw.types.DocumentAttributeFilename(file_name=os.path.basename(i.media)),
|
raw.types.DocumentAttributeFilename(file_name=i.file_name or os.path.basename(i.media)),
|
||||||
]
|
]
|
||||||
if is_animation:
|
if is_animation:
|
||||||
attributes.append(raw.types.DocumentAttributeAnimated())
|
attributes.append(raw.types.DocumentAttributeAnimated())
|
||||||
|
|
@ -339,7 +339,7 @@ class SendMediaGroup:
|
||||||
w=i.width,
|
w=i.width,
|
||||||
h=i.height
|
h=i.height
|
||||||
),
|
),
|
||||||
raw.types.DocumentAttributeFilename(file_name=getattr(i.media, "name", "video.mp4")),
|
raw.types.DocumentAttributeFilename(file_name=i.file_name or getattr(i.media, "name", "video.mp4")),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
@ -371,7 +371,7 @@ class SendMediaGroup:
|
||||||
performer=i.performer,
|
performer=i.performer,
|
||||||
title=i.title
|
title=i.title
|
||||||
),
|
),
|
||||||
raw.types.DocumentAttributeFilename(file_name=os.path.basename(i.media)),
|
raw.types.DocumentAttributeFilename(file_name=i.file_name or os.path.basename(i.media)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
@ -419,7 +419,7 @@ class SendMediaGroup:
|
||||||
performer=i.performer,
|
performer=i.performer,
|
||||||
title=i.title
|
title=i.title
|
||||||
),
|
),
|
||||||
raw.types.DocumentAttributeFilename(file_name=getattr(i.media, "name", "audio.mp3")),
|
raw.types.DocumentAttributeFilename(file_name=i.file_name or getattr(i.media, "name", "audio.mp3")),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
@ -445,7 +445,7 @@ class SendMediaGroup:
|
||||||
file=file,
|
file=file,
|
||||||
thumb=thumb,
|
thumb=thumb,
|
||||||
attributes=[
|
attributes=[
|
||||||
raw.types.DocumentAttributeFilename(file_name=os.path.basename(i.media)),
|
raw.types.DocumentAttributeFilename(file_name=i.file_name or os.path.basename(i.media)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
@ -490,7 +490,7 @@ class SendMediaGroup:
|
||||||
file=file,
|
file=file,
|
||||||
thumb=thumb,
|
thumb=thumb,
|
||||||
attributes=[
|
attributes=[
|
||||||
raw.types.DocumentAttributeFilename(file_name=getattr(i.media, "name", "file.zip")),
|
raw.types.DocumentAttributeFilename(file_name=i.file_name or getattr(i.media, "name", "file.zip")),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -65,8 +65,10 @@ class RequestedChat(Object):
|
||||||
"raw.types.PeerChannel"
|
"raw.types.PeerChannel"
|
||||||
]
|
]
|
||||||
) -> "RequestedChat":
|
) -> "RequestedChat":
|
||||||
if isinstance(request, raw.types.RequestedPeerChannel) or isinstance(request, raw.types.PeerChannel):
|
if getattr(request, "broadcast", None):
|
||||||
type = enums.ChatType.CHANNEL
|
type = enums.ChatType.CHANNEL
|
||||||
|
elif getattr(request, "megagroup", None):
|
||||||
|
type = enums.ChatType.SUPERGROUP
|
||||||
else:
|
else:
|
||||||
type = enums.ChatType.GROUP
|
type = enums.ChatType.GROUP
|
||||||
photo = None
|
photo = None
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,10 @@ class InputMediaAudio(InputMedia):
|
||||||
|
|
||||||
title (``str``, *optional*):
|
title (``str``, *optional*):
|
||||||
Title of the audio
|
Title of the audio
|
||||||
|
|
||||||
|
file_name (``str``, *optional*):
|
||||||
|
File name of the audio sent.
|
||||||
|
Defaults to file's path basename.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
|
|
@ -73,7 +77,8 @@ class InputMediaAudio(InputMedia):
|
||||||
caption_entities: List[MessageEntity] = None,
|
caption_entities: List[MessageEntity] = None,
|
||||||
duration: int = 0,
|
duration: int = 0,
|
||||||
performer: str = "",
|
performer: str = "",
|
||||||
title: str = ""
|
title: str = "",
|
||||||
|
file_name: str = None
|
||||||
):
|
):
|
||||||
super().__init__(media, caption, parse_mode, caption_entities)
|
super().__init__(media, caption, parse_mode, caption_entities)
|
||||||
|
|
||||||
|
|
@ -81,3 +86,4 @@ class InputMediaAudio(InputMedia):
|
||||||
self.duration = duration
|
self.duration = duration
|
||||||
self.performer = performer
|
self.performer = performer
|
||||||
self.title = title
|
self.title = title
|
||||||
|
self.file_name = file_name
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,10 @@ class InputMediaDocument(InputMedia):
|
||||||
|
|
||||||
caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
|
caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
|
||||||
List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
|
List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
|
||||||
|
|
||||||
|
file_name (``str``, *optional*):
|
||||||
|
File name of the document sent.
|
||||||
|
Defaults to file's path basename.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
|
|
@ -59,8 +63,10 @@ class InputMediaDocument(InputMedia):
|
||||||
thumb: str = None,
|
thumb: str = None,
|
||||||
caption: str = "",
|
caption: str = "",
|
||||||
parse_mode: Optional["enums.ParseMode"] = None,
|
parse_mode: Optional["enums.ParseMode"] = None,
|
||||||
caption_entities: List[MessageEntity] = None
|
caption_entities: List[MessageEntity] = None,
|
||||||
|
file_name: str = None
|
||||||
):
|
):
|
||||||
super().__init__(media, caption, parse_mode, caption_entities)
|
super().__init__(media, caption, parse_mode, caption_entities)
|
||||||
|
|
||||||
self.thumb = thumb
|
self.thumb = thumb
|
||||||
|
self.file_name = file_name
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,10 @@ class InputMediaVideo(InputMedia):
|
||||||
duration (``int``, *optional*):
|
duration (``int``, *optional*):
|
||||||
Video duration.
|
Video duration.
|
||||||
|
|
||||||
|
file_name (``str``, *optional*):
|
||||||
|
File name of the video sent.
|
||||||
|
Defaults to file's path basename.
|
||||||
|
|
||||||
supports_streaming (``bool``, *optional*):
|
supports_streaming (``bool``, *optional*):
|
||||||
Pass True, if the uploaded video is suitable for streaming.
|
Pass True, if the uploaded video is suitable for streaming.
|
||||||
|
|
||||||
|
|
@ -79,6 +83,7 @@ class InputMediaVideo(InputMedia):
|
||||||
width: int = 0,
|
width: int = 0,
|
||||||
height: int = 0,
|
height: int = 0,
|
||||||
duration: int = 0,
|
duration: int = 0,
|
||||||
|
file_name: str = None,
|
||||||
supports_streaming: bool = True,
|
supports_streaming: bool = True,
|
||||||
has_spoiler: bool = None,
|
has_spoiler: bool = None,
|
||||||
):
|
):
|
||||||
|
|
@ -88,5 +93,6 @@ class InputMediaVideo(InputMedia):
|
||||||
self.width = width
|
self.width = width
|
||||||
self.height = height
|
self.height = height
|
||||||
self.duration = duration
|
self.duration = duration
|
||||||
|
self.file_name = file_name
|
||||||
self.supports_streaming = supports_streaming
|
self.supports_streaming = supports_streaming
|
||||||
self.has_spoiler = has_spoiler
|
self.has_spoiler = has_spoiler
|
||||||
|
|
|
||||||
|
|
@ -1314,9 +1314,14 @@ class Message(Object, Update):
|
||||||
self.chat.type in (enums.ChatType.GROUP, enums.ChatType.SUPERGROUP, enums.ChatType.CHANNEL)
|
self.chat.type in (enums.ChatType.GROUP, enums.ChatType.SUPERGROUP, enums.ChatType.CHANNEL)
|
||||||
and self.chat.username
|
and self.chat.username
|
||||||
):
|
):
|
||||||
|
if self.chat.type == enums.ChatType.SUPERGROUP and self.message_thread_id:
|
||||||
|
return f"https://t.me/{self.chat.username}/{self.message_thread_id}/{self.id}"
|
||||||
return f"https://t.me/{self.chat.username}/{self.id}"
|
return f"https://t.me/{self.chat.username}/{self.id}"
|
||||||
else:
|
if self.chat.type == enums.ChatType.PRIVATE:
|
||||||
return f"https://t.me/c/{utils.get_channel_id(self.chat.id)}/{self.id}"
|
return f"tg://openmessage?user_id={self.from_user.id}&message_id={self.id}"
|
||||||
|
if self.message_thread_id:
|
||||||
|
return f"https://t.me/c/{utils.get_channel_id(self.chat.id)}/{self.message_thread_id}/{self.id}"
|
||||||
|
return f"https://t.me/c/{utils.get_channel_id(self.chat.id)}/{self.id}"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def content(self) -> str:
|
def content(self) -> str:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue