warp-beacon 2.6.77__py3-none-any.whl → 2.6.79__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- warp_beacon/__version__.py +1 -1
- warp_beacon/telegram/edit_message.py +22 -18
- {warp_beacon-2.6.77.dist-info → warp_beacon-2.6.79.dist-info}/METADATA +1 -1
- {warp_beacon-2.6.77.dist-info → warp_beacon-2.6.79.dist-info}/RECORD +8 -8
- {warp_beacon-2.6.77.dist-info → warp_beacon-2.6.79.dist-info}/WHEEL +0 -0
- {warp_beacon-2.6.77.dist-info → warp_beacon-2.6.79.dist-info}/entry_points.txt +0 -0
- {warp_beacon-2.6.77.dist-info → warp_beacon-2.6.79.dist-info}/licenses/LICENSE +0 -0
- {warp_beacon-2.6.77.dist-info → warp_beacon-2.6.79.dist-info}/top_level.txt +0 -0
warp_beacon/__version__.py
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
__version__ = "2.6.
|
1
|
+
__version__ = "2.6.79"
|
2
2
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
import re
|
2
|
+
|
1
3
|
from pyrogram.client import Client
|
2
4
|
from pyrogram.types import InputMedia, InputMediaAudio, InputMediaPhoto, InputMediaVideo, InputMediaAnimation, InlineKeyboardMarkup
|
3
5
|
from pyrogram import raw
|
@@ -9,6 +11,7 @@ from warp_beacon.telegram.types import ReportType
|
|
9
11
|
class EditMessage(object):
|
10
12
|
def __init__(self, client: Client) -> None:
|
11
13
|
self.client = client
|
14
|
+
self.base64_str_tpl = re.compile(r"[A-Za-z0-9\-_]{30,}")
|
12
15
|
|
13
16
|
def get_wrapped_video(self, raw_file: raw.base.InputFile, raw_thumb: raw.base.InputFile, media: InputMediaVideo, file_name: str = None) -> raw.types.InputMediaUploadedDocument:
|
14
17
|
return raw.types.InputMediaUploadedDocument(
|
@@ -72,18 +75,8 @@ class EditMessage(object):
|
|
72
75
|
]
|
73
76
|
)
|
74
77
|
|
75
|
-
|
76
|
-
|
77
|
-
# chat_id: int | str,
|
78
|
-
# message_id: int,
|
79
|
-
# file_name: str
|
80
|
-
#) -> raw.base.InputFile:
|
81
|
-
# progress_bar = ProgressBar(self.client)
|
82
|
-
# progress_id = f"{chat_id}:{message_id}:{file_name}"
|
83
|
-
# self.progress_bars[progress_id] = progress_bar
|
84
|
-
# raw_file = await self.client.save_file(path=media.media, progress=progress_bar.progress_callback, progress_args=(chat_id, message_id, file_name,))
|
85
|
-
# del self.progress_bars[progress_id]
|
86
|
-
# return raw_file
|
78
|
+
def looks_like_token(self, s: str) -> bool:
|
79
|
+
return bool(re.fullmatch(self.base64_str_tpl, s))
|
87
80
|
|
88
81
|
async def edit(self,
|
89
82
|
chat_id: int | str,
|
@@ -92,9 +85,14 @@ class EditMessage(object):
|
|
92
85
|
reply_markup: InlineKeyboardMarkup = None,
|
93
86
|
file_name: str = None
|
94
87
|
) -> None:
|
95
|
-
|
96
|
-
|
97
|
-
|
88
|
+
is_looks_like_token = self.looks_like_token(media.media)
|
89
|
+
raw_file = None
|
90
|
+
if not is_looks_like_token:
|
91
|
+
progress_bar = ProgressBar(self.client)
|
92
|
+
#await progress_bar.progress_callback(current=0, total=0, chat_id=chat_id, message_id=message_id, operation="Uploading", label=file_name, report_type=ReportType.PROGRESS)
|
93
|
+
raw_file = await self.client.save_file(path=media.media, progress=progress_bar.progress_callback, progress_args=(chat_id, message_id, "Uploading", ReportType.PROGRESS, file_name))
|
94
|
+
else:
|
95
|
+
raw_file = media.media
|
98
96
|
|
99
97
|
caption = media.caption
|
100
98
|
parse_mode = media.parse_mode
|
@@ -107,17 +105,23 @@ class EditMessage(object):
|
|
107
105
|
raw_media = None
|
108
106
|
if isinstance(media, types.InputMediaVideo):
|
109
107
|
#progress_bar_thumb = ProgressBar(self.client)
|
110
|
-
raw_file_thumb =
|
108
|
+
raw_file_thumb = None
|
109
|
+
if not is_looks_like_token:
|
110
|
+
raw_file_thumb = await self.client.save_file(path=media.thumb)
|
111
111
|
raw_media = self.get_wrapped_video(raw_file=raw_file, raw_thumb=raw_file_thumb, media=media, file_name=file_name)
|
112
112
|
elif isinstance(media, types.InputMediaPhoto):
|
113
113
|
raw_media = self.get_wrapped_photo(raw_file=raw_file, media=media)
|
114
114
|
elif isinstance(media, types.InputMediaAudio):
|
115
115
|
#progress_bar_thumb = ProgressBar(self.client)
|
116
|
-
raw_file_thumb =
|
116
|
+
raw_file_thumb = None
|
117
|
+
if not is_looks_like_token:
|
118
|
+
raw_file_thumb = await self.client.save_file(path=media.thumb)
|
117
119
|
raw_media = self.get_wrapped_audio(raw_file=raw_file, raw_thumb=raw_file_thumb, media=media, file_name=file_name)
|
118
120
|
elif isinstance(media, types.InputMediaAnimation):
|
119
121
|
#progress_bar_thumb = ProgressBar(self.client)
|
120
|
-
raw_file_thumb =
|
122
|
+
raw_file_thumb = None
|
123
|
+
if not is_looks_like_token:
|
124
|
+
raw_file_thumb = await self.client.save_file(path=media.thumb)
|
121
125
|
raw_media = self.get_wrapped_animation(raw_file=raw_file, raw_thumb=raw_file_thumb, media=media, file_name=file_name)
|
122
126
|
|
123
127
|
peer = await self.client.resolve_peer(chat_id)
|
@@ -4,7 +4,7 @@ var/warp_beacon/accounts.json,sha256=OsXdncs6h88xrF_AP6_WDCK1waGBn9SR-uYdIeK37GM
|
|
4
4
|
var/warp_beacon/placeholder.gif,sha256=cE5CGJVaop4Sx21zx6j4AyoHU0ncmvQuS2o6hJfEH88,6064
|
5
5
|
var/warp_beacon/proxies.json,sha256=VnjlQDXumOEq72ZFjbh6IqHS1TEHqn8HPYAZqWCeSIA,95
|
6
6
|
warp_beacon/__init__.py,sha256=_rThNODmz0nDp_n4mWo_HKaNFE5jk1_7cRhHyYaencI,163
|
7
|
-
warp_beacon/__version__.py,sha256=
|
7
|
+
warp_beacon/__version__.py,sha256=fIHRv6Lh_-_MPXE4cWurV7F1_97JtHjki9EwiHNmOYk,24
|
8
8
|
warp_beacon/warp_beacon.py,sha256=ED43vNzdjDUJ_9qLCbri0bjWLWEJ69BENGj9i7G6AvM,342
|
9
9
|
warp_beacon/yt_auth.py,sha256=GUTKqYr_tzDC-07Lx_ahWXSag8EyLxXBUnQbDBIkEmk,6022
|
10
10
|
warp_beacon/compress/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -44,7 +44,7 @@ warp_beacon/telegram/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hS
|
|
44
44
|
warp_beacon/telegram/bot.py,sha256=W13hyJD89ozZallLq0NIb9c3uh1Hov8Axi7ab7LkE3A,19128
|
45
45
|
warp_beacon/telegram/caption_shortener.py,sha256=EnguNCF52ne7y4P-iJAbI6K3sqoJqJbND_dX5Fhwkv0,1549
|
46
46
|
warp_beacon/telegram/download_status.py,sha256=JNevX0VQh39fX98fjM9j_nm0Ribj8f3tfa6kxpeNapQ,1484
|
47
|
-
warp_beacon/telegram/edit_message.py,sha256=
|
47
|
+
warp_beacon/telegram/edit_message.py,sha256=6DX8eJV70MG_b79WbuJG55qLBs66boElzYdCr8zpMeI,5380
|
48
48
|
warp_beacon/telegram/handlers.py,sha256=uvR6TPHSqdSxigp3wR-ewiE6t3TvVcbVLVcYGwkgD2s,9559
|
49
49
|
warp_beacon/telegram/placeholder_message.py,sha256=wN9-BRiyrtHG-EvXtZkGJHt2CX71munQ57ITttjt0mw,6400
|
50
50
|
warp_beacon/telegram/progress_bar.py,sha256=VBF_qwjOCu0mXN-r_Us4M7qoDWoyvjrw2R2TLgFvTKM,4858
|
@@ -52,9 +52,9 @@ warp_beacon/telegram/progress_file_reader.py,sha256=e3equyNKlKs764AD-iE9QRsh3YDH
|
|
52
52
|
warp_beacon/telegram/types.py,sha256=Kvdng6uCF1HRoqQgGW1ZYYPJoVuYkFb-LDvMBbW5Hjk,89
|
53
53
|
warp_beacon/telegram/utils.py,sha256=1Lq67aRylVJzbwSyvAgjPAGjJZFATkICvAj3TJGuJiM,4635
|
54
54
|
warp_beacon/uploader/__init__.py,sha256=j3qcuKhpchseZLGzSsSiogqe6WdMbkK8d3I-ConhNRs,5687
|
55
|
-
warp_beacon-2.6.
|
56
|
-
warp_beacon-2.6.
|
57
|
-
warp_beacon-2.6.
|
58
|
-
warp_beacon-2.6.
|
59
|
-
warp_beacon-2.6.
|
60
|
-
warp_beacon-2.6.
|
55
|
+
warp_beacon-2.6.79.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
56
|
+
warp_beacon-2.6.79.dist-info/METADATA,sha256=QwJFaKW7mFd8WU4WPTiCxFad6znDUgItYvUKHdxdQTQ,22706
|
57
|
+
warp_beacon-2.6.79.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
|
58
|
+
warp_beacon-2.6.79.dist-info/entry_points.txt,sha256=eSB61Rb89d56WY0O-vEIQwkn18J-4CMrJcLA_R_8h3g,119
|
59
|
+
warp_beacon-2.6.79.dist-info/top_level.txt,sha256=5YQRN46STNg81V_3jdzZ6bftkMxhe1hTPSFvJugDu84,1405
|
60
|
+
warp_beacon-2.6.79.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|