From 715ae147512d55d43b6296d1a0c829a60aa76151 Mon Sep 17 00:00:00 2001
From: Dan <14043624+delivrance@users.noreply.github.com>
Date: Thu, 30 May 2019 14:57:52 +0200
Subject: [PATCH] Update send_* methods (for file_ids)
---
.../methods/messages/edit_message_media.py | 118 +-----------------
.../client/methods/messages/send_animation.py | 27 +---
.../client/methods/messages/send_audio.py | 27 +---
.../methods/messages/send_cached_media.py | 34 +----
.../methods/messages/send_chat_action.py | 2 +-
.../client/methods/messages/send_document.py | 27 +---
.../methods/messages/send_media_group.py | 50 +-------
.../client/methods/messages/send_photo.py | 28 +----
.../client/methods/messages/send_sticker.py | 27 +---
.../client/methods/messages/send_video.py | 27 +---
.../methods/messages/send_video_note.py | 27 +---
.../client/methods/messages/send_voice.py | 27 +---
12 files changed, 26 insertions(+), 395 deletions(-)
diff --git a/pyrogram/client/methods/messages/edit_message_media.py b/pyrogram/client/methods/messages/edit_message_media.py
index b15daa9b..3793c693 100644
--- a/pyrogram/client/methods/messages/edit_message_media.py
+++ b/pyrogram/client/methods/messages/edit_message_media.py
@@ -16,14 +16,11 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrogram. If not, see .
-import binascii
import os
-import struct
from typing import Union
import pyrogram
from pyrogram.api import functions, types
-from pyrogram.errors import FileIdInvalid
from pyrogram.client.ext import BaseClient, utils
from pyrogram.client.types import (
InputMediaPhoto, InputMediaVideo, InputMediaAudio,
@@ -94,28 +91,7 @@ class EditMessageMedia(BaseClient):
url=media.media
)
else:
- try:
- decoded = utils.decode(media.media)
- fmt = " 24 else " 24 else " 24 else " 24 else " 24 else ".
-import binascii
import os
-import struct
from typing import Union
import pyrogram
from pyrogram.api import functions, types
-from pyrogram.errors import FileIdInvalid, FilePartMissing
from pyrogram.client.ext import BaseClient, utils
+from pyrogram.errors import FilePartMissing
class SendAnimation(BaseClient):
@@ -153,28 +151,7 @@ class SendAnimation(BaseClient):
url=animation
)
else:
- try:
- decoded = utils.decode(animation)
- fmt = " 24 else ".
-import binascii
import os
-import struct
from typing import Union
import pyrogram
from pyrogram.api import functions, types
-from pyrogram.errors import FileIdInvalid, FilePartMissing
from pyrogram.client.ext import BaseClient, utils
+from pyrogram.errors import FilePartMissing
class SendAudio(BaseClient):
@@ -153,28 +151,7 @@ class SendAudio(BaseClient):
url=audio
)
else:
- try:
- decoded = utils.decode(audio)
- fmt = " 24 else ".
-import binascii
-import struct
from typing import Union
import pyrogram
from pyrogram.api import functions, types
-from pyrogram.errors import FileIdInvalid
from pyrogram.client.ext import BaseClient, utils
@@ -84,39 +81,10 @@ class SendCachedMedia(BaseClient):
"""
style = self.html if parse_mode.lower() == "html" else self.markdown
- try:
- decoded = utils.decode(file_id)
- fmt = " 24 else ".
+import json
from typing import Union
from pyrogram.api import functions, types
from pyrogram.client.ext import BaseClient
-import json
class ChatAction:
diff --git a/pyrogram/client/methods/messages/send_document.py b/pyrogram/client/methods/messages/send_document.py
index df202fd7..ff523303 100644
--- a/pyrogram/client/methods/messages/send_document.py
+++ b/pyrogram/client/methods/messages/send_document.py
@@ -16,15 +16,13 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrogram. If not, see .
-import binascii
import os
-import struct
from typing import Union
import pyrogram
from pyrogram.api import functions, types
-from pyrogram.errors import FileIdInvalid, FilePartMissing
from pyrogram.client.ext import BaseClient, utils
+from pyrogram.errors import FilePartMissing
class SendDocument(BaseClient):
@@ -134,28 +132,7 @@ class SendDocument(BaseClient):
url=document
)
else:
- try:
- decoded = utils.decode(document)
- fmt = " 24 else ".
-import binascii
import logging
import os
-import struct
import time
from typing import Union, List
import pyrogram
from pyrogram.api import functions, types
-from pyrogram.errors import FileIdInvalid, FloodWait
from pyrogram.client.ext import BaseClient, utils
+from pyrogram.errors import FloodWait
log = logging.getLogger(__name__)
@@ -96,28 +94,7 @@ class SendMediaGroup(BaseClient):
)
)
else:
- try:
- decoded = utils.decode(i.media)
- fmt = " 24 else " 24 else ".
-import binascii
import os
-import struct
from typing import Union
import pyrogram
from pyrogram.api import functions, types
-from pyrogram.errors import FileIdInvalid, FilePartMissing
from pyrogram.client.ext import BaseClient, utils
+from pyrogram.errors import FilePartMissing
class SendPhoto(BaseClient):
@@ -129,29 +127,7 @@ class SendPhoto(BaseClient):
ttl_seconds=ttl_seconds
)
else:
- try:
- decoded = utils.decode(photo)
- fmt = " 24 else ".
-import binascii
import os
-import struct
from typing import Union
import pyrogram
from pyrogram.api import functions, types
-from pyrogram.errors import FileIdInvalid, FilePartMissing
from pyrogram.client.ext import BaseClient, utils
+from pyrogram.errors import FilePartMissing
class SendSticker(BaseClient):
@@ -114,28 +112,7 @@ class SendSticker(BaseClient):
url=sticker
)
else:
- try:
- decoded = utils.decode(sticker)
- fmt = " 24 else ".
-import binascii
import os
-import struct
from typing import Union
import pyrogram
from pyrogram.api import functions, types
-from pyrogram.errors import FileIdInvalid, FilePartMissing
from pyrogram.client.ext import BaseClient, utils
+from pyrogram.errors import FilePartMissing
class SendVideo(BaseClient):
@@ -156,28 +154,7 @@ class SendVideo(BaseClient):
url=video
)
else:
- try:
- decoded = utils.decode(video)
- fmt = " 24 else ".
-import binascii
import os
-import struct
from typing import Union
import pyrogram
from pyrogram.api import functions, types
-from pyrogram.errors import FileIdInvalid, FilePartMissing
from pyrogram.client.ext import BaseClient, utils
+from pyrogram.errors import FilePartMissing
class SendVideoNote(BaseClient):
@@ -133,28 +131,7 @@ class SendVideoNote(BaseClient):
]
)
else:
- try:
- decoded = utils.decode(video_note)
- fmt = " 24 else ".
-import binascii
import os
-import struct
from typing import Union
import pyrogram
from pyrogram.api import functions, types
-from pyrogram.errors import FileIdInvalid, FilePartMissing
from pyrogram.client.ext import BaseClient, utils
+from pyrogram.errors import FilePartMissing
class SendVoice(BaseClient):
@@ -132,28 +130,7 @@ class SendVoice(BaseClient):
url=voice
)
else:
- try:
- decoded = utils.decode(voice)
- fmt = " 24 else "