warp-beacon 2.8.12__py3-none-any.whl → 2.8.13__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.
@@ -1,2 +1,2 @@
1
- __version__ = "2.8.12"
1
+ __version__ = "2.8.13"
2
2
 
@@ -11,7 +11,7 @@ from pyrogram import Client, filters
11
11
  from pyrogram.enums import ParseMode, ChatType
12
12
  from pyrogram.handlers import MessageHandler, CallbackQueryHandler
13
13
  from pyrogram.types import InputMediaAudio, InputMediaPhoto, InputMediaVideo, InputMediaAnimation, InlineKeyboardButton, InlineKeyboardMarkup
14
- from pyrogram.errors import NetworkMigrate, BadRequest, MultiMediaTooLong, MessageIdInvalid
14
+ from pyrogram.errors import NetworkMigrate, BadRequest, MultiMediaTooLong, MessageIdInvalid, FloodWait
15
15
 
16
16
  import warp_beacon
17
17
  from warp_beacon.__version__ import __version__
@@ -443,7 +443,13 @@ class Bot(object):
443
443
  JobType.ANIMATION: self.client.send_animation
444
444
  }
445
445
  try:
446
- reply_message = await send_funcs[job.media_type](**self.build_tg_args(job))
446
+ while True:
447
+ try:
448
+ reply_message = await send_funcs[job.media_type](**self.build_tg_args(job))
449
+ break
450
+ except FloodWait as e:
451
+ logging.warning("FloodWait occurred, waiting '%d' seconds before retry", int(e.value))
452
+ asyncio.sleep(e.value)
447
453
  except ValueError as e:
448
454
  err_text = str(e)
449
455
  if "Expected" in err_text:
@@ -464,7 +470,14 @@ class Bot(object):
464
470
  snd_grp_options = {"chat_id": job.chat_id, "reply_to_message_id": job.message_id}
465
471
  for i, media_chunk in enumerate(col_job_args["media"]):
466
472
  snd_grp_options["media"] = media_chunk
467
- messages = await self.client.send_media_group(**snd_grp_options)
473
+ messages = []
474
+ while True:
475
+ try:
476
+ messages = await self.client.send_media_group(**snd_grp_options)
477
+ break
478
+ except FloodWait as e:
479
+ logging.warning("FloodWait occurred, waiting '%d' seconds before retry", int(e.value))
480
+ asyncio.sleep(e.value)
468
481
  sent_messages += messages
469
482
  if job.media_collection:
470
483
  for j, _ in enumerate(media_chunk):
@@ -1,9 +1,13 @@
1
+ import asyncio
1
2
  import re
2
3
 
4
+ import logging
5
+
3
6
  from pyrogram.client import Client
4
7
  from pyrogram.types import InputMedia, InputMediaAudio, InputMediaPhoto, InputMediaVideo, InputMediaAnimation, InlineKeyboardMarkup
5
8
  from pyrogram import raw
6
9
  from pyrogram import types
10
+ from pyrogram.errors import FloodWait
7
11
 
8
12
  from warp_beacon.telegram.progress_bar import ProgressBar
9
13
  from warp_beacon.telegram.types import ReportType
@@ -124,23 +128,30 @@ class EditMessage(object):
124
128
  raw_file_thumb = await self.client.save_file(path=media.thumb)
125
129
  raw_media = self.get_wrapped_animation(raw_file=raw_file, raw_thumb=raw_file_thumb, media=media, file_name=file_name)
126
130
 
127
- peer = await self.client.resolve_peer(chat_id)
128
-
129
- r = await self.client.invoke(
130
- raw.functions.messages.EditMessage(
131
- peer=peer,
132
- id=message_id,
133
- media=raw_media,
134
- reply_markup=await reply_markup.write(self.client) if reply_markup else None,
135
- message=message,
136
- entities=entities
137
- )
138
- )
131
+ peer, r = None, None
132
+ while True:
133
+ try:
134
+ peer = await self.client.resolve_peer(chat_id)
135
+ r = await self.client.invoke(
136
+ raw.functions.messages.EditMessage(
137
+ peer=peer,
138
+ id=message_id,
139
+ media=raw_media,
140
+ reply_markup=await reply_markup.write(self.client) if reply_markup else None,
141
+ message=message,
142
+ entities=entities
143
+ )
144
+ )
145
+ break
146
+ except FloodWait as e:
147
+ logging.warning("FloodWait occurred, waiting '%d' seconds before retry", int(e.value))
148
+ asyncio.sleep(e.value)
139
149
 
140
- for i in r.updates:
141
- if isinstance(i, (raw.types.UpdateEditMessage, raw.types.UpdateEditChannelMessage)):
142
- return await types.Message._parse(
143
- self.client, i.message,
144
- {i.id: i for i in r.users},
145
- {i.id: i for i in r.chats}
146
- )
150
+ if r:
151
+ for i in r.updates:
152
+ if isinstance(i, (raw.types.UpdateEditMessage, raw.types.UpdateEditChannelMessage)):
153
+ return await types.Message._parse(
154
+ self.client, i.message,
155
+ {i.id: i for i in r.users},
156
+ {i.id: i for i in r.chats}
157
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: warp_beacon
3
- Version: 2.8.12
3
+ Version: 2.8.13
4
4
  Summary: Telegram bot for expanding external media links
5
5
  Home-page: https://github.com/sb0y/warp_beacon
6
6
  Author: Andrey Bagrintsev
@@ -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=ioCIkmzTwVXvR1lLWlgUjehGwiXaxB8kTGnfQ-3C1FA,24
7
+ warp_beacon/__version__.py,sha256=1_KpREE4Ar5XxUAevYjPftsGB_movvTsXltUwhStZ6Y,24
8
8
  warp_beacon/warp_beacon.py,sha256=ADCR30uGXIsDrt9WoiI9Ghu2QtWs0qZIK6x3pQKM_B4,1109
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
@@ -45,10 +45,10 @@ warp_beacon/scraper/youtube/youtube.py,sha256=uYR7XpfP6ZnSvw1Gc4qG_M8jkCyv3maEyt
45
45
  warp_beacon/storage/__init__.py,sha256=NaKKPXjwa8LvWsqnVJVz0riXj765lGswG9piKgI2lkY,3389
46
46
  warp_beacon/storage/mongo.py,sha256=qC4ZiO8XXvPnP0rJwz4CJx42pqFsyAjCiW10W5QdT6E,527
47
47
  warp_beacon/telegram/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
48
- warp_beacon/telegram/bot.py,sha256=N4Gswpw-U8Z6yPAKMe7zVfDQSRAgvm6Sx6k5_Y7WWoI,19780
48
+ warp_beacon/telegram/bot.py,sha256=OjN1pniEc_y_Eljg_Nuvoof7sN5cheT1NbbibcEce5U,20234
49
49
  warp_beacon/telegram/caption_shortener.py,sha256=EnguNCF52ne7y4P-iJAbI6K3sqoJqJbND_dX5Fhwkv0,1549
50
50
  warp_beacon/telegram/download_status.py,sha256=N-Qg13LVcPskyQNKG1lw50K1lhFtXu003muCRzZ7wiE,1561
51
- warp_beacon/telegram/edit_message.py,sha256=6DX8eJV70MG_b79WbuJG55qLBs66boElzYdCr8zpMeI,5380
51
+ warp_beacon/telegram/edit_message.py,sha256=vzSrtlt-QxBU-X9uRSKo7gJftOrvB5Qo3iNsVNptCoE,5684
52
52
  warp_beacon/telegram/handlers.py,sha256=32kJtlfSZyG4JbEj9W8tH6us7sZg2ziMmnxpEX_qGXw,10482
53
53
  warp_beacon/telegram/placeholder_message.py,sha256=wN9-BRiyrtHG-EvXtZkGJHt2CX71munQ57ITttjt0mw,6400
54
54
  warp_beacon/telegram/progress_bar.py,sha256=IP4xtvLtdJtqdr2C-0YaU428iQGrKurbP4Npr31iW74,5014
@@ -56,9 +56,9 @@ warp_beacon/telegram/progress_file_reader.py,sha256=e3equyNKlKs764AD-iE9QRsh3YDH
56
56
  warp_beacon/telegram/types.py,sha256=Kvdng6uCF1HRoqQgGW1ZYYPJoVuYkFb-LDvMBbW5Hjk,89
57
57
  warp_beacon/telegram/utils.py,sha256=zTF8VQfAWetBSjAPbmNe_Zi_LN5fAcWptJKjLaFNHaE,5073
58
58
  warp_beacon/uploader/__init__.py,sha256=1enK6qMWaTZEaK456JwaKOfvCvznHA8cjgceOsrF6Po,5732
59
- warp_beacon-2.8.12.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
60
- warp_beacon-2.8.12.dist-info/METADATA,sha256=W7U_kzv74XYVaeNArKB7Gw7UmwGBe2T4Ow6WYmUSl6Y,23236
61
- warp_beacon-2.8.12.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
62
- warp_beacon-2.8.12.dist-info/entry_points.txt,sha256=eSB61Rb89d56WY0O-vEIQwkn18J-4CMrJcLA_R_8h3g,119
63
- warp_beacon-2.8.12.dist-info/top_level.txt,sha256=RraB0PWGvRK2zPYkuICKNgStLG1C5s7rPHHJEHJbkgA,1510
64
- warp_beacon-2.8.12.dist-info/RECORD,,
59
+ warp_beacon-2.8.13.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
60
+ warp_beacon-2.8.13.dist-info/METADATA,sha256=cxyRksofUivhcTgS7dcqbP2BCRASrMUE76BeiInH9M8,23236
61
+ warp_beacon-2.8.13.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
62
+ warp_beacon-2.8.13.dist-info/entry_points.txt,sha256=eSB61Rb89d56WY0O-vEIQwkn18J-4CMrJcLA_R_8h3g,119
63
+ warp_beacon-2.8.13.dist-info/top_level.txt,sha256=RraB0PWGvRK2zPYkuICKNgStLG1C5s7rPHHJEHJbkgA,1510
64
+ warp_beacon-2.8.13.dist-info/RECORD,,