leadguru-jobs 0.312.0__py3-none-any.whl → 0.314.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.312.0
3
+ Version: 0.314.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.346.0
24
- Requires-Dist: leadguru-data ==0.353.0
23
+ Requires-Dist: leadguru-common ==0.349.0
24
+ Requires-Dist: leadguru-data ==0.356.0
25
25
  Requires-Dist: wheel
26
26
  Requires-Dist: setuptools
27
27
  Requires-Dist: twine
@@ -8,7 +8,7 @@ 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=-rECA72ptL6V4w49GKwD0fEXVnP21g4sehrL3MX9VGU,4247
11
+ lgt_jobs/jobs/bot_stats_update.py,sha256=3etkgOASWwRQXhKHOvghVw0imf4wVUjeqb_IHTTbHQw,4735
12
12
  lgt_jobs/jobs/chat_history.py,sha256=-kIkTtpNCyuABF31fkPMBaVX_9J3IVK1QK2XR3o-mX8,5965
13
13
  lgt_jobs/jobs/clear_user_analytics.py,sha256=xCq_1TibYJp4Ezq22JPQfQpwCmc2QHJxgTcthxKLHWc,2525
14
14
  lgt_jobs/jobs/conversation_replied.py,sha256=nFEK8afPZ4cnxlU2yxXUAAQW8DiHJ7Du434gPrmQy-4,2870
@@ -24,7 +24,7 @@ lgt_jobs/jobs/workspace_connect.py,sha256=ftqO93W3pAS_UJGPf2nt50L2mTxc3999W6kWKX
24
24
  lgt_jobs/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
25
25
  lgt_jobs/services/web_client.py,sha256=SZogxjM0jyACRqBOP5EJvtqwe44og8B5B6TMWLpYmKM,1878
26
26
  lgt_jobs/templates/new_message_mail_template.html,sha256=82XdDPtmkJVUWUcZtgd8bv_9-viAG2WWOnf3AhR6PeY,3635
27
- leadguru_jobs-0.312.0.dist-info/METADATA,sha256=WJZFIUuwl7saPkP997XkgUrtdMgBSo8HWH3CEyLdt2I,1181
28
- leadguru_jobs-0.312.0.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
29
- leadguru_jobs-0.312.0.dist-info/top_level.txt,sha256=rIuw1DqwbnZyeoarBSC-bYeGOhv9mZBs7_afl9q4_JI,9
30
- leadguru_jobs-0.312.0.dist-info/RECORD,,
27
+ leadguru_jobs-0.314.0.dist-info/METADATA,sha256=obQvq8t0yr_5RbIqMnnDOfTSaeTt0YOWkEkyrAecgd0,1181
28
+ leadguru_jobs-0.314.0.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
29
+ leadguru_jobs-0.314.0.dist-info/top_level.txt,sha256=rIuw1DqwbnZyeoarBSC-bYeGOhv9mZBs7_afl9q4_JI,9
30
+ leadguru_jobs-0.314.0.dist-info/RECORD,,
@@ -1,8 +1,10 @@
1
1
  from abc import ABC
2
2
  from typing import Optional
3
+ from lgt.common.python.discord_client.discord_client import DiscordClient
3
4
  from lgt.common.python.helpers import get_formatted_bot_name
4
5
  from lgt.common.python.slack_client.web_client import SlackWebClient
5
- from lgt_data.model import DedicatedBotModel
6
+ from lgt_data.enums import SourceType
7
+ from lgt_data.model import DedicatedBotModel, ActiveServer, ActiveChannel
6
8
  from lgt_data.mongo_repository import BotMongoRepository, DedicatedBotRepository
7
9
  from pydantic import BaseModel
8
10
  from lgt_data.analytics import get_bots_aggregated_analytics
@@ -33,9 +35,16 @@ class BotStatsUpdateJob(BaseBackgroundJob, ABC):
33
35
  if not bot:
34
36
  return
35
37
 
36
- if not bot.token or not bot.cookies:
37
- log.warning(f"[BotStatsUpdateJob]: Bot {bot.id} has no credentials.")
38
- BotStatsUpdateJob.__updated_invalid_creds_flag(bot, True)
38
+ if bot.source.source_type == SourceType.DISCORD:
39
+ client = DiscordClient(bot.token)
40
+
41
+ bot.active_servers = [ActiveServer.from_dic(server) for server in client.get_servers()]
42
+ for server in bot.active_servers:
43
+ channels = [ActiveChannel.from_dic(channel) for channel in client.get_channels(server.id)]
44
+ server.active_channels = channels
45
+ server.icon = f'https://cdn.discordapp.com/icons/{server.id}/{server.icon}.png'
46
+
47
+ bots_rep.add_or_update(bot)
39
48
  return
40
49
 
41
50
  client = SlackWebClient(bot.token, bot.cookies)