warp-beacon 2.3.7__py3-none-any.whl → 2.3.8__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.3.7"
1
+ __version__ = "2.3.8"
2
2
 
@@ -138,7 +138,7 @@ class Handlers(object):
138
138
  urls, msg_leftover = [], ''
139
139
  if urls_raw:
140
140
  msg_leftover = Utils.compute_leftover(urls_raw, message_text)
141
- msg_leftover = Utils.handle_mentions(chat.id, client, msg_leftover)
141
+ msg_leftover = await Utils.handle_mentions(chat.id, client, msg_leftover)
142
142
  # remove duplicates
143
143
  urls = list(set(urls_raw))
144
144
 
@@ -106,21 +106,22 @@ class Utils(object):
106
106
  return ret
107
107
 
108
108
  @staticmethod
109
- def handle_mentions(chat_id: int, client: Client, message: str) -> str:
109
+ async def handle_mentions(chat_id: int, client: Client, message: str) -> str:
110
110
  try:
111
111
  username = ''
112
- members = client.get_chat_members(chat_id)
113
- mentions = Utils.mention_re.findall(message)
114
- for mention in mentions:
115
- username = mention[1:].strip()
116
- if username:
117
- user_id = 0
118
- for member in members:
119
- if member.user.username == username:
120
- user_id = member.user.id
121
- break
122
- if user_id:
123
- message.replace(f"@{username}", f'<a href="tg://user?id={user_id}">{username}</a>')
112
+ async with client:
113
+ members = client.get_chat_members(chat_id)
114
+ mentions = Utils.mention_re.findall(message)
115
+ async for mention in mentions:
116
+ username = mention[1:].strip()
117
+ if username:
118
+ user_id = 0
119
+ async for member in members:
120
+ if member.user.username == username:
121
+ user_id = member.user.id
122
+ break
123
+ if user_id:
124
+ message.replace(f"@{username}", f'<a href="tg://user?id={user_id}">{username}</a>')
124
125
  except Exception as e:
125
126
  logging.warning("Exception occurred while handling TG mentions!")
126
127
  logging.exception(e)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: warp_beacon
3
- Version: 2.3.7
3
+ Version: 2.3.8
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=Fdm6rnbh0XX1W_9L7tTwDxi3444GXEyAwtL0RR5fzF4,23
7
+ warp_beacon/__version__.py,sha256=RtuduWpxwlRX0HucbI-wdY_Dm6xIrQP_jHIdGk01Aqs,23
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
@@ -37,13 +37,13 @@ warp_beacon/storage/__init__.py,sha256=2uvyIR0APIW6gOxwJRvCji7wS2q6I7dghvLyWsRqR
37
37
  warp_beacon/storage/mongo.py,sha256=qC4ZiO8XXvPnP0rJwz4CJx42pqFsyAjCiW10W5QdT6E,527
38
38
  warp_beacon/telegram/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
39
39
  warp_beacon/telegram/bot.py,sha256=u3yvXIcqFtVkrf82IXiC4y-UnrEySw49_immBoXIBN4,15725
40
- warp_beacon/telegram/handlers.py,sha256=WUIZ62JuU9g_bTyV_XzboC487wkt_cTm2Z6eVoQj8Wg,7698
40
+ warp_beacon/telegram/handlers.py,sha256=7gldKrX-CTDQNfD1NQ08cC31uPR-95mhN59OujAEqZg,7704
41
41
  warp_beacon/telegram/placeholder_message.py,sha256=wN9-BRiyrtHG-EvXtZkGJHt2CX71munQ57ITttjt0mw,6400
42
- warp_beacon/telegram/utils.py,sha256=U6MnHhUv_eI8aghonyBZjWWv0st-N8G2kw6thxx2g0A,3601
42
+ warp_beacon/telegram/utils.py,sha256=BUUIpsPXCRZ7yBekgQKRoz5u7C1KP_hmLDFRokMlzjk,3653
43
43
  warp_beacon/uploader/__init__.py,sha256=5KRWsxPRGuQ56YhCEnJsXnb-yQp8dpvWEsPDf0dD-fw,4964
44
- warp_beacon-2.3.7.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
45
- warp_beacon-2.3.7.dist-info/METADATA,sha256=-w8ArGjPvsi0eS1MJLjccB6fLNMjxZIR8gZPcbYAt6o,21703
46
- warp_beacon-2.3.7.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
47
- warp_beacon-2.3.7.dist-info/entry_points.txt,sha256=eSB61Rb89d56WY0O-vEIQwkn18J-4CMrJcLA_R_8h3g,119
48
- warp_beacon-2.3.7.dist-info/top_level.txt,sha256=XusFB1mGUStI2gqbtRuJzQrfrAXmdMaT3QTyfvdLEXI,1064
49
- warp_beacon-2.3.7.dist-info/RECORD,,
44
+ warp_beacon-2.3.8.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
45
+ warp_beacon-2.3.8.dist-info/METADATA,sha256=C_Lda9gs9LHNcKXmfbmgnG59IN_FLH_6Hqi2291MgWU,21703
46
+ warp_beacon-2.3.8.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
47
+ warp_beacon-2.3.8.dist-info/entry_points.txt,sha256=eSB61Rb89d56WY0O-vEIQwkn18J-4CMrJcLA_R_8h3g,119
48
+ warp_beacon-2.3.8.dist-info/top_level.txt,sha256=XusFB1mGUStI2gqbtRuJzQrfrAXmdMaT3QTyfvdLEXI,1064
49
+ warp_beacon-2.3.8.dist-info/RECORD,,