hikari-arc 2.1.0__py3-none-any.whl → 2.2.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.
arc/client.py CHANGED
@@ -125,11 +125,11 @@ class GatewayClientBase(Client[GatewayBotT]):
125
125
 
126
126
  async def _on_gatewaybot_startup(self, event: hikari.StartedEvent) -> None:
127
127
  await self._on_startup()
128
- await self.app.event_manager.dispatch(StartedEvent(self))
128
+ self.app.event_manager.dispatch(StartedEvent(self), return_tasks=False)
129
129
 
130
130
  async def _on_gatewaybot_shutdown(self, event: hikari.StoppingEvent) -> None:
131
131
  await self._on_shutdown()
132
- await self.app.event_manager.dispatch(StoppingEvent(self))
132
+ self.app.event_manager.dispatch(StoppingEvent(self), return_tasks=False)
133
133
 
134
134
  async def _on_gatewaybot_interaction_create(self, event: hikari.InteractionCreateEvent) -> None:
135
135
  if isinstance(event.interaction, hikari.CommandInteraction):
@@ -141,7 +141,7 @@ class GatewayClientBase(Client[GatewayBotT]):
141
141
  if not self.app.event_manager.get_listeners(CommandErrorEvent):
142
142
  return await super()._on_error(ctx, exception)
143
143
 
144
- self.app.event_manager.dispatch(CommandErrorEvent(self, ctx, exception))
144
+ self.app.event_manager.dispatch(CommandErrorEvent(self, ctx, exception), return_tasks=False)
145
145
 
146
146
  def subscribe(self, event_type: type[EventT], callback: EventCallbackT[EventT]) -> None:
147
147
  """Subscribe to an event.
@@ -55,7 +55,7 @@ class EmojiOption(ConverterOption[hikari.Emoji, ClientT, EmojiParams, str]):
55
55
  return hikari.Emoji.parse(value)
56
56
  except ValueError as exc:
57
57
  raise OptionConverterFailureError(
58
- self, value, f"Option '{self.name}' expected a valid color, got {value!r}."
58
+ self, value, f"Option '{self.name}' expected a valid emoji, got {value!r}."
59
59
  ) from exc
60
60
 
61
61
  @classmethod
arc/command/slash.py CHANGED
@@ -13,7 +13,7 @@ from arc.errors import AutocompleteError, CommandInvokeError
13
13
  from arc.internal.options import resolve_options
14
14
  from arc.internal.sigparse import parse_command_signature
15
15
  from arc.internal.types import ClientT, CommandCallbackT, HookT, PostHookT, ResponseBuilderT, SlashCommandLike
16
- from arc.locale import CommandLocaleRequest, LocaleResponse
16
+ from arc.locale import CommandLocaleRequest
17
17
 
18
18
  if t.TYPE_CHECKING:
19
19
  from asyncio.futures import Future
@@ -183,10 +183,13 @@ class SlashCommand(CallableCommandBase[ClientT, hikari.api.SlashCommandBuilder])
183
183
 
184
184
  def _request_command_locale(self) -> None:
185
185
  """Request the locale for this command."""
186
- if self.name_localizations or self.description_localizations or self._client is None:
186
+ if self._client is None or not self._client._provided_locales or not self._client._command_locale_provider:
187
187
  return
188
188
 
189
- if not self._client._provided_locales or not self._client._command_locale_provider:
189
+ for option in self.options.values():
190
+ option._request_option_locale(self._client, self)
191
+
192
+ if self.name_localizations or self.description_localizations:
190
193
  return
191
194
 
192
195
  name_locales: dict[hikari.Locale, str] = {}
@@ -196,8 +199,6 @@ class SlashCommand(CallableCommandBase[ClientT, hikari.api.SlashCommandBuilder])
196
199
  request = CommandLocaleRequest(self, locale, self.name)
197
200
  resp = self._client._command_locale_provider(request)
198
201
 
199
- assert isinstance(resp, LocaleResponse)
200
-
201
202
  if resp.name is not None and resp.description is not None:
202
203
  name_locales[locale] = resp.name
203
204
  desc_locales[locale] = resp.description
@@ -205,9 +206,6 @@ class SlashCommand(CallableCommandBase[ClientT, hikari.api.SlashCommandBuilder])
205
206
  self.name_localizations: t.Mapping[hikari.Locale, str] = name_locales
206
207
  self.description_localizations: t.Mapping[hikari.Locale, str] = desc_locales
207
208
 
208
- for option in self.options.values():
209
- option._request_option_locale(self._client, self)
210
-
211
209
 
212
210
  @attr.define(slots=True, kw_only=True)
213
211
  class SlashGroup(CommandBase[ClientT, hikari.api.SlashCommandBuilder]):
@@ -387,6 +385,9 @@ class SlashGroup(CommandBase[ClientT, hikari.api.SlashCommandBuilder]):
387
385
  if self.name_localizations or self.description_localizations or self._client is None:
388
386
  return
389
387
 
388
+ for sub in self.children.values():
389
+ sub._request_command_locale(self._client)
390
+
390
391
  if not self._client._provided_locales or not self._client._command_locale_provider:
391
392
  return
392
393
 
@@ -404,9 +405,6 @@ class SlashGroup(CommandBase[ClientT, hikari.api.SlashCommandBuilder]):
404
405
  self.name_localizations: t.Mapping[hikari.Locale, str] = name_locales
405
406
  self.description_localizations: t.Mapping[hikari.Locale, str] = desc_locales
406
407
 
407
- for sub in self.children.values():
408
- sub._request_option_locale(self._client, self)
409
-
410
408
  @t.overload
411
409
  def include(self) -> t.Callable[[SlashSubCommand[ClientT]], SlashSubCommand[ClientT]]: ...
412
410
 
@@ -551,11 +549,32 @@ class SlashSubGroup(SubCommandBase[ClientT, SlashGroup[ClientT]]):
551
549
  assert self._parent is not None
552
550
  await self._parent._handle_exception(ctx, exc)
553
551
 
554
- def _request_option_locale(self, client: Client[t.Any], command: CommandProto) -> None:
555
- super()._request_option_locale(client, command)
552
+ def _request_command_locale(self, client: Client[t.Any]) -> None:
553
+ if not client._provided_locales or not client._command_locale_provider:
554
+ return
555
+
556
+ for sub in self.children.values():
557
+ sub._request_command_locale(client)
558
+
559
+ if self.name_localizations or self.description_localizations:
560
+ return
561
+
562
+ name_locales = {}
563
+ desc_locales = {}
564
+
565
+ for locale in client._provided_locales:
566
+ request = CommandLocaleRequest(self, locale, self.name)
567
+ resp = client._command_locale_provider(request)
568
+
569
+ if resp.name is not None and resp.description is not None:
570
+ name_locales[locale] = resp.name
571
+ desc_locales[locale] = resp.description
572
+
573
+ self.name_localizations: t.Mapping[hikari.Locale, str] = name_locales
574
+ self.description_localizations: t.Mapping[hikari.Locale, str] = desc_locales
556
575
 
557
- for subcommand in self.children.values():
558
- subcommand._request_option_locale(client, command)
576
+ def _request_option_locale(self, client: Client[t.Any], command: CommandProto) -> None:
577
+ raise RuntimeError("_request_option_locale should not be called on a subgroup. (This is a bug)")
559
578
 
560
579
  @t.overload
561
580
  def include(self) -> t.Callable[[SlashSubCommand[ClientT]], SlashSubCommand[ClientT]]: ...
@@ -705,11 +724,32 @@ class SlashSubCommand(
705
724
  assert self._parent is not None
706
725
  await self._parent._handle_exception(ctx, e)
707
726
 
708
- def _request_option_locale(self, client: Client[t.Any], command: CommandProto) -> None:
709
- super()._request_option_locale(client, command)
727
+ def _request_command_locale(self, client: Client[t.Any]) -> None:
728
+ if not client._provided_locales or not client._command_locale_provider:
729
+ return
710
730
 
711
731
  for option in self.options.values():
712
- option._request_option_locale(client, command)
732
+ option._request_option_locale(client, self)
733
+
734
+ if self.name_localizations or self.description_localizations:
735
+ return
736
+
737
+ name_locales = {}
738
+ desc_locales = {}
739
+
740
+ for locale in client._provided_locales:
741
+ request = CommandLocaleRequest(self, locale, self.name)
742
+ resp = client._command_locale_provider(request)
743
+
744
+ if resp.name is not None and resp.description is not None:
745
+ name_locales[locale] = resp.name
746
+ desc_locales[locale] = resp.description
747
+
748
+ self.name_localizations: t.Mapping[hikari.Locale, str] = name_locales
749
+ self.description_localizations: t.Mapping[hikari.Locale, str] = desc_locales
750
+
751
+ def _request_option_locale(self, client: Client[t.Any], command: CommandProto) -> None:
752
+ raise RuntimeError("_request_option_locale should not be called on a subcommand. (This is a bug)")
713
753
 
714
754
  async def __call__(self, ctx: Context[ClientT], *args: t.Any, **kwargs: t.Any) -> None:
715
755
  """Invoke this subcommand with the given context.
arc/internal/about.py CHANGED
@@ -1,6 +1,6 @@
1
1
  import typing as t
2
2
 
3
- __version__: t.Final[str] = "2.1.0"
3
+ __version__: t.Final[str] = "2.2.0"
4
4
 
5
5
  # MIT License
6
6
  #
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hikari-arc
3
- Version: 2.1.0
3
+ Version: 2.2.0
4
4
  Summary: A command handler for hikari with a focus on type-safety and correctness.
5
5
  Project-URL: Homepage, https://arc.hypergonial.com
6
6
  Project-URL: Documentation, https://arc.hypergonial.com
@@ -20,6 +20,7 @@ Classifier: Programming Language :: Python :: 3.10
20
20
  Classifier: Programming Language :: Python :: 3.11
21
21
  Classifier: Programming Language :: Python :: 3.12
22
22
  Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Programming Language :: Python :: 3.14
23
24
  Classifier: Programming Language :: Python :: Implementation :: CPython
24
25
  Classifier: Topic :: Software Development :: Libraries
25
26
  Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
@@ -27,12 +28,12 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules
27
28
  Requires-Python: >=3.10
28
29
  Requires-Dist: alluka<0.4,>=0.3.3
29
30
  Requires-Dist: attrs>=25.3.0
30
- Requires-Dist: hikari>=2.2.1
31
+ Requires-Dist: hikari>=2.3.3
31
32
  Provides-Extra: cron
32
33
  Requires-Dist: croniter==5.0.1; extra == 'cron'
33
34
  Requires-Dist: types-croniter==5.0.1.20241205; extra == 'cron'
34
35
  Provides-Extra: rest
35
- Requires-Dist: hikari[server]>=2.2.1; extra == 'rest'
36
+ Requires-Dist: hikari[server]>=2.3.3; extra == 'rest'
36
37
  Description-Content-Type: text/markdown
37
38
 
38
39
  <div align="center">
@@ -1,6 +1,6 @@
1
1
  arc/__init__.py,sha256=rkJuU9fFg1c2xZ6xFx60rzdL6gmkIcjl5KTc42IoIEc,5899
2
2
  arc/__main__.py,sha256=ClAG2bqkzmJfKrEMYTVzi0O5--8eY_QFuNAqsMmwVQY,2012
3
- arc/client.py,sha256=nTu2wqB0En_Y1IkNZAsShCaC8MYtC0m235S8WxrUiTo,19828
3
+ arc/client.py,sha256=jMcCfFcz8TAarUCmNvhxmmQdPJXPQ1hpvwkvaHWSL9U,19876
4
4
  arc/errors.py,sha256=_RLNY-iivsbogHlv_ofSU8TwoIewOGZ_ruf6EKtPvbY,6802
5
5
  arc/events.py,sha256=WRXTLH9PBwU4GTu5rZS5AJ4fNxhDgSD9Rx3M-02FcDQ,2782
6
6
  arc/extension.py,sha256=UgtORuV7D3_zUHG1LGXrnhHvz8nntxHRncMrxleoPM0,3371
@@ -18,7 +18,7 @@ arc/abc/option.py,sha256=VHMXXXy4y2xTGErFDv47tWA2gDXYbHV4IPE5xFpqh0w,13157
18
18
  arc/abc/plugin.py,sha256=xzVFxz-2PEbJxIbarlR-wOuw0IoaPNE14p3FgShMTeI,22589
19
19
  arc/command/__init__.py,sha256=Y9L-vVEcDYUpQb4AngH3QjamZY-OtSbdIENBqQ78fA0,2614
20
20
  arc/command/message.py,sha256=1aKF-Rfyk-z2T8wdW5paQtnZKaUJTMkSjM_wity1vqQ,6437
21
- arc/command/slash.py,sha256=jldzFLEcX_jNn6_07Ht4ZvcqrYEBheAGFR_ViE5aMKQ,36193
21
+ arc/command/slash.py,sha256=ZBjVjvRdB4bVFJCmDqVStM5GGiFzFEgGzVEVwthCBhs,37856
22
22
  arc/command/user.py,sha256=CVGGtLN0zqG4RCcva7dEm_T4Mc67vqEfxSk8W33vHPc,6489
23
23
  arc/command/option/__init__.py,sha256=BCNSEHiifoYZdm24zjfIP5POELImLBbtft-8oDxysPI,2218
24
24
  arc/command/option/attachment.py,sha256=N9DEVg3zO8hcJbU2fQyJGARfJl1DZQSd_7T5tX3Bxts,3004
@@ -32,14 +32,14 @@ arc/command/option/str.py,sha256=ua-HXYjklptjkL9IXZazzY1lbREPPwydInwJGM6BcDY,526
32
32
  arc/command/option/user.py,sha256=Qf9dqqmsSPB-yBjT4qAupKRfF1UHh9P3rKXZnRahFYE,2922
33
33
  arc/command/option/custom/__init__.py,sha256=dffcEAj7UnjNI1LUuKOCyEEu23AeCFXQY3ay3XKArhQ,334
34
34
  arc/command/option/custom/color.py,sha256=eBO85edOVztUu_m5kdvVGm0XYUVl9bpmWYTWizzOnTo,3474
35
- arc/command/option/custom/emoji.py,sha256=YcgZeGCDUDRavmacw9OSOo8GD5ChyT1K7a3qHPqvbZg,3302
35
+ arc/command/option/custom/emoji.py,sha256=-1axRfS3eaAQOHlzsvflriQqPQe_WKAcOxsn8XFOVZo,3302
36
36
  arc/command/option/custom/member.py,sha256=Jjn0ZWex6fv9x1iSUqcyFSAr90Oq8cK6OFCIQcr5HHA,3338
37
37
  arc/context/__init__.py,sha256=5M-6ZkBv3pJf3_TY8ckzcAXIxVh-5VgXxoRjPvuy_Go,1303
38
38
  arc/context/autocomplete.py,sha256=lBPFZWW1XSFPndo0uz8Q3vgovNelrLWNU5ks059zORY,4423
39
39
  arc/context/base.py,sha256=U78_5LeHK986k5pZ9Tp0xx3ySQ2Ojilt068zfp1zFzI,42541
40
40
  arc/ext/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
41
41
  arc/internal/__init__.py,sha256=vKFwSbAXp509-QtHo42xkv4sfONNhuW5foSxesrNPUc,1261
42
- arc/internal/about.py,sha256=ksMs_fWarWOxJygC9gj38ee7YvJos78P6vOauWbLlKY,1171
42
+ arc/internal/about.py,sha256=ZRB1XCpOSepiPM4fmIZ4oRRMUUOK6ndb6SoBN4IhvRY,1171
43
43
  arc/internal/deprecation.py,sha256=Lnirv1z_oj6QJvbnd38TwHQnhHhFD2rTqqvH96pxiWE,2204
44
44
  arc/internal/options.py,sha256=4Z56tG7gxpMR4wCgno85dD23-62GfFnidZsFlHvYp7c,3658
45
45
  arc/internal/sigparse.py,sha256=-Arw1lvoHJzlr53ydk8PvNQU0dSOXGA5dQ1r1GL3EMk,13613
@@ -53,7 +53,7 @@ arc/utils/ratelimiter.py,sha256=tnFORqGerByEiBGesiRGO19NSjCBXTzvDhkLb8Of4yU,9477
53
53
  arc/utils/hooks/__init__.py,sha256=llFi42mb-LH9VS0Ah9Z7E-bZq4Wneb2vHwY1LTFcEUI,515
54
54
  arc/utils/hooks/basic.py,sha256=5dl3lQ--Sytn9CdlDntDvTepFBOuFngC8J4buDsd6hY,5790
55
55
  arc/utils/hooks/limiters.py,sha256=64PyJHPIii2R9cbHA9MIOCfkIg99lGOGWrhGNuP5jHE,7490
56
- hikari_arc-2.1.0.dist-info/METADATA,sha256=gBBrq50WqP5bWPLWxIyIgGvhq7JPlndBOW1v58-PccM,5447
57
- hikari_arc-2.1.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
58
- hikari_arc-2.1.0.dist-info/licenses/LICENSE,sha256=q_osUjCCfQVI7zzgteLMZ-RlhXlB4rqQE8I0DGh7ur4,1076
59
- hikari_arc-2.1.0.dist-info/RECORD,,
56
+ hikari_arc-2.2.0.dist-info/METADATA,sha256=oL7zzF91QI7FjRDT4fN0C4foEgkeOu7L9ns-Jm79zw0,5498
57
+ hikari_arc-2.2.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
58
+ hikari_arc-2.2.0.dist-info/licenses/LICENSE,sha256=q_osUjCCfQVI7zzgteLMZ-RlhXlB4rqQE8I0DGh7ur4,1076
59
+ hikari_arc-2.2.0.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.27.0
2
+ Generator: hatchling 1.28.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any