leadguru-jobs 0.164.0__py3-none-any.whl → 0.165.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.
- {leadguru_jobs-0.164.0.dist-info → leadguru_jobs-0.165.0.dist-info}/METADATA +3 -3
- {leadguru_jobs-0.164.0.dist-info → leadguru_jobs-0.165.0.dist-info}/RECORD +7 -7
- lgt_jobs/jobs/bot_stats_update.py +5 -1
- lgt_jobs/jobs/conversation_replied.py +14 -5
- lgt_jobs/jobs/reactions_added.py +14 -6
- {leadguru_jobs-0.164.0.dist-info → leadguru_jobs-0.165.0.dist-info}/WHEEL +0 -0
- {leadguru_jobs-0.164.0.dist-info → leadguru_jobs-0.165.0.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: leadguru-jobs
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.165.0
|
4
4
|
Summary: LGT jobs builds
|
5
5
|
Author-email: developer@leadguru.co
|
6
6
|
Classifier: Development Status :: 5 - Production/Stable
|
@@ -20,6 +20,6 @@ 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.
|
24
|
-
Requires-Dist: leadguru-data (>=0.
|
23
|
+
Requires-Dist: leadguru-common (>=0.266.0)
|
24
|
+
Requires-Dist: leadguru-data (>=0.273.0)
|
25
25
|
|
@@ -9,12 +9,12 @@ lgt_jobs/smtp.py,sha256=MZCz3OOOSrDEbdC2rg7LtC3K-EnveB6T2zHA5PEv34Q,1390
|
|
9
9
|
lgt_jobs/jobs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
10
10
|
lgt_jobs/jobs/analytics.py,sha256=MXqdXvpfOr4MwrLDtHpFiaacYTmlSPzUs7XoW25ke50,1301
|
11
11
|
lgt_jobs/jobs/archive_leads.py,sha256=deMjQXGJj5aiJUIHgIurYNsnL3IF1moEtjWWsX3bHrY,852
|
12
|
-
lgt_jobs/jobs/bot_stats_update.py,sha256=
|
12
|
+
lgt_jobs/jobs/bot_stats_update.py,sha256=btMfZif8WkRZHsfvKs6pKt2OdZjHDQ4wBozJtBaInQQ,2711
|
13
13
|
lgt_jobs/jobs/chat_history.py,sha256=hs0Q34gGn16xTgt3FnbwHVXnLoUl4zd0Nuhw3uqqlU4,5757
|
14
14
|
lgt_jobs/jobs/clear_user_analytics.py,sha256=p4kYsemwPkuzt_QTwmq_BAfb0Zz2siZV7hhPUsjE1HY,2624
|
15
15
|
lgt_jobs/jobs/connected_workspaces.py,sha256=phhwPtjS8sbbH03aDuQJmfX8EUTFiMrLpf9YopSvYm0,7861
|
16
|
-
lgt_jobs/jobs/conversation_replied.py,sha256
|
17
|
-
lgt_jobs/jobs/reactions_added.py,sha256=
|
16
|
+
lgt_jobs/jobs/conversation_replied.py,sha256=wPjAnFlHkCUqsmBn5dX533POvAdovvccUMvviUMvR6w,3082
|
17
|
+
lgt_jobs/jobs/reactions_added.py,sha256=puiwJGf1aKyOLPkZwKSppe-_NC4xvIEI77kjugkFcOU,2647
|
18
18
|
lgt_jobs/jobs/reindex_conversation_history.py,sha256=HzX5isUrjizTbPFab69sUTUqIpqKj-tDSLg9Olr-Z5Y,1087
|
19
19
|
lgt_jobs/jobs/restart_bots.py,sha256=-PMm8rWasZHQE-b4vSUAEwl4u0sxc-qVIVMavsT9PCw,2099
|
20
20
|
lgt_jobs/jobs/restart_dedicated_bots.py,sha256=7j-oVhmL4ViTtCNlaRz6QTr2zaAuauCfQIpCSnfsvzQ,2031
|
@@ -25,7 +25,7 @@ lgt_jobs/jobs/user_feed_update.py,sha256=AQ-x6hkkCuPau8oh2FTVpFksglCH3WEH3CCJPMY
|
|
25
25
|
lgt_jobs/jobs/user_limits_update.py,sha256=lbdqbFulQTB9_oXJfT9QbTRvRn3lTVP-a-p9YI-P2VQ,3405
|
26
26
|
lgt_jobs/templates/bots_service_template.yaml,sha256=FLONZYCMtR-3Oytjxbf7kd5XMerhehuPln9qstFrxEw,417
|
27
27
|
lgt_jobs/templates/new_message_mail_template.html,sha256=gn913h6LSm5kEiqRNrKCtUtVj9WXVU5BrbYGe8vA8fY,3704
|
28
|
-
leadguru_jobs-0.
|
29
|
-
leadguru_jobs-0.
|
30
|
-
leadguru_jobs-0.
|
31
|
-
leadguru_jobs-0.
|
28
|
+
leadguru_jobs-0.165.0.dist-info/METADATA,sha256=YSbLSOjfZlPVlQI7dek4eafq2MH2_EMAMiouDxKyEU4,1008
|
29
|
+
leadguru_jobs-0.165.0.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
|
30
|
+
leadguru_jobs-0.165.0.dist-info/top_level.txt,sha256=rIuw1DqwbnZyeoarBSC-bYeGOhv9mZBs7_afl9q4_JI,9
|
31
|
+
leadguru_jobs-0.165.0.dist-info/RECORD,,
|
@@ -46,13 +46,17 @@ class BotStatsUpdateJob(BaseBackgroundJob, ABC):
|
|
46
46
|
|
47
47
|
connected_channels = 0
|
48
48
|
channels_users = {}
|
49
|
+
active_channels = {}
|
49
50
|
users_count = 0
|
50
51
|
for channel in channels:
|
51
|
-
|
52
|
+
if channel['is_member']:
|
53
|
+
active_channels[channel['id']] = channel['name']
|
54
|
+
connected_channels += 1
|
52
55
|
num_members = channel.get('num_members', 0)
|
53
56
|
channels_users[channel['id']] = num_members
|
54
57
|
users_count += num_members
|
55
58
|
|
59
|
+
bot.active_channels = active_channels
|
56
60
|
bot.messages_received = received_messages.get(bot.name, 0)
|
57
61
|
bot.messages_filtered = filtered_messages.get(bot.name, 0)
|
58
62
|
bot.connected_channels = connected_channels
|
@@ -1,11 +1,12 @@
|
|
1
1
|
from abc import ABC
|
2
|
+
from typing import Optional
|
2
3
|
|
3
4
|
from lgt.common.python.lgt_logging import log
|
4
5
|
from lgt.common.python.slack_client.slack_client import SlackClient
|
5
6
|
from lgt.common.python.slack_client.web_client import get_system_slack_credentials, SlackWebClient
|
6
7
|
from pydantic import BaseModel
|
7
8
|
from lgt_data.mongo_repository import LeadMongoRepository, BotMongoRepository, \
|
8
|
-
UserLeadMongoRepository
|
9
|
+
UserLeadMongoRepository, GarbageLeadsMongoRepository, SpamLeadsMongoRepository
|
9
10
|
from lgt_data.model import SlackReplyModel
|
10
11
|
from ..basejobs import BaseBackgroundJobData, BaseBackgroundJob
|
11
12
|
|
@@ -15,7 +16,8 @@ Update messages conversations
|
|
15
16
|
|
16
17
|
|
17
18
|
class ConversationRepliedJobData(BaseBackgroundJobData, BaseModel):
|
18
|
-
|
19
|
+
channel_id: Optional[str]
|
20
|
+
message_id: Optional[str]
|
19
21
|
ts: str
|
20
22
|
|
21
23
|
|
@@ -26,7 +28,7 @@ class ConversationRepliedJob(BaseBackgroundJob, ABC):
|
|
26
28
|
|
27
29
|
def exec(self, data: ConversationRepliedJobData):
|
28
30
|
bots = BotMongoRepository().get()
|
29
|
-
lead = LeadMongoRepository().
|
31
|
+
lead = LeadMongoRepository().get(timestamp=data.ts, message_id=data.message_id, channel_id=data.channel_id)
|
30
32
|
if not lead:
|
31
33
|
return
|
32
34
|
|
@@ -61,5 +63,12 @@ class ConversationRepliedJob(BaseBackgroundJob, ABC):
|
|
61
63
|
set_dict = {
|
62
64
|
"replies": replies,
|
63
65
|
}
|
64
|
-
|
65
|
-
|
66
|
+
pipeline = {"message.timestamp": data.ts}
|
67
|
+
if data.message_id:
|
68
|
+
pipeline['message.message_id'] = data.message_id
|
69
|
+
if data.channel_id:
|
70
|
+
pipeline['message.channel_id'] = data.channel_id
|
71
|
+
LeadMongoRepository().collection().update_many(pipeline, {"$set": set_dict})
|
72
|
+
UserLeadMongoRepository().collection().update_many(pipeline, {"$set": set_dict})
|
73
|
+
GarbageLeadsMongoRepository().collection().update_many(pipeline, {"$set": set_dict})
|
74
|
+
SpamLeadsMongoRepository().collection().update_many(pipeline, {"$set": set_dict})
|
lgt_jobs/jobs/reactions_added.py
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
from abc import ABC
|
2
|
+
from typing import Optional
|
2
3
|
|
3
4
|
from lgt.common.python.lgt_logging import log
|
4
5
|
from lgt.common.python.slack_client.web_client import SlackWebClient, get_system_slack_credentials
|
5
6
|
from lgt_data.mongo_repository import LeadMongoRepository, BotMongoRepository, \
|
6
|
-
UserLeadMongoRepository
|
7
|
+
UserLeadMongoRepository, GarbageLeadsMongoRepository, SpamLeadsMongoRepository
|
7
8
|
from pydantic import BaseModel
|
8
|
-
|
9
9
|
from ..basejobs import BaseBackgroundJobData, BaseBackgroundJob
|
10
10
|
|
11
11
|
"""
|
@@ -14,7 +14,8 @@ Update messages reactions
|
|
14
14
|
|
15
15
|
|
16
16
|
class ReactionAddedJobData(BaseBackgroundJobData, BaseModel):
|
17
|
-
|
17
|
+
channel_id: Optional[str]
|
18
|
+
message_id: Optional[str]
|
18
19
|
ts: str
|
19
20
|
|
20
21
|
|
@@ -27,7 +28,7 @@ class ReactionAddedJob(BaseBackgroundJob, ABC):
|
|
27
28
|
bots = BotMongoRepository().get()
|
28
29
|
like_name = '+1'
|
29
30
|
|
30
|
-
lead = LeadMongoRepository().
|
31
|
+
lead = LeadMongoRepository().get(timestamp=data.ts, message_id=data.message_id, channel_id=data.channel_id)
|
31
32
|
if not lead:
|
32
33
|
return
|
33
34
|
|
@@ -60,5 +61,12 @@ class ReactionAddedJob(BaseBackgroundJob, ABC):
|
|
60
61
|
"likes": lead.likes,
|
61
62
|
"reactions": lead.reactions
|
62
63
|
}
|
63
|
-
|
64
|
-
|
64
|
+
pipeline = {"message.timestamp": data.ts}
|
65
|
+
if data.message_id:
|
66
|
+
pipeline['message.message_id'] = data.message_id
|
67
|
+
if data.channel_id:
|
68
|
+
pipeline['message.channel_id'] = data.channel_id
|
69
|
+
LeadMongoRepository().collection().update_many(pipeline, {"$set": _set})
|
70
|
+
UserLeadMongoRepository().collection().update_many(pipeline, {"$set": _set})
|
71
|
+
GarbageLeadsMongoRepository().collection().update_many(pipeline, {"$set": _set})
|
72
|
+
SpamLeadsMongoRepository().collection().update_many(pipeline, {"$set": _set})
|
File without changes
|
File without changes
|