aa-structures 2.11.0__py3-none-any.whl → 2.13.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: aa-structures
3
- Version: 2.11.0
3
+ Version: 2.13.0
4
4
  Summary: App for managing Eve Online structures with Alliance Auth.
5
5
  Author-email: Erik Kalkoken <kalkoken87@gmail.com>
6
6
  Requires-Python: >=3.8
@@ -1,4 +1,4 @@
1
- structures/__init__.py,sha256=73A8QmbMlzuQCd4B1PJ0x0-1eGmBUMeyKhZGFG2Oafk,204
1
+ structures/__init__.py,sha256=sxMrwmEo1GeZidz442fY62l0Ke7WzyBdTC6IneBHO3U,204
2
2
  structures/admin.py,sha256=TYWGPou4s-mgspoGaZSiZu2nxBeNzidL_DcJTv7JGJI,40068
3
3
  structures/app_settings.py,sha256=7I_6VC7YecCxnSgtyNQa9h1Zdwb11qJhrNaBLgyA5m0,6527
4
4
  structures/apps.py,sha256=MNZH9l3qWCwuS7OGiKGkBVrDzKoOFlqwDdEgyEFzxVA,195
@@ -6,13 +6,13 @@ structures/auth_hooks.py,sha256=nRbrixFkAE5gphDokB1E8xhH8FY2VtXVwu0XMmSGBAw,1013
6
6
  structures/constants.py,sha256=R7sC5esaWJayJpTDbug7dTKxkkXDKXQ-U6M9Qb0GH5s,967
7
7
  structures/forms.py,sha256=kXs-SGIIj-D9xtFCILKe_PMRU4eHl3-HLNWRhaZKmnQ,391
8
8
  structures/helpers.py,sha256=_dw7j7yobpcV70VwWxoQiptk69b3ksvaDlRQKHg8Kmg,2344
9
- structures/managers.py,sha256=5hejDjWN3ZPZqvSGNf9HXtbtpWX9d75Ygc9FXrO0Np4,19638
9
+ structures/managers.py,sha256=ihqcYgsQkDpCejho5l8pthRbJSNhCuWq6UaijPZVG6o,19793
10
10
  structures/providers.py,sha256=9QYHd8X5HwBhrbgbX3LUrXXV1KGM3hFhcxK6qIJjJtg,317
11
11
  structures/tasks.py,sha256=INZ3soMYHYfxrQsyTO-ozoxbVX6lpMnF3AUo8ybWIoA,9083
12
12
  structures/urls.py,sha256=An5v27AD_NXMNL66cMVtQNci1C_Aqry32rrvDkMpgYo,1467
13
13
  structures/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
14
  structures/core/notification_timers.py,sha256=G-QwpqP9HFv_Y7KsID9bLF-GluEJ1-duSJQN-zqJtM0,14977
15
- structures/core/notification_types.py,sha256=0SExh-VuImRz05jatnCu9lAfIFORUZ-kon9rjF4SXfI,12279
15
+ structures/core/notification_types.py,sha256=v4hDwgJFqEEXJl9dDxCwTVmQo5yA_Ixjxs_BQEcwNDE,13224
16
16
  structures/core/serializers.py,sha256=4W6kA7mhVvc-1OSiTl_w0rSio_HUsjIBm9qbkEr9vCY,20965
17
17
  structures/core/sovereignty.py,sha256=XKgjAFO4BfLpEEUz_hBr2DVDnvWBq9sL9EEQiT4T0n0,730
18
18
  structures/core/starbases.py,sha256=nw7skHYATrnAV-zuPAuxmhM5E4Aqjc_DHSU2TYWgBng,1757
@@ -20,12 +20,13 @@ structures/core/notification_embeds/__init__.py,sha256=30cpjKLZ5_OFtXDACDcjvWQAY
20
20
  structures/core/notification_embeds/billing_embeds.py,sha256=d9XkTyYH7U3UDZaqXu0WoN0wvlrT2S68Rfn2jEpVtM4,5164
21
21
  structures/core/notification_embeds/corporate_embeds.py,sha256=mfm6dDrgzupyRZ9TZGXML-UGoY_PymNj9LuR8EthdDA,6098
22
22
  structures/core/notification_embeds/helpers.py,sha256=0SlrLLFyV0IrdOYfIOLQs0xZgzK8bO7Iroqh7dZnm98,2974
23
- structures/core/notification_embeds/main.py,sha256=N-l9PJYxgsBvcPOG1WQ2OgxC6hCAQnxgx2V1gWUsSMc,15233
23
+ structures/core/notification_embeds/main.py,sha256=B8OReupxjSbtxqw2MXC9qN41A4Bw8x6_n0LIZlfIJxE,17311
24
24
  structures/core/notification_embeds/moonmining_embeds.py,sha256=5OJtfwoLE18mB62iwyHTcMo9eOPBC2vQFSjQlDnTcTY,7130
25
- structures/core/notification_embeds/orbital_embeds.py,sha256=ovAnTqrc2X0s-HhQS-UleI8J5-gJEO361HYJzcoAdeQ,2864
25
+ structures/core/notification_embeds/orbital_embeds.py,sha256=abU9eN7-4FV2wm6IbZt5O0hQZ09hdrkSJ4JaKLBksTE,2864
26
+ structures/core/notification_embeds/skyhook_embeds.py,sha256=Wl7G3jYin8IfSPFWfoBHndtvxiOUTIboD9xfJ1VJd_4,3019
26
27
  structures/core/notification_embeds/sov_embeds.py,sha256=_r4U5zN3MfEag9FCeN0my2d4qfMBUwYUGWW-oGftjn8,8901
27
- structures/core/notification_embeds/structures_embeds.py,sha256=YOLCnfxIaui7C8HXbWh3grq3eC6TwmdwC4h5ACd05U4,13236
28
- structures/core/notification_embeds/tower_embeds.py,sha256=n76URsS5xUOCXSYQMNzXeNk_msV08-0eNokeku1TDNs,5848
28
+ structures/core/notification_embeds/structures_embeds.py,sha256=o4tWS2TACW70PTNtJt3FJNt2WGGUKy6n1890PMJfHzc,13683
29
+ structures/core/notification_embeds/tower_embeds.py,sha256=Gowxiy5G655CPSJ76Jovpw2jZQYDCUXMB-jxanyiFHE,5848
29
30
  structures/core/notification_embeds/war_embeds.py,sha256=Wj5SuTP1jGRug8_x7qy8oyRCv9CjlZON7-RpJ2k57I4,18333
30
31
  structures/locale/django.pot,sha256=t4voMGKIXRUW7sYx7Rmut2tVyBtg2rUcIB5BK_POWTM,68368
31
32
  structures/locale/de/LC_MESSAGES/django.mo,sha256=Ok2o1b-v0o7uGfARfS6dmXLGMUHRjEp9nEjf0IJEYvM,3997
@@ -58,10 +59,12 @@ structures/migrations/0003_add_localization_and_unique_key.py,sha256=ZxJMfUtgUH2
58
59
  structures/migrations/0004_improve_localization.py,sha256=R29j2Ki9I_yOvEQTxEu_zMnZrR7JkSGpmvMTpp9XjqM,14014
59
60
  structures/migrations/0005_add_notification_types.py,sha256=aIgNZN4Gsvh9GiJ0i4XmXopT0qqjZTQrdVjZaVIJKP8,7087
60
61
  structures/migrations/0006_add_ownercharacter_disabled.py,sha256=yfcuwWHdSoF7HTEzdtQ1bGhI-K78SxCeE3g3z6UjbqI,726
62
+ structures/migrations/0007_add_notificationtypes_skyhook_metenox.py,sha256=5qxb2AyZyyHFAU39ScFW4eCHHWBL9lMszt0MzXJu4RM,7835
63
+ structures/migrations/0008_add_notificationtypes_skyhook_metenox.py,sha256=5QtcYJR7krqKheJ-vBb7QT771mK39aET7F07hhMy9q4,7844
61
64
  structures/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
62
65
  structures/models/__init__.py,sha256=Da0-Z4BtsZ_mlnI6XtyvoE0UtTuOA0psGCuVhVPVKrM,916
63
66
  structures/models/eveuniverse.py,sha256=vTIfzZL9guEDuZHQvRdG6pI4zSEdMqfVE-2SkHdqbRo,2213
64
- structures/models/notifications.py,sha256=tznJo2prNjhk9C7S4cDrQxftIvuLcidB6vSkvFfb4mw,35146
67
+ structures/models/notifications.py,sha256=HwQc-ChdP0ULuJgxUym9_CBsCWCmcHT7whlk9tB2vzw,35364
65
68
  structures/models/owners.py,sha256=8VDRL1fPep0TN6Nv5MJg1NC6_2V6bMJd6f-eda4-PJg,55697
66
69
  structures/models/structures_1.py,sha256=e1sI-2zMSKcPi2PyYA--fcc8rn-yQwODzlUHKjeWgLI,29778
67
70
  structures/models/structures_2.py,sha256=g5Pct5jNmZC-n7fnpLs5UyiP9JLrGdI1vjYucHTV_wQ,10371
@@ -164,14 +167,14 @@ structures/tests/test_managers_2.py,sha256=FISr_NT1Qnu9j1JYYTceNsUk8k9rfCTKwjKi5
164
167
  structures/tests/test_tasks.py,sha256=reL1rPv_kvTgsC4lq5SXulkbEHaJrw5B1-hFI4tiDWY,17269
165
168
  structures/tests/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
166
169
  structures/tests/core/test_notification_structuretimers.py,sha256=OvldjgIHmRVsqoC9C6VJRqwS9WeRFMgpyutRc69PjAU,10857
167
- structures/tests/core/test_notification_types.py,sha256=WNJGXoxO3LbgxPgCH416IJElREWFBtwx5pw8IulsmYo,9881
170
+ structures/tests/core/test_notification_types.py,sha256=2J5A8Dr9UHhzLEj6QTMty5iZXlNkQxtFmLvU8Wpdno4,10447
168
171
  structures/tests/core/test_notifications_timerboard.py,sha256=OMkAWH_jWXzCwotp6W2qWG6GpSGisyunZYOoy1UZomU,5583
169
172
  structures/tests/core/test_serializers.py,sha256=ACs6x1IhesoJBFG76RmlglDWqaMlOuqq5kPyzvjGeKI,7056
170
173
  structures/tests/core/test_sovereignty.py,sha256=SGgNw6NxmaU3jV-EDhKJRLfHnRnqDCwm4oCoO-8gt9w,821
171
174
  structures/tests/core/test_starbases.py,sha256=Q3EZVIKZGzxUUvvn0TvZYOL9YQ-baiTRTT83xWqTAhQ,3186
172
175
  structures/tests/core/notification_embeds/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
173
176
  structures/tests/core/notification_embeds/test_helpers.py,sha256=HG20TC8Bz7NqpaQWo6uvrsxfNIwTL2Zi_NRkh3UyN2Y,1776
174
- structures/tests/core/notification_embeds/test_main.py,sha256=vTDByjxxVCA6KMcr5XH4f4QsMgcDI_YDd-fjZfHztng,13808
177
+ structures/tests/core/notification_embeds/test_main.py,sha256=rSUm8dGsddjnX_OUwtCh-wd5UhJ6ttTsfxc1soAoDv8,14667
175
178
  structures/tests/integration/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
176
179
  structures/tests/integration/test_tasks.py,sha256=s6hL5UBotDmhLq7NUiOad72W-S_18u_yAHiLWVryVi8,23617
177
180
  structures/tests/integration/test_views.py,sha256=SkbIposTUjo0nujHL4WEaZO7nY1Bfuvm805H39XUv-g,4361
@@ -180,7 +183,7 @@ structures/tests/models/test_eveuniverse.py,sha256=bQ1upOLfoivfaa9KCrzjWvSH_EvL2
180
183
  structures/tests/models/test_notifications_1.py,sha256=xVX4an54sZM8WLUdsAGUG2Nb4Rl7W5FBzhI0hBhJo5g,30300
181
184
  structures/tests/models/test_notifications_2.py,sha256=wBoB6lHMK4yrd63DSkZ570yXW6coevDtI0pl1ttgB1o,31989
182
185
  structures/tests/models/test_notifications_3.py,sha256=u11s0k9EmtFgL3kyb4zDyLVliQLOps701ZgEA2T2i0Y,7257
183
- structures/tests/models/test_notifications_discord.py,sha256=9_42lcrb2lUUMRqgdRJAub9cJ4QZI71OyoORwK0LEvg,5551
186
+ structures/tests/models/test_notifications_discord.py,sha256=6maDXjl2C5yH2XRgsvMtb3P-tfOdZLQDaksffiqS8OM,6312
184
187
  structures/tests/models/test_owners_1.py,sha256=o8AJasQ0-Pdb0FRFZcmNcMGjaIk8fH3OZIZw4paJiDw,24433
185
188
  structures/tests/models/test_owners_2.py,sha256=gkTXpSibPWs1XfZtPvyeEvVebyYZcKERD9GQSYSClYk,21911
186
189
  structures/tests/models/test_owners_3.py,sha256=cpDkfFkVvC1v4uuXha1vGUmWZ163huYTUDuZyed9Rdc,16947
@@ -189,12 +192,12 @@ structures/tests/models/test_owners_5.py,sha256=lTSfVY3rPOLyF-IhlKPT4mbRqvuN_NA-
189
192
  structures/tests/models/test_owners_6.py,sha256=R9UE2QGwiGTWLHzzOZwGQPWJrAPwIIl7UwrHH-ki4Ak,940
190
193
  structures/tests/models/test_structures.py,sha256=6HktwBOsmRtRq5MnRlZnvNixUsWUpRni_XnPjNpMN0Y,41469
191
194
  structures/tests/testdata/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
192
- structures/tests/testdata/create_eveuniverse.py,sha256=E-Fh-dmuHmLZcqgK2U6mwt9W6dI7H99bG7DaETfcVQY,2129
193
- structures/tests/testdata/entities.json,sha256=kmcmmbHG_igHwvkpAJGHQEztEXjlo8McDuojpEBmgqU,32147
195
+ structures/tests/testdata/create_eveuniverse.py,sha256=6CYgXtJaEwxWvQFyH-P0SKsRqeMuSyJ92ZJiXe_-nuY,2256
196
+ structures/tests/testdata/entities.json,sha256=vmb0uhwTpD0gycGAakgYidr3qSbnHiMubAd4u7T2l70,36053
194
197
  structures/tests/testdata/esi_data.json,sha256=DX47oSlRZIPxlPueMfiNElbZbAip2cp3LAUmv8GAPJ0,13864
195
- structures/tests/testdata/eveuniverse.json,sha256=Z8_EXOF8XNvls9RfBYIHhoNX0rj0NqcjInTU6tZuwhI,993284
198
+ structures/tests/testdata/eveuniverse.json,sha256=3fhD72lUNLj96wO4ASbpNcdH_8VbqcXUvKUXR6j0768,1028885
196
199
  structures/tests/testdata/factories.py,sha256=KNXxOad44DKD0luQ7QS0DepnCr1S_Z6qwfiXnNDy10I,24774
197
- structures/tests/testdata/generate_notifications.py,sha256=nE077mVHVmOVudKIGMtHUfBIcV5Ch5Z0IngD1gp5yQk,5746
200
+ structures/tests/testdata/generate_notifications.py,sha256=lhcnbsnE4O6g0OFUAYO2sCfu8vmwBcFtxn-TuTLtFnM,5417
198
201
  structures/tests/testdata/generate_notifications_2.py,sha256=mdoGXd9vgy_opmrwTr9MfGe-QieHV4BHtRA7VFzxFKM,1413
199
202
  structures/tests/testdata/generate_structures.py,sha256=4p2ypDj-goniBnraTP2KfWzEX3YLj0qhKPNTfCXy05g,9134
200
203
  structures/tests/testdata/helpers.py,sha256=nUecEhe9NqP70zMo8gbAZaWIm2NvzvnF4w9doMtFPY8,6183
@@ -220,7 +223,7 @@ structures/webhooks/models.py,sha256=kUkt9rnRQIJIrU9Bjcs34rvkb-TMbUubHdn-kny08kI
220
223
  structures/webhooks/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
221
224
  structures/webhooks/tests/test_core.py,sha256=4NcEAQgK2KhQkFOxYh2ad0S-qUWh1DNGDmLo5Mo5opI,6762
222
225
  structures/webhooks/tests/test_utils.py,sha256=ekADFv0JOEtXeqdiejbeqrABO__Q1flJHzVieQ7L9e0,459
223
- aa_structures-2.11.0.dist-info/LICENSE,sha256=XZiwB_S_40_HhnvLg5xvtBb3g1oGjPrk0rpFwk8iInE,1070
224
- aa_structures-2.11.0.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
225
- aa_structures-2.11.0.dist-info/METADATA,sha256=yuYKAElX7wpn9YDI8qwLn20gb_Vksa5A7mnjsnN5dBg,5972
226
- aa_structures-2.11.0.dist-info/RECORD,,
226
+ aa_structures-2.13.0.dist-info/LICENSE,sha256=XZiwB_S_40_HhnvLg5xvtBb3g1oGjPrk0rpFwk8iInE,1070
227
+ aa_structures-2.13.0.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
228
+ aa_structures-2.13.0.dist-info/METADATA,sha256=nwtm73-vPjR46RQ_UZOVDX0UmhhEou7uOa_2MuQ0A58,5972
229
+ aa_structures-2.13.0.dist-info/RECORD,,
structures/__init__.py CHANGED
@@ -3,5 +3,5 @@
3
3
  # pylint: disable = invalid-name
4
4
  default_app_config = "structures.apps.StructuresConfig"
5
5
 
6
- __version__ = "2.11.0"
6
+ __version__ = "2.13.0"
7
7
  __title__ = "Structures"
@@ -10,6 +10,8 @@ import dhooks_lite
10
10
  from django.conf import settings
11
11
  from django.utils.translation import gettext as _
12
12
 
13
+ from allianceauth.services.hooks import get_extension_logger
14
+ from app_utils.logging import LoggerAddTag
13
15
  from app_utils.urls import reverse_absolute, static_file_absolute_url
14
16
 
15
17
  from structures import __title__
@@ -17,7 +19,9 @@ from structures.core.notification_types import NotificationType
17
19
  from structures.helpers import get_or_create_eve_entity, is_absolute_url
18
20
  from structures.models.notifications import Notification, NotificationBase, Webhook
19
21
 
20
- from .helpers import target_datetime_formatted
22
+ from .helpers import gen_alliance_link, gen_corporation_link, target_datetime_formatted
23
+
24
+ logger = LoggerAddTag(get_extension_logger(__name__), __title__)
21
25
 
22
26
 
23
27
  class NotificationBaseEmbed:
@@ -73,9 +77,9 @@ class NotificationBaseEmbed:
73
77
  damage_text = " | ".join(damage_parts)
74
78
  return damage_text
75
79
 
76
- def get_aggressor_link(self) -> str:
80
+ def gen_aggressor_link(self) -> str:
77
81
  """Returns the aggressor link from a parsed_text for POS and POCOs only."""
78
- if self._data.get("aggressorAllianceID"):
82
+ if key := self._data.get("aggressorAllianceID"):
79
83
  key = "aggressorAllianceID"
80
84
  elif self._data.get("aggressorCorpID"):
81
85
  key = "aggressorCorpID"
@@ -86,6 +90,16 @@ class NotificationBaseEmbed:
86
90
  entity = get_or_create_eve_entity(id=self._data[key])
87
91
  return Webhook.create_link(entity.name, entity.profile_url)
88
92
 
93
+ def gen_attacker_link(self) -> str:
94
+ """Returns the attacker link from a parsed_text for Upwell structures only."""
95
+ if name := self._data.get("allianceName"):
96
+ return gen_alliance_link(name)
97
+
98
+ if name := self._data.get("corpName"):
99
+ return gen_corporation_link(name)
100
+
101
+ return _("(unknown)")
102
+
89
103
  def fuel_expires_target_date(self) -> str:
90
104
  """Return calculated target date when fuel expires. Returns '?' when no data."""
91
105
  if self._structure and self._structure.fuel_expires_at:
@@ -141,6 +155,20 @@ class NotificationBaseEmbed:
141
155
  footer_text += f" #{my_text}"
142
156
  footer_icon_url = footer_icon_url if is_absolute_url(footer_icon_url) else None
143
157
  footer = dhooks_lite.Footer(text=footer_text, icon_url=footer_icon_url)
158
+ max_description = dhooks_lite.Embed.MAX_DESCRIPTION
159
+ if self._description and len(self._description) > max_description:
160
+ logger.warning(
161
+ "%s: Description of notification is too long: %s",
162
+ self,
163
+ self._description,
164
+ )
165
+ self._description = self._description[:max_description]
166
+ max_title = dhooks_lite.Embed.MAX_TITLE
167
+ if self._title and len(self._title) > max_title:
168
+ logger.warning(
169
+ "%s: Title of notification is too long: %s", self, self._title
170
+ )
171
+ self._title = self._title[:max_title]
144
172
  return dhooks_lite.Embed(
145
173
  author=author,
146
174
  color=self._color,
@@ -182,6 +210,13 @@ class NotificationBaseEmbed:
182
210
  NotificationOrbitalAttacked,
183
211
  NotificationOrbitalReinforced,
184
212
  )
213
+ from .skyhook_embeds import (
214
+ NotificationSkyhookDeployed,
215
+ NotificationSkyhookDestroyed,
216
+ NotificationSkyhookLostShield,
217
+ NotificationSkyhookOnline,
218
+ NotificationSkyhookUnderAttack,
219
+ )
185
220
  from .sov_embeds import (
186
221
  NotificationSovAllAnchoringMsg,
187
222
  NotificationSovAllClaimAcquiredMsg,
@@ -198,6 +233,8 @@ class NotificationBaseEmbed:
198
233
  NotificationStructureJumpFuelAlert,
199
234
  NotificationStructureLostArmor,
200
235
  NotificationStructureLostShield,
236
+ NotificationStructureLowReagentsAlert,
237
+ NotificationStructureNoReagentsAlert,
201
238
  NotificationStructureOnline,
202
239
  NotificationStructureOwnershipTransferred,
203
240
  NotificationStructureRefueledExtra,
@@ -242,76 +279,84 @@ class NotificationBaseEmbed:
242
279
  NT = NotificationType
243
280
  notif_type_2_class = {
244
281
  # Billing
245
- NT.BILLING_CORP_ALL_BILL_MSG: NotificationCorpAllBillMsg,
246
282
  NT.BILLING_BILL_OUT_OF_MONEY_MSG: NotificationBillingBillOutOfMoneyMsg,
283
+ NT.BILLING_CORP_ALL_BILL_MSG: NotificationCorpAllBillMsg,
247
284
  NT.BILLING_I_HUB_BILL_ABOUT_TO_EXPIRE: NotificationBillingIHubBillAboutToExpire,
248
285
  NT.BILLING_I_HUB_DESTROYED_BY_BILL_FAILURE: NotificationBillingIHubDestroyedByBillFailure,
249
286
  # character
250
- NT.CORP_APP_NEW_MSG: NotificationCorpAppNewMsg,
287
+ NT.CHAR_APP_ACCEPT_MSG: NotificationCharAppAcceptMsg,
288
+ NT.CHAR_APP_WITHDRAW_MSG: NotificationCharAppWithdrawMsg,
289
+ NT.CHAR_LEFT_CORP_MSG: NotificationCharLeftCorpMsg,
251
290
  NT.CORP_APP_INVITED_MSG: NotificationCorpAppInvitedMsg,
291
+ NT.CORP_APP_NEW_MSG: NotificationCorpAppNewMsg,
252
292
  NT.CORP_APP_REJECT_CUSTOM_MSG: NotificationCorpAppRejectCustomMsg,
253
293
  NT.CORP_APP_REJECT_MSG: NotificationCharAppRejectMsg,
254
- NT.CHAR_APP_WITHDRAW_MSG: NotificationCharAppWithdrawMsg,
255
- NT.CHAR_APP_ACCEPT_MSG: NotificationCharAppAcceptMsg,
256
- NT.CHAR_LEFT_CORP_MSG: NotificationCharLeftCorpMsg,
257
294
  # moonmining
258
- NT.MOONMINING_EXTRACTION_STARTED: NotificationMoonminningExtractionStarted,
259
- NT.MOONMINING_EXTRACTION_FINISHED: NotificationMoonminningExtractionFinished,
260
295
  NT.MOONMINING_AUTOMATIC_FRACTURE: NotificationMoonminningAutomaticFracture,
261
296
  NT.MOONMINING_EXTRACTION_CANCELLED: NotificationMoonminningExtractionCanceled,
297
+ NT.MOONMINING_EXTRACTION_FINISHED: NotificationMoonminningExtractionFinished,
298
+ NT.MOONMINING_EXTRACTION_STARTED: NotificationMoonminningExtractionStarted,
262
299
  NT.MOONMINING_LASER_FIRED: NotificationMoonminningLaserFired,
263
300
  # Orbitals
264
301
  NT.ORBITAL_ATTACKED: NotificationOrbitalAttacked,
265
302
  NT.ORBITAL_REINFORCED: NotificationOrbitalReinforced,
266
303
  # Sov
267
- NT.SOV_ENTOSIS_CAPTURE_STARTED: NotificationSovEntosisCaptureStarted,
268
- NT.SOV_COMMAND_NODE_EVENT_STARTED: NotificationSovCommandNodeEventStarted,
304
+ NT.SOV_ALL_ANCHORING_MSG: NotificationSovAllAnchoringMsg,
269
305
  NT.SOV_ALL_CLAIM_ACQUIRED_MSG: NotificationSovAllClaimAcquiredMsg,
270
306
  NT.SOV_ALL_CLAIM_LOST_MSG: NotificationSovAllClaimLostMsg,
271
- NT.SOV_STRUCTURE_REINFORCED: NotificationSovStructureReinforced,
307
+ NT.SOV_COMMAND_NODE_EVENT_STARTED: NotificationSovCommandNodeEventStarted,
308
+ NT.SOV_ENTOSIS_CAPTURE_STARTED: NotificationSovEntosisCaptureStarted,
272
309
  NT.SOV_STRUCTURE_DESTROYED: NotificationSovStructureDestroyed,
273
- NT.SOV_ALL_ANCHORING_MSG: NotificationSovAllAnchoringMsg,
310
+ NT.SOV_STRUCTURE_REINFORCED: NotificationSovStructureReinforced,
274
311
  # Towers
275
312
  NT.TOWER_ALERT_MSG: NotificationTowerAlertMsg,
276
- NT.TOWER_RESOURCE_ALERT_MSG: NotificationTowerResourceAlertMsg,
277
313
  NT.TOWER_REFUELED_EXTRA: NotificationTowerRefueledExtra,
278
314
  NT.TOWER_REINFORCED_EXTRA: NotificationTowerReinforcedExtra,
315
+ NT.TOWER_RESOURCE_ALERT_MSG: NotificationTowerResourceAlertMsg,
316
+ # Skyhooks
317
+ NT.SKYHOOK_DEPLOYED: NotificationSkyhookDeployed,
318
+ NT.SKYHOOK_DESTROYED: NotificationSkyhookDestroyed,
319
+ NT.SKYHOOK_LOST_SHIELDS: NotificationSkyhookLostShield,
320
+ NT.SKYHOOK_ONLINE: NotificationSkyhookOnline,
321
+ NT.SKYHOOK_UNDER_ATTACK: NotificationSkyhookUnderAttack,
279
322
  # Upwell structures
280
- NT.STRUCTURE_ONLINE: NotificationStructureOnline,
323
+ NT.OWNERSHIP_TRANSFERRED: NotificationStructureOwnershipTransferred,
324
+ NT.STRUCTURE_ANCHORING: NotificationStructureAnchoring,
325
+ NT.STRUCTURE_DESTROYED: NotificationStructureDestroyed,
281
326
  NT.STRUCTURE_FUEL_ALERT: NotificationStructureFuelAlert,
282
327
  NT.STRUCTURE_JUMP_FUEL_ALERT: NotificationStructureJumpFuelAlert,
328
+ NT.STRUCTURE_LOST_ARMOR: NotificationStructureLostArmor,
329
+ NT.STRUCTURE_LOST_SHIELD: NotificationStructureLostShield,
330
+ NT.STRUCTURE_LOW_REAGENTS_ALERT: NotificationStructureLowReagentsAlert,
331
+ NT.STRUCTURE_NO_REAGENTS_ALERT: NotificationStructureNoReagentsAlert,
332
+ NT.STRUCTURE_ONLINE: NotificationStructureOnline,
283
333
  NT.STRUCTURE_REFUELED_EXTRA: NotificationStructureRefueledExtra,
334
+ NT.STRUCTURE_REINFORCEMENT_CHANGED: NotificationStructureReinforceChange,
284
335
  NT.STRUCTURE_SERVICES_OFFLINE: NotificationStructureServicesOffline,
285
- NT.STRUCTURE_WENT_LOW_POWER: NotificationStructureWentLowPower,
286
- NT.STRUCTURE_WENT_HIGH_POWER: NotificationStructureWentHighPower,
287
336
  NT.STRUCTURE_UNANCHORING: NotificationStructureUnanchoring,
288
337
  NT.STRUCTURE_UNDER_ATTACK: NotificationStructureUnderAttack,
289
- NT.STRUCTURE_LOST_SHIELD: NotificationStructureLostShield,
290
- NT.STRUCTURE_LOST_ARMOR: NotificationStructureLostArmor,
291
- NT.STRUCTURE_DESTROYED: NotificationStructureDestroyed,
292
- NT.OWNERSHIP_TRANSFERRED: NotificationStructureOwnershipTransferred,
293
- NT.STRUCTURE_ANCHORING: NotificationStructureAnchoring,
294
- NT.STRUCTURE_REINFORCEMENT_CHANGED: NotificationStructureReinforceChange,
338
+ NT.STRUCTURE_WENT_HIGH_POWER: NotificationStructureWentHighPower,
339
+ NT.STRUCTURE_WENT_LOW_POWER: NotificationStructureWentLowPower,
295
340
  # War
296
341
  NT.WAR_ACCEPTED_ALLY: NotificationAcceptedAlly,
342
+ NT.WAR_ALL_WAR_CORP_JOINED_ALLIANCE_MSG: NotificationAllWarCorpJoinedAllianceMsg,
343
+ NT.WAR_ALL_WAR_SURRENDER_MSG: NotificationAllWarSurrenderMsg,
297
344
  NT.WAR_ALLY_JOINED_WAR_AGGRESSOR_MSG: NotificationAllyJoinedWarMsg,
298
345
  NT.WAR_ALLY_JOINED_WAR_ALLY_MSG: NotificationAllyJoinedWarMsg,
299
346
  NT.WAR_ALLY_JOINED_WAR_DEFENDER_MSG: NotificationAllyJoinedWarMsg,
300
- NT.WAR_ALL_WAR_CORP_JOINED_ALLIANCE_MSG: NotificationAllWarCorpJoinedAllianceMsg,
301
- NT.WAR_ALL_WAR_SURRENDER_MSG: NotificationAllWarSurrenderMsg,
347
+ NT.WAR_CORP_WAR_SURRENDER_MSG: NotificationCorpWarSurrenderMsg,
302
348
  NT.WAR_CORPORATION_BECAME_ELIGIBLE: NotificationWarCorporationBecameEligible,
303
349
  NT.WAR_CORPORATION_NO_LONGER_ELIGIBLE: NotificationWarCorporationNoLongerEligible,
304
350
  NT.WAR_DECLARE_WAR: NotificationDeclareWar,
305
- NT.WAR_MERC_OFFERED_NEGOTIATION_MSG: NotificationMercOfferedNegotiationMsg,
306
- NT.WAR_MERC_OFFER_RETRACTED_MSG: NotificationMercOfferRetractedMsg,
307
- NT.WAR_CORP_WAR_SURRENDER_MSG: NotificationCorpWarSurrenderMsg,
308
351
  NT.WAR_HQ_REMOVED_FROM_SPACE: NotificationWarHQRemovedFromSpace,
309
- NT.WAR_OFFERED_TO_ALLY: NotificationOfferedToAlly,
352
+ NT.WAR_INVALID: NotificationWarInvalid,
353
+ NT.WAR_MERC_OFFER_RETRACTED_MSG: NotificationMercOfferRetractedMsg,
354
+ NT.WAR_MERC_OFFERED_NEGOTIATION_MSG: NotificationMercOfferedNegotiationMsg,
310
355
  NT.WAR_OFFERED_SURRENDER: NotificationOfferedSurrender,
356
+ NT.WAR_OFFERED_TO_ALLY: NotificationOfferedToAlly,
311
357
  NT.WAR_WAR_ADOPTED: NotificationWarAdopted,
312
358
  NT.WAR_WAR_DECLARED: NotificationWarDeclared,
313
359
  NT.WAR_WAR_INHERITED: NotificationWarInherited,
314
- NT.WAR_INVALID: NotificationWarInvalid,
315
360
  NT.WAR_WAR_RETRACTED_BY_CONCORD: NotificationWarRetractedByConcord,
316
361
  NT.WAR_WAR_SURRENDER_OFFER_MSG: NotificationWarSurrenderOfferMsg,
317
362
  }
@@ -31,7 +31,7 @@ class NotificationOrbitalEmbed(NotificationBaseEmbed):
31
31
  self._notification.eve_solar_system()
32
32
  )
33
33
  self._owner_link = gen_corporation_link(str(notification.owner))
34
- self._aggressor_link = self.get_aggressor_link()
34
+ self._aggressor_link = self.gen_aggressor_link()
35
35
  self._thumbnail = dhooks_lite.Thumbnail(
36
36
  self._structure_type.icon_url(size=self.ICON_DEFAULT_SIZE)
37
37
  )
@@ -0,0 +1,89 @@
1
+ """Skyhook embeds."""
2
+
3
+ # pylint: disable=missing-class-docstring
4
+
5
+ import dhooks_lite
6
+
7
+ from django.utils.translation import gettext as _
8
+
9
+ from app_utils.datetime import ldap_time_2_datetime
10
+
11
+ from structures.models import Notification, Webhook
12
+
13
+ from .helpers import (
14
+ gen_corporation_link,
15
+ gen_solar_system_text,
16
+ target_datetime_formatted,
17
+ )
18
+ from .main import NotificationBaseEmbed
19
+
20
+
21
+ class NotificationSkyhookEmbed(NotificationBaseEmbed):
22
+ """Base class for most structure related notification embeds."""
23
+
24
+ def __init__(self, n: Notification) -> None:
25
+ super().__init__(n)
26
+ type_ = n.eve_structure_type("typeID")
27
+ solar_system = n.eve_solar_system("solarsystemID")
28
+ self._description = _(
29
+ "The %(structure_type)s at **%(planet)s** "
30
+ "in %(solar_system)s belonging to %(owner_link)s "
31
+ ) % {
32
+ "structure_type": type_,
33
+ "planet": n.eve_planet(),
34
+ "solar_system": gen_solar_system_text(solar_system),
35
+ "owner_link": gen_corporation_link(str(n.owner)),
36
+ }
37
+ self._thumbnail = dhooks_lite.Thumbnail(
38
+ type_.icon_url(size=self.ICON_DEFAULT_SIZE)
39
+ )
40
+
41
+
42
+ class NotificationSkyhookDeployed(NotificationSkyhookEmbed):
43
+ def __init__(self, n: Notification) -> None:
44
+ super().__init__(n)
45
+ self._title = _("Skyhook has started onlining")
46
+ self._description += _("has started onlining.")
47
+ self._color = Webhook.Color.INFO
48
+
49
+
50
+ class NotificationSkyhookDestroyed(NotificationSkyhookEmbed):
51
+ def __init__(self, n: Notification) -> None:
52
+ super().__init__(n)
53
+ self._title = _("Skyhook destroyed")
54
+ self._description += _("has been destroyed.")
55
+ self._color = Webhook.Color.DANGER
56
+
57
+
58
+ class NotificationSkyhookLostShield(NotificationSkyhookEmbed):
59
+ def __init__(self, n: Notification) -> None:
60
+ super().__init__(n)
61
+ self._title = _("Skyhook lost shield")
62
+ timer_ends_at = ldap_time_2_datetime(self._data["timestamp"])
63
+ self._description += _(
64
+ "has lost its shields and is now in reinforcement state until : %s"
65
+ ) % target_datetime_formatted(timer_ends_at)
66
+ self._color = Webhook.Color.DANGER
67
+
68
+
69
+ class NotificationSkyhookOnline(NotificationSkyhookEmbed):
70
+ def __init__(self, n: Notification) -> None:
71
+ super().__init__(n)
72
+ self._title = _("Skyhook online")
73
+ self._description += _("is now online.")
74
+ self._color = Webhook.Color.SUCCESS
75
+
76
+
77
+ class NotificationSkyhookUnderAttack(NotificationSkyhookEmbed):
78
+ def __init__(self, n: Notification) -> None:
79
+ super().__init__(n)
80
+ self._title = _("Skyhook under attack")
81
+ self._description += _(
82
+ "is under attack by %(attacker)s.\n"
83
+ "%(damage_text)s"
84
+ % {
85
+ "attacker": self.gen_attacker_link(),
86
+ "damage_text": self.compile_damage_text("Percentage"),
87
+ }
88
+ )
89
+ self._color = Webhook.Color.DANGER
@@ -14,7 +14,6 @@ from structures.helpers import get_or_create_eve_entity, get_or_create_eve_type
14
14
  from structures.models import Notification, Structure, Webhook
15
15
 
16
16
  from .helpers import (
17
- gen_alliance_link,
18
17
  gen_corporation_link,
19
18
  gen_solar_system_text,
20
19
  target_datetime_formatted,
@@ -165,21 +164,11 @@ class NotificationStructureUnderAttack(NotificationStructureEmbed):
165
164
  super().__init__(notification)
166
165
  self._title = _("Structure under attack")
167
166
  self._description += _("is under attack by %(attacker)s.\n%(damage_text)s") % {
168
- "attacker": self._get_attacker_link(),
167
+ "attacker": self.gen_attacker_link(),
169
168
  "damage_text": self.compile_damage_text("Percentage"),
170
169
  }
171
170
  self._color = Webhook.Color.DANGER
172
171
 
173
- def _get_attacker_link(self) -> str:
174
- """Returns the attacker link from a parsed_text for Upwell structures only."""
175
- if self._data.get("allianceName"):
176
- return gen_alliance_link(self._data["allianceName"])
177
-
178
- if self._data.get("corpName"):
179
- return gen_corporation_link(self._data["corpName"])
180
-
181
- return _("(unknown)")
182
-
183
172
 
184
173
  class NotificationStructureLostShield(NotificationStructureEmbed):
185
174
  def __init__(self, notification: Notification) -> None:
@@ -324,3 +313,25 @@ class NotificationStructureReinforceChange(NotificationBaseEmbed):
324
313
  _("\n\nChange becomes effective at %s.")
325
314
  ) % target_datetime_formatted(change_effective)
326
315
  self._color = Webhook.Color.INFO
316
+
317
+
318
+ class NotificationStructureLowReagentsAlert(NotificationStructureEmbed):
319
+ def __init__(self, notification: Notification) -> None:
320
+ super().__init__(notification)
321
+ self._title = _("Structure low on reagents")
322
+ self._description += _(
323
+ "has insufficient reagents present to support "
324
+ "one full day of moon drill activity."
325
+ )
326
+ self._color = Webhook.Color.WARNING
327
+
328
+
329
+ class NotificationStructureNoReagentsAlert(NotificationStructureEmbed):
330
+ def __init__(self, notification: Notification) -> None:
331
+ super().__init__(notification)
332
+ self._title = _("Structure out of reagents")
333
+ self._description += _(
334
+ "has run out of reagents, "
335
+ "which is preventing further moon material production."
336
+ )
337
+ self._color = Webhook.Color.DANGER
@@ -56,7 +56,7 @@ class NotificationTowerEmbed(NotificationBaseEmbed):
56
56
  class NotificationTowerAlertMsg(NotificationTowerEmbed):
57
57
  def __init__(self, notification: Notification) -> None:
58
58
  super().__init__(notification)
59
- aggressor_link = self.get_aggressor_link()
59
+ aggressor_link = self.gen_aggressor_link()
60
60
  damage_text = self.compile_damage_text("Value", 100)
61
61
  self._title = _("Starbase under attack")
62
62
  self._description += _("is under attack by %(aggressor)s.\n%(damage_text)s") % {