warp-beacon 2.3.21__py3-none-any.whl → 2.3.23__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/storage/__init__.py +1 -4
- warp_beacon/telegram/bot.py +2 -1
- warp_beacon/telegram/handlers.py +26 -4
- {warp_beacon-2.3.21.dist-info → warp_beacon-2.3.23.dist-info}/METADATA +1 -1
- {warp_beacon-2.3.21.dist-info → warp_beacon-2.3.23.dist-info}/RECORD +10 -10
- {warp_beacon-2.3.21.dist-info → warp_beacon-2.3.23.dist-info}/LICENSE +0 -0
- {warp_beacon-2.3.21.dist-info → warp_beacon-2.3.23.dist-info}/WHEEL +0 -0
- {warp_beacon-2.3.21.dist-info → warp_beacon-2.3.23.dist-info}/entry_points.txt +0 -0
- {warp_beacon-2.3.21.dist-info → warp_beacon-2.3.23.dist-info}/top_level.txt +0 -0
warp_beacon/__version__.py
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
__version__ = "2.3.
|
1
|
+
__version__ = "2.3.23"
|
2
2
|
|
warp_beacon/storage/__init__.py
CHANGED
warp_beacon/telegram/bot.py
CHANGED
@@ -91,6 +91,7 @@ class Bot(object):
|
|
91
91
|
self.client.add_handler(MessageHandler(self.handlers.help, filters.command("help")))
|
92
92
|
self.client.add_handler(MessageHandler(self.handlers.random, filters.command("random")))
|
93
93
|
self.client.add_handler(MessageHandler(self.handlers.handler))
|
94
|
+
#TODO refactor to callback router
|
94
95
|
self.client.add_handler(CallbackQueryHandler(self.handlers.simple_button_handler, filters=filters.create(lambda _, __, q: not q.data.startswith("read_more:"))))
|
95
96
|
self.client.add_handler(CallbackQueryHandler(self.handlers.read_more_handler, filters=filters.create(lambda _, __, q: q.data.startswith("read_more:"))))
|
96
97
|
|
@@ -347,7 +348,7 @@ class Bot(object):
|
|
347
348
|
render_donates = os.environ.get("ENABLE_DONATES", None) == "true"
|
348
349
|
keyboard_buttons = [[]]
|
349
350
|
if job.short_text:
|
350
|
-
keyboard_buttons[0].append(InlineKeyboardButton("📖 Read more", callback_data=f"read_more:{job.job_origin}:{job.uniq_id}"))
|
351
|
+
keyboard_buttons[0].append(InlineKeyboardButton("📖 Read more", callback_data=f"read_more:{job.job_origin.value}:{job.uniq_id}"))
|
351
352
|
if render_donates:
|
352
353
|
keyboard_buttons[0].append(InlineKeyboardButton("❤ Donate", url=os.environ.get("DONATE_LINK", "https://pay.cryptocloud.plus/pos/W5BMtNQt5bJFoW2E")))
|
353
354
|
|
warp_beacon/telegram/handlers.py
CHANGED
@@ -41,6 +41,8 @@ class Handlers(object):
|
|
41
41
|
media_type=JobType[d["media_type"].upper()],
|
42
42
|
message_id=message.id,
|
43
43
|
chat_type=message.chat.type,
|
44
|
+
uniq_id=d["uniq_id"],
|
45
|
+
job_origin=Origin(d["origin"]),
|
44
46
|
source_username=Utils.extract_message_author(message)
|
45
47
|
)
|
46
48
|
)
|
@@ -171,6 +173,8 @@ class Handlers(object):
|
|
171
173
|
await self.bot.upload_job(
|
172
174
|
UploadJob(
|
173
175
|
url=url,
|
176
|
+
uniq_id=uniq_id,
|
177
|
+
job_origin=origin,
|
174
178
|
tg_file_id=",".join(tg_file_ids),
|
175
179
|
message_id=effective_message_id,
|
176
180
|
media_type=JobType.COLLECTION,
|
@@ -186,6 +190,8 @@ class Handlers(object):
|
|
186
190
|
await self.bot.upload_job(
|
187
191
|
UploadJob(
|
188
192
|
url=url,
|
193
|
+
uniq_id=uniq_id,
|
194
|
+
job_origin=origin,
|
189
195
|
tg_file_id=tg_file_ids.pop(),
|
190
196
|
message_id=effective_message_id,
|
191
197
|
media_type=media_type,
|
@@ -230,7 +236,7 @@ class Handlers(object):
|
|
230
236
|
parts = query.data.split(':')
|
231
237
|
if len(parts) == 3:
|
232
238
|
_, origin, uniq_id = parts
|
233
|
-
logging.info("Handling read_more request: uniq_id='%s', origin='%s", uniq_id, origin)
|
239
|
+
logging.info("Handling read_more request: uniq_id='%s', origin='%s'", uniq_id, origin)
|
234
240
|
db_results = []
|
235
241
|
if uniq_id and origin:
|
236
242
|
db_results = self.storage.db_find(uniq_id=uniq_id.strip(), origin=origin.strip())
|
@@ -239,11 +245,27 @@ class Handlers(object):
|
|
239
245
|
first_entity = db_results[0]
|
240
246
|
|
241
247
|
try:
|
248
|
+
text = first_entity.get("canonical_name", "Failed to fetch data.")
|
249
|
+
if len(text) > 200:
|
250
|
+
text = text[:134] + "... \nText exceeds Telegram's limits. Use 'source link' in message."
|
242
251
|
await client.answer_callback_query(
|
243
252
|
callback_query_id=query.id,
|
244
253
|
show_alert=True,
|
245
|
-
text=
|
254
|
+
text=text
|
246
255
|
)
|
247
256
|
except Exception as e:
|
248
|
-
logging.warning("read_more_handler: Failed for uniq_id='%s', origin='%s", uniq_id, origin)
|
249
|
-
logging.exception(e)
|
257
|
+
logging.warning("read_more_handler: Failed for uniq_id='%s', origin='%s'", uniq_id, origin)
|
258
|
+
logging.exception(e)
|
259
|
+
|
260
|
+
try:
|
261
|
+
error_text = str(e)
|
262
|
+
if len(error_text) > 200:
|
263
|
+
error_text = error_text[:197] + "..."
|
264
|
+
|
265
|
+
await client.answer_callback_query(
|
266
|
+
callback_query_id=query.id,
|
267
|
+
show_alert=True,
|
268
|
+
text=error_text
|
269
|
+
)
|
270
|
+
except Exception as _:
|
271
|
+
pass
|
@@ -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=UXTGdNzHbVz-t0lUkxpvpPc5wkOHbaYl5uqcE8KcgE4,24
|
8
8
|
warp_beacon/warp_beacon.py,sha256=7KEtZDj-pdhtl6m-zFLsSojs1ZR4o7L0xbqtdmYPvfE,342
|
9
9
|
warp_beacon/compress/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
10
10
|
warp_beacon/compress/video.py,sha256=_PDMVYCyzLYxHv1uZmmzGcG_8rjaZr7BTXsXTTy_oS4,2846
|
@@ -33,18 +33,18 @@ warp_beacon/scraper/youtube/abstract.py,sha256=cBtExei2Cb3o4YBtHqi8If_FdmE6NyJqN
|
|
33
33
|
warp_beacon/scraper/youtube/music.py,sha256=qbijpSv54fsrIYHeY-nfmw4vo6oBmedQHsVG8pXNfrc,1380
|
34
34
|
warp_beacon/scraper/youtube/shorts.py,sha256=ujGEV7ILXHqBRa99SyITsnR7ulAHJDtumAh51kVX880,1231
|
35
35
|
warp_beacon/scraper/youtube/youtube.py,sha256=fGrbjBngvvNdpzhb1yZVedNW0_tCrLc31VSYMSHzcQY,2135
|
36
|
-
warp_beacon/storage/__init__.py,sha256=
|
36
|
+
warp_beacon/storage/__init__.py,sha256=0Vajd0oITKJfu2vmNx5uQSt3-L6vwIvUYWJo8HZCjco,3398
|
37
37
|
warp_beacon/storage/mongo.py,sha256=qC4ZiO8XXvPnP0rJwz4CJx42pqFsyAjCiW10W5QdT6E,527
|
38
38
|
warp_beacon/telegram/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
39
|
-
warp_beacon/telegram/bot.py,sha256
|
39
|
+
warp_beacon/telegram/bot.py,sha256=I-KPdeg-LMRb6wRRn2MLHndz9zhgSTBkxOhNQyWZwKI,16511
|
40
40
|
warp_beacon/telegram/caption_shortener.py,sha256=6J4Dp35mOmJEyctiuN8WXM39bkQ13m78HoghsYX3fbU,1548
|
41
|
-
warp_beacon/telegram/handlers.py,sha256=
|
41
|
+
warp_beacon/telegram/handlers.py,sha256=6uyyU4dbRyIYHTnCl1grO95cU7INECfoAEZ84kmelXs,9163
|
42
42
|
warp_beacon/telegram/placeholder_message.py,sha256=wN9-BRiyrtHG-EvXtZkGJHt2CX71munQ57ITttjt0mw,6400
|
43
43
|
warp_beacon/telegram/utils.py,sha256=9uebX53G16mV7ER7WgfdWBLFHHw14S8HBt9URrIskg0,4440
|
44
44
|
warp_beacon/uploader/__init__.py,sha256=5KRWsxPRGuQ56YhCEnJsXnb-yQp8dpvWEsPDf0dD-fw,4964
|
45
|
-
warp_beacon-2.3.
|
46
|
-
warp_beacon-2.3.
|
47
|
-
warp_beacon-2.3.
|
48
|
-
warp_beacon-2.3.
|
49
|
-
warp_beacon-2.3.
|
50
|
-
warp_beacon-2.3.
|
45
|
+
warp_beacon-2.3.23.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
46
|
+
warp_beacon-2.3.23.dist-info/METADATA,sha256=jROYnnpf4BMQ2CqcvjDA2c9q1CxHKZrNzpGvF0tA6V4,21723
|
47
|
+
warp_beacon-2.3.23.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
|
48
|
+
warp_beacon-2.3.23.dist-info/entry_points.txt,sha256=eSB61Rb89d56WY0O-vEIQwkn18J-4CMrJcLA_R_8h3g,119
|
49
|
+
warp_beacon-2.3.23.dist-info/top_level.txt,sha256=2iKFlYwJ-meO9sCX4OGEP1hhQN17t2KFksQ5dXMhXUA,1103
|
50
|
+
warp_beacon-2.3.23.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|