warp-beacon 2.1.12__py3-none-any.whl → 2.2.0__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.1.12"
1
+ __version__ = "2.2.0"
2
2
 
@@ -65,7 +65,7 @@ class AbstractJob(ABC):
65
65
  canonical_name: str = ""
66
66
  is_message_to_admin: bool = False
67
67
  message_text: str = ""
68
- source_usename: str = ""
68
+ source_username: str = ""
69
69
  unvailable_error_count: int = 0
70
70
  geoblock_error_count: int = 0
71
71
  account_switches: int = 0
@@ -149,9 +149,9 @@ class Bot(object):
149
149
  def build_signature_caption(self, job: UploadJob) -> str:
150
150
  caption = ""
151
151
  if job.chat_type in (ChatType.GROUP, ChatType.SUPERGROUP):
152
- if job.source_usename:
153
- caption += f"Requested by **@{job.source_usename}**"
154
- if job.source_usename and job.url:
152
+ if job.source_username:
153
+ caption += f"Requested by **@{job.source_username}**"
154
+ if job.source_username and job.url:
155
155
  caption += " | "
156
156
  if job.url:
157
157
  caption += f"[Source link]({job.url})"
@@ -39,7 +39,7 @@ class Handlers(object):
39
39
  media_type=JobType[d["media_type"].upper()],
40
40
  message_id=message.id,
41
41
  chat_type=message.chat.type,
42
- source_username=message.from_user
42
+ source_username=Utils.extract_message_author(message)
43
43
  )
44
44
  )
45
45
 
@@ -100,7 +100,7 @@ class Handlers(object):
100
100
  media_type=JobType.COLLECTION,
101
101
  chat_id=chat.id,
102
102
  chat_type=message.chat.type,
103
- source_username=message.from_user
103
+ source_username=Utils.extract_message_author(message)
104
104
  )
105
105
  )
106
106
  elif ent_len:
@@ -113,7 +113,7 @@ class Handlers(object):
113
113
  media_type=media_type,
114
114
  chat_id=chat.id,
115
115
  chat_type=message.chat.type,
116
- source_username=message.from_user
116
+ source_username=Utils.extract_message_author(message)
117
117
  )
118
118
  )
119
119
  else:
@@ -164,7 +164,7 @@ class Handlers(object):
164
164
  in_process=self.bot.uploader.is_inprocess(uniq_id),
165
165
  uniq_id=uniq_id,
166
166
  job_origin=origin,
167
- source_username=message.from_user,
167
+ source_username=Utils.extract_message_author(message),
168
168
  chat_type=chat.type
169
169
  ))
170
170
  self.bot.uploader.set_inprocess(uniq_id)
@@ -84,6 +84,11 @@ class Utils(object):
84
84
  @staticmethod
85
85
  def extract_message_author(message: Message) -> str:
86
86
  if message.from_user:
87
- return message.from_user
87
+ return message.from_user.username
88
+ if message.sender_chat:
89
+ if message.sender_chat.username:
90
+ return message.sender_chat.username
91
+ if message.sender_chat.title:
92
+ return message.sender_chat.title
88
93
  return ''
89
94
 
@@ -2,12 +2,11 @@ import os
2
2
  import threading
3
3
  import multiprocessing
4
4
  from warp_beacon.jobs.upload_job import UploadJob
5
- #import time
6
5
  import logging
7
6
 
8
7
  import asyncio
9
8
 
10
- from typing import Optional, Callable, Coroutine
9
+ from typing import Callable
11
10
 
12
11
  from warp_beacon.storage import Storage
13
12
  from warp_beacon.jobs.types import JobType
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: warp_beacon
3
- Version: 2.1.12
3
+ Version: 2.2.0
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
@@ -3,12 +3,12 @@ lib/systemd/system/warp_beacon.service,sha256=lPmHqLqcI2eIV7nwHS0qcALQrznixqJuww
3
3
  var/warp_beacon/accounts.json,sha256=rKFQM_b9eoDS4mJ1B_SZNolPLXx1SQdQMdY2F_ZcBt8,1523
4
4
  var/warp_beacon/placeholder.gif,sha256=cE5CGJVaop4Sx21zx6j4AyoHU0ncmvQuS2o6hJfEH88,6064
5
5
  warp_beacon/__init__.py,sha256=_rThNODmz0nDp_n4mWo_HKaNFE5jk1_7cRhHyYaencI,163
6
- warp_beacon/__version__.py,sha256=fvnVLCMKtvzONpqcFCrZo4HrUEtArCwJghjH2toLovk,24
6
+ warp_beacon/__version__.py,sha256=WMCzR_QnD3JzFHSeOqgJDoy5dvPLvgg2SMbWaTYllMs,23
7
7
  warp_beacon/warp_beacon.py,sha256=7KEtZDj-pdhtl6m-zFLsSojs1ZR4o7L0xbqtdmYPvfE,342
8
8
  warp_beacon/compress/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  warp_beacon/compress/video.py,sha256=_PDMVYCyzLYxHv1uZmmzGcG_8rjaZr7BTXsXTTy_oS4,2846
10
10
  warp_beacon/jobs/__init__.py,sha256=ED8_tPle4iL4kqNW0apAVkgNQtRRTnYfAJwBjO1g0JY,180
11
- warp_beacon/jobs/abstract.py,sha256=5jCkCTNVeoO55a-q2VmcY_94VMQfR1UPokK1tUDiQ4g,2849
11
+ warp_beacon/jobs/abstract.py,sha256=6TKiVqVTNmAGIGO4YL4FsxEiaySp3vt9C_P1q1D3mDc,2850
12
12
  warp_beacon/jobs/download_job.py,sha256=5HiPcnJppFMhO14___3eSkoMygM3y-vhpGkMAuNhK7s,854
13
13
  warp_beacon/jobs/types.py,sha256=Ae8zINgbs7cOcYkYoOCOACA7duyhnIGMQAJ_SJB1QRQ,176
14
14
  warp_beacon/jobs/upload_job.py,sha256=_ul4psPej1jLEs-BMcMR80GbXDSmm38jE9yoZtecclY,741
@@ -32,14 +32,14 @@ warp_beacon/scraper/youtube/shorts.py,sha256=pHfvEBau8Zp7Ar3LBuPmjqYq8fmjJUQvzeZ
32
32
  warp_beacon/scraper/youtube/youtube.py,sha256=K98n2TSJaDZt-xT7mADZL1UEf2exIYm0Wnenn2GAYfI,2250
33
33
  warp_beacon/storage/__init__.py,sha256=8XsJXq9X7GDlTaWREF4W1PDX9PH5utwhjf5c5M8Bb7o,3378
34
34
  warp_beacon/telegram/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
35
- warp_beacon/telegram/bot.py,sha256=QTLNeOTMHOMs2W7mAY_ygVzxJu7N-IMBrBvPDHMLCCI,14789
36
- warp_beacon/telegram/handlers.py,sha256=8MeLgnhaucLc7ptsKV3NXecsGN7kItwrU5xIoJ1Eik8,6645
35
+ warp_beacon/telegram/bot.py,sha256=lH_0oQCsJOLLAwQVzFAOiSW4wm7-UQrKZRDd-PzDfiU,14792
36
+ warp_beacon/telegram/handlers.py,sha256=ccqUY7YbddDNbTxYVxpDPjLVJmcAL14yoaQ7xT9WBLU,6725
37
37
  warp_beacon/telegram/placeholder_message.py,sha256=u5kVfTjGmVYkwA5opniRltHXGpsdSxI41WEde8J5os0,6418
38
- warp_beacon/telegram/utils.py,sha256=LdCU4ChJHyzpCvyG5v3XcUtUgK3v5by_v8D56VsPeI0,2171
39
- warp_beacon/uploader/__init__.py,sha256=BQ5rli0soLf0FGqCpivVh9w6lyoGM10-ck2mUjnoOLU,4777
40
- warp_beacon-2.1.12.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
41
- warp_beacon-2.1.12.dist-info/METADATA,sha256=QoScSZBGQfB8owQeFNd2Q0XDlcOecc9Kzt-3-Ur34J8,21251
42
- warp_beacon-2.1.12.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
43
- warp_beacon-2.1.12.dist-info/entry_points.txt,sha256=eSB61Rb89d56WY0O-vEIQwkn18J-4CMrJcLA_R_8h3g,119
44
- warp_beacon-2.1.12.dist-info/top_level.txt,sha256=ALb_Ft_eG-OY4_m0TWUifNUOZsrx483L-zw7G7vqXoc,971
45
- warp_beacon-2.1.12.dist-info/RECORD,,
38
+ warp_beacon/telegram/utils.py,sha256=ikfwmuDvd0XtOuwP29tZPjAz7kwiGSSu_QR-vpv6pMY,2352
39
+ warp_beacon/uploader/__init__.py,sha256=rsUkzzmtaeQY-kNkcIiPsrayS9idFKY3hBC71mR19XE,4743
40
+ warp_beacon-2.2.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
41
+ warp_beacon-2.2.0.dist-info/METADATA,sha256=LyrV1URH8gNbGV57ZTyyWGzuIC4UrrBvLzZR_a-AcVw,21250
42
+ warp_beacon-2.2.0.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
43
+ warp_beacon-2.2.0.dist-info/entry_points.txt,sha256=eSB61Rb89d56WY0O-vEIQwkn18J-4CMrJcLA_R_8h3g,119
44
+ warp_beacon-2.2.0.dist-info/top_level.txt,sha256=ALb_Ft_eG-OY4_m0TWUifNUOZsrx483L-zw7G7vqXoc,971
45
+ warp_beacon-2.2.0.dist-info/RECORD,,