leadguru-jobs 0.376.0__py3-none-any.whl → 0.378.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,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: leadguru-jobs
3
- Version: 0.376.0
3
+ Version: 0.378.0
4
4
  Summary: LGT jobs builds
5
5
  Author-email: developer@leadguru.co
6
6
  Classifier: Development Status :: 5 - Production/Stable
@@ -20,8 +20,8 @@ Classifier: Topic :: Internet
20
20
  Requires-Dist: loguru
21
21
  Requires-Dist: pydantic
22
22
  Requires-Dist: cachetools >=3.1.0
23
- Requires-Dist: leadguru-common ==0.379.0
24
- Requires-Dist: leadguru-data ==0.386.0
23
+ Requires-Dist: leadguru-common ==0.383.0
24
+ Requires-Dist: leadguru-data ==0.390.0
25
25
  Requires-Dist: wheel
26
26
  Requires-Dist: setuptools
27
27
  Requires-Dist: twine
@@ -8,19 +8,19 @@ lgt_jobs/smtp.py,sha256=W9OIkckBORAWEsNgIG3nVKs6OTU6esZNnq09WDsj8Lc,1352
8
8
  lgt_jobs/jobs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  lgt_jobs/jobs/analytics.py,sha256=uL3_0xpS37VRJihTW1KiM_yhGGt1XV2yUNId_y-ISLk,972
10
10
  lgt_jobs/jobs/archive_leads.py,sha256=wZ4LwbuC9G7NB16AO15YiMemEV40LoJVjd8VRqaFv9o,831
11
- lgt_jobs/jobs/bot_stats_update.py,sha256=AptiDT8-NsTW7WYBSlsTxWYTkm2AVVaVBEFK3sttPNo,6312
11
+ lgt_jobs/jobs/bot_stats_update.py,sha256=5icR5J7uIKmx_kRKDeXQkTK9-_dAK4FraZPtuQ9z97Y,6327
12
12
  lgt_jobs/jobs/chat_history.py,sha256=5_7tat-nqVu8Bub-VqjL1CmV0vXU2OY798bqZOjWfik,4659
13
13
  lgt_jobs/jobs/inbox_leads.py,sha256=1vwV45RU3vHZnlnmLdW6Mo_ZADyjDS1z2gDPb9cggY8,4738
14
- lgt_jobs/jobs/mass_message.py,sha256=guXQjAL78fc6V0qWZr6nVB-vOGaMDs_NU4yq3iCyAjE,2033
15
- lgt_jobs/jobs/send_code.py,sha256=pLzKJhaTvWYPtvOjH02xpZ-h4dMk5hmkcnc5AS8hc9Q,827
16
- lgt_jobs/jobs/send_slack_message.py,sha256=hS1eaHaMX9sMPO-3TeeM1K5xTkedlMBfAUnTtCFR3DU,2686
17
- lgt_jobs/jobs/update_slack_profile.py,sha256=mdZwhvlgc0UCZAcRt2WIa_e2JZVoxHS2PbhaI6RDulI,2901
14
+ lgt_jobs/jobs/mass_message.py,sha256=sRKHYTQ5cwNep7gsuZTSpAEh8Y5d6PJ5lTQ6XxjsVSQ,2028
15
+ lgt_jobs/jobs/send_code.py,sha256=eLvp6KhOBp4DW-p162xojOm62J_Jzs6kfxutWhobE8U,826
16
+ lgt_jobs/jobs/send_slack_message.py,sha256=QiXbd2Ff61gby_IcBdTr9M3ATll3YvBuaKoegGG_Mnc,2672
17
+ lgt_jobs/jobs/update_slack_profile.py,sha256=NIIQRnmrWWYgYz12GWq5on12vaAaXsydQ2QDdeKV7SM,2646
18
18
  lgt_jobs/jobs/user_balance_update.py,sha256=7LkcpKMilxqUcCS1_OW51qQnaXvGBavkj0a-0_-gK2g,2352
19
- lgt_jobs/jobs/workspace_connect.py,sha256=pwyl4_zhJpyPD2pblXFHBmOiS3GOun19-0opuX5qHfg,7053
19
+ lgt_jobs/jobs/workspace_connect.py,sha256=YpLkhnr1cajkCioPojuavLPKPQIRmAKJtT6uoi5IBwM,6973
20
20
  lgt_jobs/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
21
- lgt_jobs/services/web_client.py,sha256=_jEEXtkwC0E1UpzFmlBAS3UHt75ro5QwZpYp4PmDXCI,1944
21
+ lgt_jobs/services/web_client.py,sha256=D3y5KVVBk7mesRnsiByx4tFmNbfTOKOUoIp3VCHuk0I,1983
22
22
  lgt_jobs/templates/new_message_mail_template.html,sha256=82XdDPtmkJVUWUcZtgd8bv_9-viAG2WWOnf3AhR6PeY,3635
23
- leadguru_jobs-0.376.0.dist-info/METADATA,sha256=bbhj7-kXZciqr1hP_ouLeNy7Ti4K7uSqiSx0TxhYy-o,1181
24
- leadguru_jobs-0.376.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
25
- leadguru_jobs-0.376.0.dist-info/top_level.txt,sha256=rIuw1DqwbnZyeoarBSC-bYeGOhv9mZBs7_afl9q4_JI,9
26
- leadguru_jobs-0.376.0.dist-info/RECORD,,
23
+ leadguru_jobs-0.378.0.dist-info/METADATA,sha256=uFBnFPSWmJ6QN9lf0tOs7EbolJcgWTVxZMgbWNQPAWs,1181
24
+ leadguru_jobs-0.378.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
25
+ leadguru_jobs-0.378.0.dist-info/top_level.txt,sha256=rIuw1DqwbnZyeoarBSC-bYeGOhv9mZBs7_afl9q4_JI,9
26
+ leadguru_jobs-0.378.0.dist-info/RECORD,,
@@ -121,7 +121,6 @@ class BotStatsUpdateJob(BaseBackgroundJob, ABC):
121
121
  bot.connected_channels = connected_channels
122
122
  bot.channels = len(channels)
123
123
  bot.channels_users = channels_users
124
- bot.users_count = users_count
125
124
  if bot.recent_messages is None:
126
125
  bot.recent_messages = []
127
126
  if bot.servers:
@@ -131,6 +130,7 @@ class BotStatsUpdateJob(BaseBackgroundJob, ABC):
131
130
  if slack_channel:
132
131
  slack_channel.active = channel.active
133
132
  bot.servers[0].channels = channels
133
+ bot.servers[0].subscribers = users_count
134
134
 
135
135
  # save only last 50 messages
136
136
  bot.recent_messages = bot.recent_messages[-50:]
@@ -6,7 +6,6 @@ from lgt.common.python.slack_client.web_client import SlackWebClient
6
6
  from lgt_data.mongo_repository import DedicatedBotRepository
7
7
  from loguru import logger as log
8
8
  from pydantic import BaseModel
9
-
10
9
  from ..basejobs import BaseBackgroundJobData, BaseBackgroundJob
11
10
 
12
11
  """
@@ -28,8 +27,8 @@ class SendMassMessageSlackChannelJob(BaseBackgroundJob, ABC):
28
27
  return SendMassMessageSlackChannelJobData
29
28
 
30
29
  def exec(self, data: SendMassMessageSlackChannelJobData):
31
- bot = DedicatedBotRepository().get_by_user_and_source_id(data.user_id, data.source_id)
32
- if not bot or bot.invalid_creds:
30
+ bot = DedicatedBotRepository().get_one(user_id=data.user_id, source_id=data.source_id, only_valid=True)
31
+ if not bot:
33
32
  log.warning(f"[SendMassMessageSlackChannelJob]: "
34
33
  f"Bot not found or has invalid creds, source id:{data.source_id}")
35
34
  return
@@ -3,7 +3,6 @@ from typing import Optional
3
3
  from loguru import logger as log
4
4
  from lgt.common.python.slack_client.web_client import SlackWebClient
5
5
  from pydantic import BaseModel
6
-
7
6
  from ..basejobs import BaseBackgroundJobData, BaseBackgroundJob
8
7
 
9
8
  """
@@ -32,8 +32,8 @@ class SendSlackMessageJob(BaseBackgroundJob, ABC):
32
32
  if not lead:
33
33
  return
34
34
 
35
- bot = DedicatedBotRepository().get_by_user_and_source_id(user.id, lead.message.source.source_id)
36
- if not bot or bot.invalid_creds:
35
+ bot = DedicatedBotRepository().get_one(user_id=data.user_id, source_id=data.source_id, only_valid=True)
36
+ if not bot:
37
37
  return
38
38
 
39
39
  slack_client = SlackWebClient(bot.token, bot.cookies)
@@ -1,5 +1,4 @@
1
1
  from abc import ABC
2
- from lgt.common.python.lgt_logging import log
3
2
  from lgt.common.python.slack_client.slack_client import SlackClient
4
3
  from lgt_data.model import UserModel
5
4
  from lgt_data.mongo_repository import UserMongoRepository, DedicatedBotRepository
@@ -23,14 +22,8 @@ class UpdateUserSlackProfileJob(BaseBackgroundJob, ABC):
23
22
 
24
23
  def exec(self, data: UpdateUserSlackProfileJobData):
25
24
  user = UserMongoRepository().get(data.user_id)
26
- bots = DedicatedBotRepository().get_user_bots(data.user_id)
25
+ bots = DedicatedBotRepository().get_all(user_id=data.user_id, only_valid=True, include_deleted=False)
27
26
  for bot in bots:
28
- if bot.invalid_creds:
29
- log.warning(
30
- f'User: {user.email} dedicated bot: {bot.source.source_id} credentials are invalid. '
31
- f'Not able to update user profile')
32
- continue
33
-
34
27
  slack = SlackClient(bot.token, bot.cookies)
35
28
  UpdateUserSlackProfileJob.__update_profile(user, slack)
36
29
 
@@ -106,8 +106,7 @@ class ConnectSlackAccountJob(BaseBackgroundJob, ABC):
106
106
 
107
107
  dedicated_bots_repository = DedicatedBotRepository()
108
108
  dedicated_bots = dedicated_bots_repository.get_all(user_id=current_user.id, user_name=data.slack_email,
109
- source_type=SourceType.SLACK, include_deleted=True,
110
- include_paused=True)
109
+ source_type=SourceType.SLACK, include_deleted=True)
111
110
  user_workspaces_map: Dict[str, UserWorkspace] = {workspace.id: workspace
112
111
  for workspace in user_workspaces if workspace.token}
113
112
  for workspace_id, workspace in user_workspaces_map.items():
@@ -17,7 +17,8 @@ class V3ServerClient(BaseHttpClient):
17
17
  def __init__(self):
18
18
  self.token = BillingServerClient.login(service_account_email, service_account_password)
19
19
 
20
- def update_user_lead(self, message_id: str, email: str, slack_channel: str, board_id: str, status: str) -> dict:
20
+ def update_user_lead(self, message_id: str, email: str, slack_channel: str,
21
+ board_id: str = None, status: str = None) -> dict:
21
22
  payload = {
22
23
  'message_id': message_id,
23
24
  'user_email': email