mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2025-12-29 12:04:51 +00:00
Pyrofork: Move reply_to to pyrogram.utils
Signed-off-by: wulan17 <wulan17@nusantararom.org>
This commit is contained in:
parent
094d069b28
commit
cd0473c6af
20 changed files with 192 additions and 234 deletions
|
|
@ -21,7 +21,7 @@ from typing import Union
|
||||||
|
|
||||||
import pyrogram
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram import types
|
from pyrogram import types, utils
|
||||||
|
|
||||||
|
|
||||||
class SendGame:
|
class SendGame:
|
||||||
|
|
@ -79,9 +79,12 @@ class SendGame:
|
||||||
|
|
||||||
await app.send_game(chat_id, "gamename")
|
await app.send_game(chat_id, "gamename")
|
||||||
"""
|
"""
|
||||||
reply_to = None
|
reply_to = await utils.get_reply_to(
|
||||||
if reply_to_message_id or message_thread_id:
|
client=self,
|
||||||
reply_to = types.InputReplyToMessage(reply_to_message_id=reply_to_message_id, message_thread_id=message_thread_id)
|
chat_id=chat_id,
|
||||||
|
reply_to_message_id=reply_to_message_id,
|
||||||
|
message_thread_id=message_thread_id
|
||||||
|
)
|
||||||
|
|
||||||
r = await self.invoke(
|
r = await self.invoke(
|
||||||
raw.functions.messages.SendMedia(
|
raw.functions.messages.SendMedia(
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
import pyrogram
|
import pyrogram
|
||||||
from pyrogram import raw, types
|
from pyrogram import raw, types, utils
|
||||||
|
|
||||||
|
|
||||||
class SendInlineBotResult:
|
class SendInlineBotResult:
|
||||||
|
|
@ -75,9 +75,13 @@ class SendInlineBotResult:
|
||||||
await app.send_inline_bot_result(chat_id, query_id, result_id)
|
await app.send_inline_bot_result(chat_id, query_id, result_id)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
reply_to = None
|
reply_to = await utils.get_reply_to(
|
||||||
if reply_to_message_id or message_thread_id:
|
client=self,
|
||||||
reply_to = types.InputReplyToMessage(reply_to_message_id=reply_to_message_id, message_thread_id=message_thread_id, quote_text=quote_text)
|
chat_id=chat_id,
|
||||||
|
reply_to_message_id=reply_to_message_id,
|
||||||
|
message_thread_id=message_thread_id,
|
||||||
|
quote_text=quote_text
|
||||||
|
)
|
||||||
|
|
||||||
return await self.invoke(
|
return await self.invoke(
|
||||||
raw.functions.messages.SendInlineBotResult(
|
raw.functions.messages.SendInlineBotResult(
|
||||||
|
|
|
||||||
|
|
@ -195,20 +195,15 @@ class SendAnimation:
|
||||||
"""
|
"""
|
||||||
file = None
|
file = None
|
||||||
|
|
||||||
reply_to = None
|
reply_to = await utils.get_reply_to(
|
||||||
reply_to_chat = None
|
client=self,
|
||||||
if reply_to_message_id or message_thread_id:
|
chat_id=chat_id,
|
||||||
if reply_to_chat_id is not None:
|
|
||||||
reply_to_chat = await self.resolve_peer(reply_to_chat_id)
|
|
||||||
reply_to = types.InputReplyToMessage(
|
|
||||||
reply_to_message_id=reply_to_message_id,
|
reply_to_message_id=reply_to_message_id,
|
||||||
|
reply_to_story_id=reply_to_story_id,
|
||||||
message_thread_id=message_thread_id,
|
message_thread_id=message_thread_id,
|
||||||
reply_to_chat=reply_to_chat,
|
reply_to_chat_id=reply_to_chat_id,
|
||||||
quote_text=quote_text
|
quote_text=quote_text
|
||||||
)
|
)
|
||||||
if reply_to_story_id:
|
|
||||||
user_id = await self.resolve_peer(chat_id)
|
|
||||||
reply_to = types.InputReplyToStory(user_id=user_id, story_id=reply_to_story_id)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if isinstance(animation, str):
|
if isinstance(animation, str):
|
||||||
|
|
|
||||||
|
|
@ -189,20 +189,15 @@ class SendAudio:
|
||||||
"""
|
"""
|
||||||
file = None
|
file = None
|
||||||
|
|
||||||
reply_to = None
|
reply_to = await utils.get_reply_to(
|
||||||
reply_to_chat = None
|
client=self,
|
||||||
if reply_to_message_id or message_thread_id:
|
chat_id=chat_id,
|
||||||
if reply_to_chat_id is not None:
|
|
||||||
reply_to_chat = await self.resolve_peer(reply_to_chat_id)
|
|
||||||
reply_to = types.InputReplyToMessage(
|
|
||||||
reply_to_message_id=reply_to_message_id,
|
reply_to_message_id=reply_to_message_id,
|
||||||
|
reply_to_story_id=reply_to_story_id,
|
||||||
message_thread_id=message_thread_id,
|
message_thread_id=message_thread_id,
|
||||||
reply_to_chat=reply_to_chat,
|
reply_to_chat_id=reply_to_chat_id,
|
||||||
quote_text=quote_text
|
quote_text=quote_text
|
||||||
)
|
)
|
||||||
if reply_to_story_id:
|
|
||||||
user_id = await self.resolve_peer(chat_id)
|
|
||||||
reply_to = types.InputReplyToStory(user_id=user_id, story_id=reply_to_story_id)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if isinstance(audio, str):
|
if isinstance(audio, str):
|
||||||
|
|
|
||||||
|
|
@ -122,20 +122,15 @@ class SendCachedMedia:
|
||||||
await app.send_cached_media("me", file_id)
|
await app.send_cached_media("me", file_id)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
reply_to = None
|
reply_to = await utils.get_reply_to(
|
||||||
reply_to_chat = None
|
client=self,
|
||||||
if reply_to_message_id or message_thread_id:
|
chat_id=chat_id,
|
||||||
if reply_to_chat_id is not None:
|
|
||||||
reply_to_chat = await self.resolve_peer(reply_to_chat_id)
|
|
||||||
reply_to = types.InputReplyToMessage(
|
|
||||||
reply_to_message_id=reply_to_message_id,
|
reply_to_message_id=reply_to_message_id,
|
||||||
|
reply_to_story_id=reply_to_story_id,
|
||||||
message_thread_id=message_thread_id,
|
message_thread_id=message_thread_id,
|
||||||
reply_to_chat=reply_to_chat,
|
reply_to_chat_id=reply_to_chat_id,
|
||||||
quote_text=quote_text
|
quote_text=quote_text
|
||||||
)
|
)
|
||||||
if reply_to_story_id:
|
|
||||||
user_id = await self.resolve_peer(chat_id)
|
|
||||||
reply_to = types.InputReplyToStory(user_id=user_id, story_id=reply_to_story_id)
|
|
||||||
|
|
||||||
media = utils.get_input_media_from_file_id(file_id)
|
media = utils.get_input_media_from_file_id(file_id)
|
||||||
media.spoiler = has_spoiler
|
media.spoiler = has_spoiler
|
||||||
|
|
|
||||||
|
|
@ -107,15 +107,12 @@ class SendContact:
|
||||||
await app.send_contact("me", "+1-123-456-7890", "Name")
|
await app.send_contact("me", "+1-123-456-7890", "Name")
|
||||||
"""
|
"""
|
||||||
|
|
||||||
reply_to = None
|
reply_to = await utils.get_reply_to(
|
||||||
reply_to_chat = None
|
client=self,
|
||||||
if reply_to_message_id or message_thread_id:
|
chat_id=chat_id,
|
||||||
if reply_to_chat_id is not None:
|
|
||||||
reply_to_chat = await self.resolve_peer(reply_to_chat_id)
|
|
||||||
reply_to = types.InputReplyToMessage(
|
|
||||||
reply_to_message_id=reply_to_message_id,
|
reply_to_message_id=reply_to_message_id,
|
||||||
message_thread_id=message_thread_id,
|
message_thread_id=message_thread_id,
|
||||||
reply_to_chat=reply_to_chat,
|
reply_to_chat_id=reply_to_chat_id,
|
||||||
quote_text=quote_text
|
quote_text=quote_text
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -110,20 +110,15 @@ class SendDice:
|
||||||
await app.send_dice(chat_id, "🏀")
|
await app.send_dice(chat_id, "🏀")
|
||||||
"""
|
"""
|
||||||
|
|
||||||
reply_to = None
|
reply_to = await utils.get_reply_to(
|
||||||
reply_to_chat = None
|
client=self,
|
||||||
if reply_to_message_id or message_thread_id:
|
chat_id=chat_id,
|
||||||
if reply_to_chat_id is not None:
|
|
||||||
reply_to_chat = await self.resolve_peer(reply_to_chat_id)
|
|
||||||
reply_to = types.InputReplyToMessage(
|
|
||||||
reply_to_message_id=reply_to_message_id,
|
reply_to_message_id=reply_to_message_id,
|
||||||
|
reply_to_story_id=reply_to_story_id,
|
||||||
message_thread_id=message_thread_id,
|
message_thread_id=message_thread_id,
|
||||||
reply_to_chat=reply_to_chat,
|
reply_to_chat_id=reply_to_chat_id,
|
||||||
quote_text=quote_text
|
quote_text=quote_text
|
||||||
)
|
)
|
||||||
if reply_to_story_id:
|
|
||||||
user_id = await self.resolve_peer(chat_id)
|
|
||||||
reply_to = types.InputReplyToStory(user_id=user_id, story_id=reply_to_story_id)
|
|
||||||
|
|
||||||
r = await self.invoke(
|
r = await self.invoke(
|
||||||
raw.functions.messages.SendMedia(
|
raw.functions.messages.SendMedia(
|
||||||
|
|
|
||||||
|
|
@ -176,20 +176,15 @@ class SendDocument:
|
||||||
"""
|
"""
|
||||||
file = None
|
file = None
|
||||||
|
|
||||||
reply_to = None
|
reply_to = await utils.get_reply_to(
|
||||||
reply_to_chat = None
|
client=self,
|
||||||
if reply_to_message_id or message_thread_id:
|
chat_id=chat_id,
|
||||||
if reply_to_chat_id is not None:
|
|
||||||
reply_to_chat = await self.resolve_peer(reply_to_chat_id)
|
|
||||||
reply_to = types.InputReplyToMessage(
|
|
||||||
reply_to_message_id=reply_to_message_id,
|
reply_to_message_id=reply_to_message_id,
|
||||||
|
reply_to_story_id=reply_to_story_id,
|
||||||
message_thread_id=message_thread_id,
|
message_thread_id=message_thread_id,
|
||||||
reply_to_chat=reply_to_chat,
|
reply_to_chat_id=reply_to_chat_id,
|
||||||
quote_text=quote_text
|
quote_text=quote_text
|
||||||
)
|
)
|
||||||
if reply_to_story_id:
|
|
||||||
user_id = await self.resolve_peer(chat_id)
|
|
||||||
reply_to = types.InputReplyToStory(user_id=user_id, story_id=reply_to_story_id)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if isinstance(document, str):
|
if isinstance(document, str):
|
||||||
|
|
|
||||||
|
|
@ -99,15 +99,12 @@ class SendLocation:
|
||||||
app.send_location("me", latitude, longitude)
|
app.send_location("me", latitude, longitude)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
reply_to = None
|
reply_to = await utils.get_reply_to(
|
||||||
reply_to_chat = None
|
client=self,
|
||||||
if reply_to_message_id or message_thread_id:
|
chat_id=chat_id,
|
||||||
if reply_to_chat_id is not None:
|
|
||||||
reply_to_chat = await self.resolve_peer(reply_to_chat_id)
|
|
||||||
reply_to = types.InputReplyToMessage(
|
|
||||||
reply_to_message_id=reply_to_message_id,
|
reply_to_message_id=reply_to_message_id,
|
||||||
message_thread_id=message_thread_id,
|
message_thread_id=message_thread_id,
|
||||||
reply_to_chat=reply_to_chat,
|
reply_to_chat_id=reply_to_chat_id,
|
||||||
quote_text=quote_text
|
quote_text=quote_text
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -114,20 +114,15 @@ class SendMediaGroup:
|
||||||
"""
|
"""
|
||||||
multi_media = []
|
multi_media = []
|
||||||
|
|
||||||
reply_to = None
|
reply_to = await utils.get_reply_to(
|
||||||
reply_to_chat = None
|
client=self,
|
||||||
if reply_to_message_id or message_thread_id:
|
chat_id=chat_id,
|
||||||
if reply_to_chat_id is not None:
|
|
||||||
reply_to_chat = await self.resolve_peer(reply_to_chat_id)
|
|
||||||
reply_to = types.InputReplyToMessage(
|
|
||||||
reply_to_message_id=reply_to_message_id,
|
reply_to_message_id=reply_to_message_id,
|
||||||
|
reply_to_story_id=reply_to_story_id,
|
||||||
message_thread_id=message_thread_id,
|
message_thread_id=message_thread_id,
|
||||||
reply_to_chat=reply_to_chat,
|
reply_to_chat_id=reply_to_chat_id,
|
||||||
quote_text=quote_text
|
quote_text=quote_text
|
||||||
)
|
)
|
||||||
if reply_to_story_id:
|
|
||||||
user_id = await self.resolve_peer(chat_id)
|
|
||||||
reply_to = types.InputReplyToStory(user_id=user_id, story_id=reply_to_story_id)
|
|
||||||
|
|
||||||
for i in media:
|
for i in media:
|
||||||
if isinstance(i, types.InputMediaPhoto):
|
if isinstance(i, types.InputMediaPhoto):
|
||||||
|
|
|
||||||
|
|
@ -143,20 +143,15 @@ class SendMessage:
|
||||||
|
|
||||||
message, entities = (await utils.parse_text_entities(self, text, parse_mode, entities)).values()
|
message, entities = (await utils.parse_text_entities(self, text, parse_mode, entities)).values()
|
||||||
|
|
||||||
reply_to = None
|
reply_to = await utils.get_reply_to(
|
||||||
reply_to_chat = None
|
client=self,
|
||||||
if reply_to_message_id or message_thread_id:
|
chat_id=chat_id,
|
||||||
if reply_to_chat_id is not None:
|
|
||||||
reply_to_chat = await self.resolve_peer(reply_to_chat_id)
|
|
||||||
reply_to = types.InputReplyToMessage(
|
|
||||||
reply_to_message_id=reply_to_message_id,
|
reply_to_message_id=reply_to_message_id,
|
||||||
|
reply_to_story_id=reply_to_story_id,
|
||||||
message_thread_id=message_thread_id,
|
message_thread_id=message_thread_id,
|
||||||
reply_to_chat=reply_to_chat,
|
reply_to_chat_id=reply_to_chat_id,
|
||||||
quote_text=quote_text
|
quote_text=quote_text
|
||||||
)
|
)
|
||||||
if reply_to_story_id:
|
|
||||||
user_id = await self.resolve_peer(chat_id)
|
|
||||||
reply_to = types.InputReplyToStory(user_id=user_id, story_id=reply_to_story_id)
|
|
||||||
|
|
||||||
r = await self.invoke(
|
r = await self.invoke(
|
||||||
raw.functions.messages.SendMessage(
|
raw.functions.messages.SendMessage(
|
||||||
|
|
|
||||||
|
|
@ -167,20 +167,15 @@ class SendPhoto:
|
||||||
"""
|
"""
|
||||||
file = None
|
file = None
|
||||||
|
|
||||||
reply_to = None
|
reply_to = await utils.get_reply_to(
|
||||||
reply_to_chat = None
|
client=self,
|
||||||
if reply_to_message_id or message_thread_id:
|
chat_id=chat_id,
|
||||||
if reply_to_chat_id is not None:
|
|
||||||
reply_to_chat = await self.resolve_peer(reply_to_chat_id)
|
|
||||||
reply_to = types.InputReplyToMessage(
|
|
||||||
reply_to_message_id=reply_to_message_id,
|
reply_to_message_id=reply_to_message_id,
|
||||||
|
reply_to_story_id=reply_to_story_id,
|
||||||
message_thread_id=message_thread_id,
|
message_thread_id=message_thread_id,
|
||||||
reply_to_chat=reply_to_chat,
|
reply_to_chat_id=reply_to_chat_id,
|
||||||
quote_text=quote_text
|
quote_text=quote_text
|
||||||
)
|
)
|
||||||
if reply_to_story_id:
|
|
||||||
user_id = await self.resolve_peer(chat_id)
|
|
||||||
reply_to = types.InputReplyToStory(user_id=user_id, story_id=reply_to_story_id)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if isinstance(photo, str):
|
if isinstance(photo, str):
|
||||||
|
|
|
||||||
|
|
@ -149,15 +149,12 @@ class SendPoll:
|
||||||
await app.send_poll(chat_id, "Is this a poll question?", ["Yes", "No", "Maybe"])
|
await app.send_poll(chat_id, "Is this a poll question?", ["Yes", "No", "Maybe"])
|
||||||
"""
|
"""
|
||||||
|
|
||||||
reply_to = None
|
reply_to = await utils.get_reply_to(
|
||||||
reply_to_chat = None
|
client=self,
|
||||||
if reply_to_message_id or message_thread_id:
|
chat_id=chat_id,
|
||||||
if reply_to_chat_id is not None:
|
|
||||||
reply_to_chat = await self.resolve_peer(reply_to_chat_id)
|
|
||||||
reply_to = types.InputReplyToMessage(
|
|
||||||
reply_to_message_id=reply_to_message_id,
|
reply_to_message_id=reply_to_message_id,
|
||||||
message_thread_id=message_thread_id,
|
message_thread_id=message_thread_id,
|
||||||
reply_to_chat=reply_to_chat,
|
reply_to_chat_id=reply_to_chat_id,
|
||||||
quote_text=quote_text
|
quote_text=quote_text
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -140,20 +140,15 @@ class SendSticker:
|
||||||
"""
|
"""
|
||||||
file = None
|
file = None
|
||||||
|
|
||||||
reply_to = None
|
reply_to = await utils.get_reply_to(
|
||||||
reply_to_chat = None
|
client=self,
|
||||||
if reply_to_message_id or message_thread_id:
|
chat_id=chat_id,
|
||||||
if reply_to_chat_id is not None:
|
|
||||||
reply_to_chat = await self.resolve_peer(reply_to_chat_id)
|
|
||||||
reply_to = types.InputReplyToMessage(
|
|
||||||
reply_to_message_id=reply_to_message_id,
|
reply_to_message_id=reply_to_message_id,
|
||||||
|
reply_to_story_id=reply_to_story_id,
|
||||||
message_thread_id=message_thread_id,
|
message_thread_id=message_thread_id,
|
||||||
reply_to_chat=reply_to_chat,
|
reply_to_chat_id=reply_to_chat_id,
|
||||||
quote_text=quote_text
|
quote_text=quote_text
|
||||||
)
|
)
|
||||||
if reply_to_story_id:
|
|
||||||
user_id = await self.resolve_peer(chat_id)
|
|
||||||
reply_to = types.InputReplyToStory(user_id=user_id, story_id=reply_to_story_id)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if isinstance(sticker, str):
|
if isinstance(sticker, str):
|
||||||
|
|
|
||||||
|
|
@ -118,15 +118,12 @@ class SendVenue:
|
||||||
"Venue title", "Venue address")
|
"Venue title", "Venue address")
|
||||||
"""
|
"""
|
||||||
|
|
||||||
reply_to = None
|
reply_to = await utils.get_reply_to(
|
||||||
reply_to_chat = None
|
client=self,
|
||||||
if reply_to_message_id or message_thread_id:
|
chat_id=chat_id,
|
||||||
if reply_to_chat_id is not None:
|
|
||||||
reply_to_chat = await self.resolve_peer(reply_to_chat_id)
|
|
||||||
reply_to = types.InputReplyToMessage(
|
|
||||||
reply_to_message_id=reply_to_message_id,
|
reply_to_message_id=reply_to_message_id,
|
||||||
message_thread_id=message_thread_id,
|
message_thread_id=message_thread_id,
|
||||||
reply_to_chat=reply_to_chat,
|
reply_to_chat_id=reply_to_chat_id,
|
||||||
quote_text=quote_text
|
quote_text=quote_text
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -200,20 +200,15 @@ class SendVideo:
|
||||||
"""
|
"""
|
||||||
file = None
|
file = None
|
||||||
|
|
||||||
reply_to = None
|
reply_to = await utils.get_reply_to(
|
||||||
reply_to_chat = None
|
client=self,
|
||||||
if reply_to_message_id or message_thread_id:
|
chat_id=chat_id,
|
||||||
if reply_to_chat_id is not None:
|
|
||||||
reply_to_chat = await self.resolve_peer(reply_to_chat_id)
|
|
||||||
reply_to = types.InputReplyToMessage(
|
|
||||||
reply_to_message_id=reply_to_message_id,
|
reply_to_message_id=reply_to_message_id,
|
||||||
|
reply_to_story_id=reply_to_story_id,
|
||||||
message_thread_id=message_thread_id,
|
message_thread_id=message_thread_id,
|
||||||
reply_to_chat=reply_to_chat,
|
reply_to_chat_id=reply_to_chat_id,
|
||||||
quote_text=quote_text
|
quote_text=quote_text
|
||||||
)
|
)
|
||||||
if reply_to_story_id:
|
|
||||||
user_id = await self.resolve_peer(chat_id)
|
|
||||||
reply_to = types.InputReplyToStory(user_id=user_id, story_id=reply_to_story_id)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if isinstance(video, str):
|
if isinstance(video, str):
|
||||||
|
|
|
||||||
|
|
@ -154,20 +154,15 @@ class SendVideoNote:
|
||||||
"""
|
"""
|
||||||
file = None
|
file = None
|
||||||
|
|
||||||
reply_to = None
|
reply_to = await utils.get_reply_to(
|
||||||
reply_to_chat = None
|
client=self,
|
||||||
if reply_to_message_id or message_thread_id:
|
chat_id=chat_id,
|
||||||
if reply_to_chat_id is not None:
|
|
||||||
reply_to_chat = await self.resolve_peer(reply_to_chat_id)
|
|
||||||
reply_to = types.InputReplyToMessage(
|
|
||||||
reply_to_message_id=reply_to_message_id,
|
reply_to_message_id=reply_to_message_id,
|
||||||
|
reply_to_story_id=reply_to_story_id,
|
||||||
message_thread_id=message_thread_id,
|
message_thread_id=message_thread_id,
|
||||||
reply_to_chat=reply_to_chat,
|
reply_to_chat_id=reply_to_chat_id,
|
||||||
quote_text=quote_text
|
quote_text=quote_text
|
||||||
)
|
)
|
||||||
if reply_to_story_id:
|
|
||||||
user_id = await self.resolve_peer(chat_id)
|
|
||||||
reply_to = types.InputReplyToStory(user_id=user_id, story_id=reply_to_story_id)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if isinstance(video_note, str):
|
if isinstance(video_note, str):
|
||||||
|
|
|
||||||
|
|
@ -162,20 +162,15 @@ class SendVoice:
|
||||||
"""
|
"""
|
||||||
file = None
|
file = None
|
||||||
|
|
||||||
reply_to = None
|
reply_to = await utils.get_reply_to(
|
||||||
reply_to_chat = None
|
client=self,
|
||||||
if reply_to_message_id or message_thread_id:
|
chat_id=chat_id,
|
||||||
if reply_to_chat_id is not None:
|
|
||||||
reply_to_chat = await self.resolve_peer(reply_to_chat_id)
|
|
||||||
reply_to = types.InputReplyToMessage(
|
|
||||||
reply_to_message_id=reply_to_message_id,
|
reply_to_message_id=reply_to_message_id,
|
||||||
|
reply_to_story_id=reply_to_story_id,
|
||||||
message_thread_id=message_thread_id,
|
message_thread_id=message_thread_id,
|
||||||
reply_to_chat=reply_to_chat,
|
reply_to_chat_id=reply_to_chat_id,
|
||||||
quote_text=quote_text
|
quote_text=quote_text
|
||||||
)
|
)
|
||||||
if reply_to_story_id:
|
|
||||||
user_id = await self.resolve_peer(chat_id)
|
|
||||||
reply_to = types.InputReplyToStory(user_id=user_id, story_id=reply_to_story_id)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if isinstance(voice, str):
|
if isinstance(voice, str):
|
||||||
|
|
|
||||||
|
|
@ -122,20 +122,15 @@ class SendWebPage:
|
||||||
|
|
||||||
message, entities = (await utils.parse_text_entities(self, text, parse_mode, entities)).values()
|
message, entities = (await utils.parse_text_entities(self, text, parse_mode, entities)).values()
|
||||||
|
|
||||||
reply_to = None
|
reply_to = await utils.get_reply_to(
|
||||||
reply_to_chat = None
|
client=self,
|
||||||
if reply_to_message_id or message_thread_id:
|
chat_id=chat_id,
|
||||||
if reply_to_chat_id is not None:
|
|
||||||
reply_to_chat = await self.resolve_peer(reply_to_chat_id)
|
|
||||||
reply_to = types.InputReplyToMessage(
|
|
||||||
reply_to_message_id=reply_to_message_id,
|
reply_to_message_id=reply_to_message_id,
|
||||||
|
reply_to_story_id=reply_to_story_id,
|
||||||
message_thread_id=message_thread_id,
|
message_thread_id=message_thread_id,
|
||||||
reply_to_chat=reply_to_chat,
|
reply_to_chat_id=reply_to_chat_id,
|
||||||
quote_text=quote_text
|
quote_text=quote_text
|
||||||
)
|
)
|
||||||
if reply_to_story_id:
|
|
||||||
user_id = await self.resolve_peer(chat_id)
|
|
||||||
reply_to = types.InputReplyToStory(user_id=user_id, story_id=reply_to_story_id)
|
|
||||||
|
|
||||||
media = raw.types.InputMediaWebPage(
|
media = raw.types.InputMediaWebPage(
|
||||||
url=url,
|
url=url,
|
||||||
|
|
|
||||||
|
|
@ -446,3 +446,31 @@ def datetime_to_timestamp(dt: Optional[datetime]) -> Optional[int]:
|
||||||
async def run_sync(func: Callable[..., TypeVar("Result")], *args: Any, **kwargs: Any) -> TypeVar("Result"):
|
async def run_sync(func: Callable[..., TypeVar("Result")], *args: Any, **kwargs: Any) -> TypeVar("Result"):
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
return await loop.run_in_executor(None, functools.partial(func, *args, **kwargs))
|
return await loop.run_in_executor(None, functools.partial(func, *args, **kwargs))
|
||||||
|
|
||||||
|
async def get_reply_to(
|
||||||
|
client: "pyrogram.Client",
|
||||||
|
chat_id: Union[int,str] = None,
|
||||||
|
reply_to_message_id: int = None,
|
||||||
|
reply_to_story_id: int = None,
|
||||||
|
message_thread_id: int = None,
|
||||||
|
reply_to_chat_id: Union[int,str] = None,
|
||||||
|
quote_text: str = None
|
||||||
|
):
|
||||||
|
reply_to = None
|
||||||
|
reply_to_chat = None
|
||||||
|
if reply_to_message_id or message_thread_id:
|
||||||
|
if reply_to_chat_id is not None:
|
||||||
|
reply_to_chat = await client.resolve_peer(reply_to_chat_id)
|
||||||
|
reply_to = types.InputReplyToMessage(
|
||||||
|
reply_to_message_id=reply_to_message_id,
|
||||||
|
message_thread_id=message_thread_id,
|
||||||
|
reply_to_chat=reply_to_chat,
|
||||||
|
quote_text=quote_text
|
||||||
|
)
|
||||||
|
if reply_to_story_id:
|
||||||
|
user_id = await client.resolve_peer(chat_id)
|
||||||
|
reply_to = types.InputReplyToStory(
|
||||||
|
user_id=user_id,
|
||||||
|
story_id=reply_to_story_id
|
||||||
|
)
|
||||||
|
return reply_to
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue