Merge branch 'develop' into asyncio-dev

# Conflicts:
#	pyrogram/client/methods/messages/send_audio.py
This commit is contained in:
Dan 2020-05-16 14:40:59 +02:00
commit 4add83c7a8
5 changed files with 31 additions and 6 deletions

View File

@ -215,6 +215,10 @@ class Filters:
from_scheduled = create(lambda _, m: bool(m.from_scheduled), "FromScheduledFilter")
"""Filter new automatically sent messages that were previously scheduled."""
# Messages from linked channels are forwarded automatically by Telegram and have no sender (from_user is None).
linked_channel = create(lambda _, m: bool(m.forward_from_chat and not m.from_user), "LinkedChannelFilter")
"""Filter messages that are automatically forwarded from the linked channel to the group chat."""
@staticmethod
def command(
commands: str or list,
@ -319,7 +323,8 @@ class Filters:
else:
raise ValueError("Regex filter doesn't work with {}".format(type(update)))
update.matches = list(flt.p.finditer(value)) or None
if value:
update.matches = list(flt.p.finditer(value)) or None
return bool(update.matches)

View File

@ -38,6 +38,7 @@ class SendAnimation(BaseClient):
width: int = 0,
height: int = 0,
thumb: str = None,
file_name: str = None,
disable_notification: bool = None,
reply_to_message_id: int = None,
schedule_date: int = None,
@ -97,6 +98,10 @@ class SendAnimation(BaseClient):
A thumbnail's width and height should not exceed 320 pixels.
Thumbnails can't be reused and can be only uploaded as a new file.
file_name (``str``, *optional*):
File name of the animation sent.
Defaults to file's path basename.
disable_notification (``bool``, *optional*):
Sends the message silently.
Users will receive a notification with no sound.
@ -172,7 +177,7 @@ class SendAnimation(BaseClient):
w=width,
h=height
),
types.DocumentAttributeFilename(file_name=os.path.basename(animation)),
types.DocumentAttributeFilename(file_name=file_name or os.path.basename(animation)),
types.DocumentAttributeAnimated()
]
)

View File

@ -36,7 +36,8 @@ class SendAudio(BaseClient):
duration: int = 0,
performer: str = None,
title: str = None,
thumb: str = None, disable_notification: bool = None,
thumb: str = None,file_name: str = None,
disable_notification: bool = None,
reply_to_message_id: int = None,
schedule_date: int = None,
reply_markup: Union[
@ -93,6 +94,10 @@ class SendAudio(BaseClient):
A thumbnail's width and height should not exceed 320 pixels.
Thumbnails can't be reused and can be only uploaded as a new file.
file_name (``str``, *optional*):
File name of the audio sent.
Defaults to file's path basename.
disable_notification (``bool``, *optional*):
Sends the message silently.
Users will receive a notification with no sound.
@ -170,7 +175,7 @@ class SendAudio(BaseClient):
performer=performer,
title=title
),
types.DocumentAttributeFilename(file_name=os.path.basename(audio))
types.DocumentAttributeFilename(file_name=file_name or os.path.basename(audio))
]
)
elif audio.startswith("http"):

View File

@ -34,6 +34,7 @@ class SendDocument(BaseClient):
thumb: str = None,
caption: str = "",
parse_mode: Union[str, None] = object,
file_name: str = None,
disable_notification: bool = None,
reply_to_message_id: int = None,
schedule_date: int = None,
@ -80,6 +81,10 @@ class SendDocument(BaseClient):
Pass "html" to enable HTML-style parsing only.
Pass None to completely disable style parsing.
file_name (``str``, *optional*):
File name of the document sent.
Defaults to file's path basename.
disable_notification (``bool``, *optional*):
Sends the message silently.
Users will receive a notification with no sound.
@ -146,7 +151,7 @@ class SendDocument(BaseClient):
file=file,
thumb=thumb,
attributes=[
types.DocumentAttributeFilename(file_name=os.path.basename(document))
types.DocumentAttributeFilename(file_name=file_name or os.path.basename(document))
]
)
elif document.startswith("http"):

View File

@ -37,6 +37,7 @@ class SendVideo(BaseClient):
width: int = 0,
height: int = 0,
thumb: str = None,
file_name: str = None,
supports_streaming: bool = True,
disable_notification: bool = None,
reply_to_message_id: int = None,
@ -93,6 +94,10 @@ class SendVideo(BaseClient):
A thumbnail's width and height should not exceed 320 pixels.
Thumbnails can't be reused and can be only uploaded as a new file.
file_name (``str``, *optional*):
File name of the video sent.
Defaults to file's path basename.
supports_streaming (``bool``, *optional*):
Pass True, if the uploaded video is suitable for streaming.
Defaults to True.
@ -169,7 +174,7 @@ class SendVideo(BaseClient):
w=width,
h=height
),
types.DocumentAttributeFilename(file_name=os.path.basename(video))
types.DocumentAttributeFilename(file_name=file_name or os.path.basename(video))
]
)
elif video.startswith("http"):