hikari-arc 1.3.3__tar.gz → 1.4.0__tar.gz

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.
Files changed (87) hide show
  1. {hikari_arc-1.3.3/hikari_arc.egg-info → hikari_arc-1.4.0}/PKG-INFO +27 -16
  2. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/README.md +11 -1
  3. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/arc/__init__.py +2 -0
  4. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/arc/abc/client.py +5 -5
  5. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/arc/abc/option.py +5 -2
  6. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/arc/command/__init__.py +4 -0
  7. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/arc/command/message.py +1 -1
  8. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/arc/command/option/__init__.py +12 -1
  9. hikari_arc-1.4.0/arc/command/option/custom/__init__.py +14 -0
  10. hikari_arc-1.4.0/arc/command/option/custom/emoji.py +96 -0
  11. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/arc/command/slash.py +5 -5
  12. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/arc/command/user.py +1 -1
  13. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/arc/context/base.py +5 -2
  14. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/arc/internal/about.py +1 -1
  15. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/arc/internal/options.py +1 -0
  16. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/arc/internal/sigparse.py +4 -0
  17. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/arc/utils/hooks/basic.py +1 -3
  18. hikari_arc-1.4.0/cron_requirements.txt +2 -0
  19. hikari_arc-1.4.0/dev_requirements.txt +7 -0
  20. hikari_arc-1.4.0/doc_requirements.txt +6 -0
  21. {hikari_arc-1.3.3 → hikari_arc-1.4.0/hikari_arc.egg-info}/PKG-INFO +27 -16
  22. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/hikari_arc.egg-info/SOURCES.txt +2 -0
  23. hikari_arc-1.4.0/hikari_arc.egg-info/requires.txt +30 -0
  24. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/requirements.txt +1 -1
  25. hikari_arc-1.4.0/rest_requirements.txt +1 -0
  26. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/setup.py +2 -1
  27. hikari_arc-1.4.0/tests/test_command.py +377 -0
  28. hikari_arc-1.3.3/arc/command/option/custom/__init__.py +0 -4
  29. hikari_arc-1.3.3/cron_requirements.txt +0 -2
  30. hikari_arc-1.3.3/dev_requirements.txt +0 -7
  31. hikari_arc-1.3.3/doc_requirements.txt +0 -6
  32. hikari_arc-1.3.3/hikari_arc.egg-info/requires.txt +0 -30
  33. hikari_arc-1.3.3/rest_requirements.txt +0 -1
  34. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/LICENSE +0 -0
  35. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/MANIFEST.in +0 -0
  36. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/arc/__main__.py +0 -0
  37. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/arc/abc/__init__.py +0 -0
  38. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/arc/abc/command.py +0 -0
  39. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/arc/abc/concurrency_limiting.py +0 -0
  40. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/arc/abc/error_handler.py +0 -0
  41. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/arc/abc/hookable.py +0 -0
  42. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/arc/abc/limiter.py +0 -0
  43. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/arc/abc/plugin.py +0 -0
  44. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/arc/client.py +0 -0
  45. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/arc/command/option/attachment.py +0 -0
  46. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/arc/command/option/bool.py +0 -0
  47. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/arc/command/option/channel.py +0 -0
  48. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/arc/command/option/custom/color.py +0 -0
  49. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/arc/command/option/custom/member.py +0 -0
  50. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/arc/command/option/float.py +0 -0
  51. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/arc/command/option/int.py +0 -0
  52. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/arc/command/option/mentionable.py +0 -0
  53. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/arc/command/option/role.py +0 -0
  54. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/arc/command/option/str.py +0 -0
  55. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/arc/command/option/user.py +0 -0
  56. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/arc/context/__init__.py +0 -0
  57. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/arc/context/autocomplete.py +0 -0
  58. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/arc/errors.py +0 -0
  59. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/arc/events.py +0 -0
  60. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/arc/ext/__init__.py +0 -0
  61. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/arc/extension.py +0 -0
  62. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/arc/internal/__init__.py +0 -0
  63. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/arc/internal/deprecation.py +0 -0
  64. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/arc/internal/sync.py +0 -0
  65. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/arc/internal/types.py +0 -0
  66. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/arc/internal/version.py +0 -0
  67. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/arc/locale.py +0 -0
  68. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/arc/plugin.py +0 -0
  69. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/arc/py.typed +0 -0
  70. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/arc/utils/__init__.py +0 -0
  71. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/arc/utils/concurrency_limiter.py +0 -0
  72. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/arc/utils/hooks/__init__.py +0 -0
  73. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/arc/utils/hooks/limiters.py +0 -0
  74. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/arc/utils/loops.py +0 -0
  75. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/arc/utils/ratelimiter.py +0 -0
  76. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/hikari_arc.egg-info/dependency_links.txt +0 -0
  77. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/hikari_arc.egg-info/not-zip-safe +0 -0
  78. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/hikari_arc.egg-info/top_level.txt +0 -0
  79. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/pyproject.toml +0 -0
  80. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/setup.cfg +0 -0
  81. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/tests/test_client.py +0 -0
  82. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/tests/test_context_command.py +0 -0
  83. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/tests/test_di.py +0 -0
  84. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/tests/test_inheritance.py +0 -0
  85. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/tests/test_options.py +0 -0
  86. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/tests/test_sigparse.py +0 -0
  87. {hikari_arc-1.3.3 → hikari_arc-1.4.0}/tests/test_slash.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hikari-arc
3
- Version: 1.3.3
3
+ Version: 1.4.0
4
4
  Summary: A command handler for hikari with a focus on type-safety and correctness.
5
5
  Home-page: https://github.com/hypergonial/hikari-arc
6
6
  Author: hypergonial
@@ -15,40 +15,49 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules
15
15
  Classifier: Programming Language :: Python :: 3.10
16
16
  Classifier: Programming Language :: Python :: 3.11
17
17
  Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
18
19
  Classifier: Programming Language :: Python :: Implementation :: CPython
19
20
  Classifier: Programming Language :: Python :: 3 :: Only
20
21
  Classifier: Topic :: Software Development :: Libraries
21
22
  Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
22
23
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
- Requires-Python: >=3.10.0,<3.13
24
+ Requires-Python: >=3.10.0,<3.14
24
25
  Description-Content-Type: text/markdown
25
26
  License-File: LICENSE
26
- Requires-Dist: hikari>=2.0.0.dev122
27
+ Requires-Dist: hikari>=2.0.0
27
28
  Requires-Dist: alluka<0.4,>=0.3.0
28
29
  Requires-Dist: attrs>=23.1
29
30
  Requires-Dist: colorama; sys_platform == "win32"
30
31
  Provides-Extra: docs
31
- Requires-Dist: mkdocs-material[imaging]~=9.5.24; extra == "docs"
32
+ Requires-Dist: mkdocs-material[imaging]~=9.5.39; extra == "docs"
32
33
  Requires-Dist: mkdocs~=1.6.0; extra == "docs"
33
- Requires-Dist: mkdocstrings-python~=1.10.3; extra == "docs"
34
- Requires-Dist: black~=24.4.2; extra == "docs"
35
- Requires-Dist: griffe-inherited-docstrings~=1.0.0; extra == "docs"
34
+ Requires-Dist: mkdocstrings-python~=1.11.1; extra == "docs"
35
+ Requires-Dist: black~=24.8.0; extra == "docs"
36
+ Requires-Dist: griffe-inherited-docstrings~=1.0.1; extra == "docs"
36
37
  Requires-Dist: mkdocs-glightbox~=0.4.0; extra == "docs"
37
38
  Provides-Extra: dev
38
- Requires-Dist: ruff==0.4.5; extra == "dev"
39
- Requires-Dist: pyright==1.1.364; extra == "dev"
39
+ Requires-Dist: ruff==0.6.9; extra == "dev"
40
+ Requires-Dist: pyright==1.1.369; extra == "dev"
40
41
  Requires-Dist: nox==2024.4.15; extra == "dev"
41
- Requires-Dist: typing_extensions==4.11.0; extra == "dev"
42
- Requires-Dist: pytest==8.2.1; extra == "dev"
43
- Requires-Dist: pytest-asyncio==0.23.7; extra == "dev"
42
+ Requires-Dist: typing_extensions==4.12.2; extra == "dev"
43
+ Requires-Dist: pytest==8.3.2; extra == "dev"
44
+ Requires-Dist: pytest-asyncio==0.24.0; extra == "dev"
44
45
  Requires-Dist: slotscheck==0.19.0; extra == "dev"
45
46
  Provides-Extra: rest
46
- Requires-Dist: hikari[server]>=2.0.0.dev122; extra == "rest"
47
+ Requires-Dist: hikari[server]>=2.0.0; extra == "rest"
47
48
  Provides-Extra: cron
48
- Requires-Dist: croniter==2.0.5; extra == "cron"
49
- Requires-Dist: types-croniter==2.0.0.20240423; extra == "cron"
49
+ Requires-Dist: croniter==3.0.3; extra == "cron"
50
+ Requires-Dist: types-croniter==3.0.3.20240731; extra == "cron"
50
51
 
51
- # hikari-arc
52
+ <div align="center">
53
+ <picture>
54
+ <source media="(prefers-color-scheme: dark)" srcset="./docs/assets/branding/composed-darkmode.svg">
55
+ <source media="(prefers-color-scheme: light)" srcset="./docs/assets/branding/composed-lightmode.svg">
56
+ <img alt="The arc logo" src="./docs/assets/branding/composed-lightmode.svg" width="30%">
57
+ </picture>
58
+ </div>
59
+
60
+ ---
52
61
 
53
62
  <div align="center">
54
63
 
@@ -120,6 +129,8 @@ See [Contributing](./CONTRIBUTING.md).
120
129
  - [`Tanjun`](https://github.com/FasterSpeeding/Tanjun) - For the idea of using `typing.Annotated` and [dependency injection](https://arc.hypergonial.com/guides/dependency_injection/) in a command handler. `arc` also uses the same dependency injection library, [`Alluka`](https://github.com/FasterSpeeding/Alluka), under the hood.
121
130
  - [`hikari-crescent`](https://github.com/hikari-crescent/hikari-crescent) The design of [hooks](https://arc.hypergonial.com/guides/hooks/) is largely inspired by `crescent`.
122
131
  - [`FastAPI`](https://github.com/tiangolo/fastapi) - Some design ideas and most of the [documentation](https://arc.hypergonial.com/) [configuration](https://github.com/hypergonial/hikari-arc/blob/main/mkdocs.yml) derives from `FastAPI`.
132
+ - The `arc` logo was made by [@PythonTryHard](https://github.com/PythonTryHard).
133
+
123
134
 
124
135
  ## Links
125
136
 
@@ -1,4 +1,12 @@
1
- # hikari-arc
1
+ <div align="center">
2
+ <picture>
3
+ <source media="(prefers-color-scheme: dark)" srcset="./docs/assets/branding/composed-darkmode.svg">
4
+ <source media="(prefers-color-scheme: light)" srcset="./docs/assets/branding/composed-lightmode.svg">
5
+ <img alt="The arc logo" src="./docs/assets/branding/composed-lightmode.svg" width="30%">
6
+ </picture>
7
+ </div>
8
+
9
+ ---
2
10
 
3
11
  <div align="center">
4
12
 
@@ -70,6 +78,8 @@ See [Contributing](./CONTRIBUTING.md).
70
78
  - [`Tanjun`](https://github.com/FasterSpeeding/Tanjun) - For the idea of using `typing.Annotated` and [dependency injection](https://arc.hypergonial.com/guides/dependency_injection/) in a command handler. `arc` also uses the same dependency injection library, [`Alluka`](https://github.com/FasterSpeeding/Alluka), under the hood.
71
79
  - [`hikari-crescent`](https://github.com/hikari-crescent/hikari-crescent) The design of [hooks](https://arc.hypergonial.com/guides/hooks/) is largely inspired by `crescent`.
72
80
  - [`FastAPI`](https://github.com/tiangolo/fastapi) - Some design ideas and most of the [documentation](https://arc.hypergonial.com/) [configuration](https://github.com/hypergonial/hikari-arc/blob/main/mkdocs.yml) derives from `FastAPI`.
81
+ - The `arc` logo was made by [@PythonTryHard](https://github.com/PythonTryHard).
82
+
73
83
 
74
84
  ## Links
75
85
 
@@ -31,6 +31,7 @@ from .command import (
31
31
  ChannelParams,
32
32
  ColorParams,
33
33
  ColourParams,
34
+ EmojiParams,
34
35
  FloatParams,
35
36
  IntParams,
36
37
  MemberParams,
@@ -131,6 +132,7 @@ __all__ = (
131
132
  "MemberParams",
132
133
  "ColorParams",
133
134
  "ColourParams",
135
+ "EmojiParams",
134
136
  "SlashCommand",
135
137
  "SlashGroup",
136
138
  "SlashSubCommand",
@@ -333,10 +333,10 @@ class Client(t.Generic[AppT], abc.ABC):
333
333
  inj_ctx = alluka.OverridingContext.from_client(self.injector)
334
334
 
335
335
  for hook in self._injection_hooks:
336
- if inspect.isawaitable(hook):
337
- await hook(ctx, inj_ctx) # type: ignore
338
- else:
339
- hook(ctx, inj_ctx)
336
+ res = hook(ctx, inj_ctx)
337
+
338
+ if inspect.isawaitable(res):
339
+ await res
340
340
  return inj_ctx
341
341
 
342
342
  def _provide_command_locale(self, request: CommandLocaleRequest) -> LocaleResponse:
@@ -1354,7 +1354,7 @@ class Client(t.Generic[AppT], abc.ABC):
1354
1354
  dir_path = pathlib.Path(dir_path)
1355
1355
 
1356
1356
  try:
1357
- dir_path.resolve().relative_to(pathlib.Path.cwd())
1357
+ dir_path.absolute().relative_to(pathlib.Path.cwd())
1358
1358
  except ValueError:
1359
1359
  raise ExtensionLoadError("dir_path must be relative to the current working directory.")
1360
1360
 
@@ -102,6 +102,9 @@ class OptionType(enum.IntEnum):
102
102
  COLOR = 10002
103
103
  """Denotes a command option where the value will be a color."""
104
104
 
105
+ EMOJI = 10003
106
+ """Denotes a command option where the value will be an emoji."""
107
+
105
108
  @classmethod
106
109
  def from_hikari(cls, option_type: hikari.OptionType) -> OptionType:
107
110
  """Convert a hikari.OptionType to an OptionType."""
@@ -248,8 +251,8 @@ class OptionBase(abc.ABC, t.Generic[T]):
248
251
  "name": self.name,
249
252
  "description": self.description,
250
253
  "autocomplete": False,
251
- "name_localizations": self.name_localizations,
252
- "description_localizations": self.description_localizations,
254
+ "name_localizations": {str(key): value for key, value in self.name_localizations.items()},
255
+ "description_localizations": {str(key): value for key, value in self.description_localizations.items()},
253
256
  }
254
257
 
255
258
  def to_command_option(self) -> hikari.CommandOption:
@@ -10,6 +10,8 @@ from .option import (
10
10
  ColorParams,
11
11
  ColourOption,
12
12
  ColourParams,
13
+ EmojiOption,
14
+ EmojiParams,
13
15
  FloatOption,
14
16
  FloatParams,
15
17
  IntOption,
@@ -54,6 +56,8 @@ __all__ = (
54
56
  "FloatParams",
55
57
  "UserOption",
56
58
  "UserParams",
59
+ "EmojiParams",
60
+ "EmojiOption",
57
61
  "ChannelOption",
58
62
  "ChannelParams",
59
63
  "RoleOption",
@@ -47,7 +47,7 @@ class MessageCommand(CallableCommandBase[ClientT, hikari.api.ContextMenuCommandB
47
47
  default_member_permissions=self.default_permissions,
48
48
  is_dm_enabled=self.is_dm_enabled,
49
49
  is_nsfw=self.is_nsfw,
50
- name_localizations=self.name_localizations, # pyright: ignore reportGeneralTypeIssues
50
+ name_localizations={str(key): value for key, value in self.name_localizations.items()},
51
51
  )
52
52
 
53
53
  async def invoke(
@@ -1,7 +1,16 @@
1
1
  from .attachment import AttachmentOption, AttachmentParams
2
2
  from .bool import BoolOption, BoolParams
3
3
  from .channel import ChannelOption, ChannelParams
4
- from .custom import ColorOption, ColorParams, ColourOption, ColourParams, MemberOption, MemberParams
4
+ from .custom import (
5
+ ColorOption,
6
+ ColorParams,
7
+ ColourOption,
8
+ ColourParams,
9
+ EmojiOption,
10
+ EmojiParams,
11
+ MemberOption,
12
+ MemberParams,
13
+ )
5
14
  from .float import FloatOption, FloatParams
6
15
  from .int import IntOption, IntParams
7
16
  from .mentionable import MentionableOption, MentionableParams
@@ -34,6 +43,8 @@ __all__ = (
34
43
  "ColorParams",
35
44
  "ColourOption",
36
45
  "ColourParams",
46
+ "EmojiOption",
47
+ "EmojiParams",
37
48
  )
38
49
 
39
50
  # MIT License
@@ -0,0 +1,14 @@
1
+ from .color import ColorOption, ColorParams, ColourOption, ColourParams
2
+ from .emoji import EmojiOption, EmojiParams
3
+ from .member import MemberOption, MemberParams
4
+
5
+ __all__ = (
6
+ "ColorOption",
7
+ "ColorParams",
8
+ "ColourOption",
9
+ "ColourParams",
10
+ "MemberOption",
11
+ "MemberParams",
12
+ "EmojiOption",
13
+ "EmojiParams",
14
+ )
@@ -0,0 +1,96 @@
1
+ from __future__ import annotations
2
+
3
+ import typing as t
4
+
5
+ import attr
6
+ import hikari
7
+
8
+ from arc.abc.option import ConverterOption, OptionParams, OptionType
9
+ from arc.errors import OptionConverterFailureError
10
+ from arc.internal.types import ClientT
11
+
12
+ if t.TYPE_CHECKING:
13
+ import typing_extensions as te
14
+
15
+
16
+ __all__ = ("EmojiOption", "EmojiParams")
17
+
18
+
19
+ @t.final
20
+ class EmojiParams(OptionParams[hikari.Color]):
21
+ """The parameters for an emoji option.
22
+
23
+ Parameters
24
+ ----------
25
+ description : str
26
+ The description of the option
27
+ name : str
28
+ The name of the option. If not provided, the name of the parameter will be used.
29
+ name_localizations : Mapping[hikari.Locale, str] | None
30
+ The name of the option in different locales
31
+ description_localizations : Mapping[hikari.Locale, str] | None
32
+ The description of the option in different locales
33
+ """
34
+
35
+ __slots__ = ()
36
+
37
+
38
+ @attr.define(slots=True, kw_only=True)
39
+ class EmojiOption(ConverterOption[hikari.Emoji, ClientT, EmojiParams, str]):
40
+ """A slash command option that represents an emoji.
41
+
42
+ ??? hint
43
+ To add an option of this type to your command, add an argument to your command function with the following type hint:
44
+ ```py
45
+ opt_name: arc.Option[hikari.Emoji, EmojiParams(...)]
46
+ ```
47
+ """
48
+
49
+ @property
50
+ def option_type(self) -> OptionType:
51
+ return OptionType.EMOJI
52
+
53
+ def _convert_value(self, value: str) -> hikari.Emoji:
54
+ try:
55
+ return hikari.Emoji.parse(value)
56
+ except ValueError as exc:
57
+ raise OptionConverterFailureError(
58
+ self, value, f"Option '{self.name}' expected a valid color, got {value!r}."
59
+ ) from exc
60
+
61
+ @classmethod
62
+ def _from_params(
63
+ cls, *, name: str, arg_name: str, is_required: bool, params: EmojiParams, **kwargs: t.Any
64
+ ) -> te.Self:
65
+ return cls(
66
+ name=name,
67
+ arg_name=arg_name,
68
+ description=params.description,
69
+ is_required=is_required,
70
+ name_localizations=params.name_localizations,
71
+ description_localizations=params.description_localizations,
72
+ **kwargs,
73
+ )
74
+
75
+
76
+ # MIT License
77
+ #
78
+ # Copyright (c) 2023-present hypergonial
79
+ #
80
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
81
+ # of this software and associated documentation files (the "Software"), to deal
82
+ # in the Software without restriction, including without limitation the rights
83
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
84
+ # copies of the Software, and to permit persons to whom the Software is
85
+ # furnished to do so, subject to the following conditions:
86
+ #
87
+ # The above copyright notice and this permission notice shall be included in all
88
+ # copies or substantial portions of the Software.
89
+ #
90
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
91
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
92
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
93
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
94
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
95
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
96
+ # SOFTWARE.
@@ -110,8 +110,8 @@ class SlashCommand(CallableCommandBase[ClientT, hikari.api.SlashCommandBuilder])
110
110
  default_member_permissions=self.default_permissions,
111
111
  is_dm_enabled=self.is_dm_enabled,
112
112
  is_nsfw=self.is_nsfw,
113
- name_localizations=self.name_localizations, # pyright: ignore reportGeneralTypeIssues
114
- description_localizations=self.description_localizations, # pyright: ignore reportGeneralTypeIssues
113
+ name_localizations={str(key): value for key, value in self.name_localizations.items()},
114
+ description_localizations={str(key): value for key, value in self.description_localizations.items()},
115
115
  )
116
116
 
117
117
  async def invoke(
@@ -265,8 +265,8 @@ class SlashGroup(CommandBase[ClientT, hikari.api.SlashCommandBuilder]):
265
265
  default_member_permissions=self.default_permissions,
266
266
  is_dm_enabled=self.is_dm_enabled,
267
267
  is_nsfw=self.is_nsfw,
268
- name_localizations=self.name_localizations, # pyright: ignore reportGeneralTypeIssues
269
- description_localizations=self.description_localizations, # pyright: ignore reportGeneralTypeIssues
268
+ name_localizations={str(key): value for key, value in self.name_localizations.items()},
269
+ description_localizations={str(key): value for key, value in self.description_localizations.items()},
270
270
  )
271
271
 
272
272
  async def _invoke_subcmd(
@@ -291,7 +291,7 @@ class SlashGroup(CommandBase[ClientT, hikari.api.SlashCommandBuilder]):
291
291
  async def invoke(
292
292
  self, interaction: hikari.CommandInteraction, *args: t.Any, **kwargs: t.Any
293
293
  ) -> Future[ResponseBuilderT] | None:
294
- if interaction.options is None:
294
+ if not interaction.options:
295
295
  raise CommandInvokeError("Cannot invoke slash group with empty options.")
296
296
 
297
297
  # Get first-order subcommand
@@ -48,7 +48,7 @@ class UserCommand(CallableCommandBase[ClientT, hikari.api.ContextMenuCommandBuil
48
48
  default_member_permissions=self.default_permissions,
49
49
  is_dm_enabled=self.is_dm_enabled,
50
50
  is_nsfw=self.is_nsfw,
51
- name_localizations=self.name_localizations, # pyright: ignore reportGeneralTypeIssues
51
+ name_localizations={str(key): value for key, value in self.name_localizations.items()},
52
52
  )
53
53
 
54
54
  async def invoke(
@@ -107,8 +107,8 @@ class InteractionResponse:
107
107
 
108
108
  __slots__ = ("_context", "_message", "_delete_after_task")
109
109
 
110
- def __init__(self, context: Context[ClientT], message: hikari.Message | None = None) -> None:
111
- self._context: Context[ClientT] = context
110
+ def __init__(self, context: Context[t.Any], message: hikari.Message | None = None) -> None:
111
+ self._context: Context[t.Any] = context
112
112
  self._message: hikari.Message | None = message
113
113
  self._delete_after_task: asyncio.Task[None] | None = None
114
114
 
@@ -418,6 +418,9 @@ class Context(t.Generic[ClientT]):
418
418
  """Gets the channel this context represents, None if in a DM. Requires application cache."""
419
419
  return self._interaction.get_channel()
420
420
 
421
+ @t.overload
422
+ def get_option(self, name: str, opt_type: t.Literal[OptionType.EMOJI]) -> hikari.Emoji | None: ...
423
+
421
424
  @t.overload
422
425
  def get_option(self, name: str, opt_type: t.Literal[OptionType.COLOR]) -> hikari.Color | None: ...
423
426
 
@@ -5,7 +5,7 @@ __author_email__: t.Final[str] = "git@hypergonial.com"
5
5
  __maintainer__: t.Final[str] = "hypergonial"
6
6
  __license__: t.Final[str] = "MIT"
7
7
  __url__: t.Final[str] = "https://github.com/hypergonial/hikari-arc"
8
- __version__: t.Final[str] = "1.3.3"
8
+ __version__: t.Final[str] = "1.4.0"
9
9
 
10
10
  # MIT License
11
11
  #
@@ -23,6 +23,7 @@ OPTIONTYPE_TO_TYPE: dict[OptionType, type[t.Any]] = {
23
23
  OptionType.ATTACHMENT: hikari.Attachment,
24
24
  OptionType.COLOR: hikari.Color,
25
25
  OptionType.MEMBER: hikari.Member,
26
+ OptionType.EMOJI: hikari.Emoji,
26
27
  }
27
28
  """Used for runtime type checking in Context.get_option, not much else at the moment."""
28
29
 
@@ -17,6 +17,8 @@ from arc.command.option import (
17
17
  ChannelParams,
18
18
  ColorOption,
19
19
  ColorParams,
20
+ EmojiOption,
21
+ EmojiParams,
20
22
  FloatOption,
21
23
  FloatParams,
22
24
  IntOption,
@@ -53,6 +55,7 @@ TYPE_TO_OPTION_MAPPING: dict[type[t.Any], type[CommandOptionBase[t.Any, t.Any, t
53
55
  hikari.Member: MemberOption,
54
56
  hikari.InteractionMember: MemberOption,
55
57
  hikari.Color: ColorOption,
58
+ hikari.Emoji: EmojiOption,
56
59
  hikari.User: UserOption,
57
60
  }
58
61
 
@@ -68,6 +71,7 @@ OPT_TO_PARAMS_MAPPING: dict[type[CommandOptionBase[t.Any, t.Any, t.Any]], type[t
68
71
  AttachmentOption: AttachmentParams,
69
72
  MemberOption: MemberParams,
70
73
  ColorOption: ColorParams,
74
+ EmojiOption: EmojiParams,
71
75
  }
72
76
 
73
77
  BASE_CHANNEL_TYPE_MAP: dict[type[hikari.PartialChannel], hikari.ChannelType] = {
@@ -5,6 +5,7 @@ import typing as t
5
5
  import hikari
6
6
 
7
7
  from arc.abc.hookable import HookResult
8
+ from arc.context import Context # noqa: TCH001 Needed for DI to work
8
9
  from arc.errors import (
9
10
  BotMissingPermissionsError,
10
11
  DMOnlyError,
@@ -13,9 +14,6 @@ from arc.errors import (
13
14
  NotOwnerError,
14
15
  )
15
16
 
16
- if t.TYPE_CHECKING:
17
- from arc.context import Context
18
-
19
17
 
20
18
  def guild_only(ctx: Context[t.Any]) -> HookResult:
21
19
  """A pre-execution hook that aborts the execution of a command if it is invoked outside of a guild.
@@ -0,0 +1,2 @@
1
+ croniter==3.0.3
2
+ types-croniter==3.0.3.20240731
@@ -0,0 +1,7 @@
1
+ ruff==0.6.9
2
+ pyright==1.1.369
3
+ nox==2024.4.15
4
+ typing_extensions==4.12.2
5
+ pytest==8.3.2
6
+ pytest-asyncio==0.24.0
7
+ slotscheck==0.19.0
@@ -0,0 +1,6 @@
1
+ mkdocs-material[imaging]~=9.5.39
2
+ mkdocs~=1.6.0
3
+ mkdocstrings-python~=1.11.1
4
+ black~=24.8.0
5
+ griffe-inherited-docstrings~=1.0.1
6
+ mkdocs-glightbox~=0.4.0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hikari-arc
3
- Version: 1.3.3
3
+ Version: 1.4.0
4
4
  Summary: A command handler for hikari with a focus on type-safety and correctness.
5
5
  Home-page: https://github.com/hypergonial/hikari-arc
6
6
  Author: hypergonial
@@ -15,40 +15,49 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules
15
15
  Classifier: Programming Language :: Python :: 3.10
16
16
  Classifier: Programming Language :: Python :: 3.11
17
17
  Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
18
19
  Classifier: Programming Language :: Python :: Implementation :: CPython
19
20
  Classifier: Programming Language :: Python :: 3 :: Only
20
21
  Classifier: Topic :: Software Development :: Libraries
21
22
  Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
22
23
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
- Requires-Python: >=3.10.0,<3.13
24
+ Requires-Python: >=3.10.0,<3.14
24
25
  Description-Content-Type: text/markdown
25
26
  License-File: LICENSE
26
- Requires-Dist: hikari>=2.0.0.dev122
27
+ Requires-Dist: hikari>=2.0.0
27
28
  Requires-Dist: alluka<0.4,>=0.3.0
28
29
  Requires-Dist: attrs>=23.1
29
30
  Requires-Dist: colorama; sys_platform == "win32"
30
31
  Provides-Extra: docs
31
- Requires-Dist: mkdocs-material[imaging]~=9.5.24; extra == "docs"
32
+ Requires-Dist: mkdocs-material[imaging]~=9.5.39; extra == "docs"
32
33
  Requires-Dist: mkdocs~=1.6.0; extra == "docs"
33
- Requires-Dist: mkdocstrings-python~=1.10.3; extra == "docs"
34
- Requires-Dist: black~=24.4.2; extra == "docs"
35
- Requires-Dist: griffe-inherited-docstrings~=1.0.0; extra == "docs"
34
+ Requires-Dist: mkdocstrings-python~=1.11.1; extra == "docs"
35
+ Requires-Dist: black~=24.8.0; extra == "docs"
36
+ Requires-Dist: griffe-inherited-docstrings~=1.0.1; extra == "docs"
36
37
  Requires-Dist: mkdocs-glightbox~=0.4.0; extra == "docs"
37
38
  Provides-Extra: dev
38
- Requires-Dist: ruff==0.4.5; extra == "dev"
39
- Requires-Dist: pyright==1.1.364; extra == "dev"
39
+ Requires-Dist: ruff==0.6.9; extra == "dev"
40
+ Requires-Dist: pyright==1.1.369; extra == "dev"
40
41
  Requires-Dist: nox==2024.4.15; extra == "dev"
41
- Requires-Dist: typing_extensions==4.11.0; extra == "dev"
42
- Requires-Dist: pytest==8.2.1; extra == "dev"
43
- Requires-Dist: pytest-asyncio==0.23.7; extra == "dev"
42
+ Requires-Dist: typing_extensions==4.12.2; extra == "dev"
43
+ Requires-Dist: pytest==8.3.2; extra == "dev"
44
+ Requires-Dist: pytest-asyncio==0.24.0; extra == "dev"
44
45
  Requires-Dist: slotscheck==0.19.0; extra == "dev"
45
46
  Provides-Extra: rest
46
- Requires-Dist: hikari[server]>=2.0.0.dev122; extra == "rest"
47
+ Requires-Dist: hikari[server]>=2.0.0; extra == "rest"
47
48
  Provides-Extra: cron
48
- Requires-Dist: croniter==2.0.5; extra == "cron"
49
- Requires-Dist: types-croniter==2.0.0.20240423; extra == "cron"
49
+ Requires-Dist: croniter==3.0.3; extra == "cron"
50
+ Requires-Dist: types-croniter==3.0.3.20240731; extra == "cron"
50
51
 
51
- # hikari-arc
52
+ <div align="center">
53
+ <picture>
54
+ <source media="(prefers-color-scheme: dark)" srcset="./docs/assets/branding/composed-darkmode.svg">
55
+ <source media="(prefers-color-scheme: light)" srcset="./docs/assets/branding/composed-lightmode.svg">
56
+ <img alt="The arc logo" src="./docs/assets/branding/composed-lightmode.svg" width="30%">
57
+ </picture>
58
+ </div>
59
+
60
+ ---
52
61
 
53
62
  <div align="center">
54
63
 
@@ -120,6 +129,8 @@ See [Contributing](./CONTRIBUTING.md).
120
129
  - [`Tanjun`](https://github.com/FasterSpeeding/Tanjun) - For the idea of using `typing.Annotated` and [dependency injection](https://arc.hypergonial.com/guides/dependency_injection/) in a command handler. `arc` also uses the same dependency injection library, [`Alluka`](https://github.com/FasterSpeeding/Alluka), under the hood.
121
130
  - [`hikari-crescent`](https://github.com/hikari-crescent/hikari-crescent) The design of [hooks](https://arc.hypergonial.com/guides/hooks/) is largely inspired by `crescent`.
122
131
  - [`FastAPI`](https://github.com/tiangolo/fastapi) - Some design ideas and most of the [documentation](https://arc.hypergonial.com/) [configuration](https://github.com/hypergonial/hikari-arc/blob/main/mkdocs.yml) derives from `FastAPI`.
132
+ - The `arc` logo was made by [@PythonTryHard](https://github.com/PythonTryHard).
133
+
123
134
 
124
135
  ## Links
125
136
 
@@ -42,6 +42,7 @@ arc/command/option/str.py
42
42
  arc/command/option/user.py
43
43
  arc/command/option/custom/__init__.py
44
44
  arc/command/option/custom/color.py
45
+ arc/command/option/custom/emoji.py
45
46
  arc/command/option/custom/member.py
46
47
  arc/context/__init__.py
47
48
  arc/context/autocomplete.py
@@ -69,6 +70,7 @@ hikari_arc.egg-info/not-zip-safe
69
70
  hikari_arc.egg-info/requires.txt
70
71
  hikari_arc.egg-info/top_level.txt
71
72
  tests/test_client.py
73
+ tests/test_command.py
72
74
  tests/test_context_command.py
73
75
  tests/test_di.py
74
76
  tests/test_inheritance.py
@@ -0,0 +1,30 @@
1
+ hikari>=2.0.0
2
+ alluka<0.4,>=0.3.0
3
+ attrs>=23.1
4
+
5
+ [:sys_platform=="win32"]
6
+ colorama
7
+
8
+ [cron]
9
+ croniter==3.0.3
10
+ types-croniter==3.0.3.20240731
11
+
12
+ [dev]
13
+ ruff==0.6.9
14
+ pyright==1.1.369
15
+ nox==2024.4.15
16
+ typing_extensions==4.12.2
17
+ pytest==8.3.2
18
+ pytest-asyncio==0.24.0
19
+ slotscheck==0.19.0
20
+
21
+ [docs]
22
+ mkdocs-material[imaging]~=9.5.39
23
+ mkdocs~=1.6.0
24
+ mkdocstrings-python~=1.11.1
25
+ black~=24.8.0
26
+ griffe-inherited-docstrings~=1.0.1
27
+ mkdocs-glightbox~=0.4.0
28
+
29
+ [rest]
30
+ hikari[server]>=2.0.0
@@ -1,3 +1,3 @@
1
- hikari>=2.0.0.dev122
1
+ hikari>=2.0.0
2
2
  alluka>=0.3.0,<0.4
3
3
  attrs>=23.1
@@ -0,0 +1 @@
1
+ hikari[server]>=2.0.0
@@ -61,7 +61,7 @@ setup(
61
61
  "rest": parse_requirements_file("rest_requirements.txt"),
62
62
  "cron": parse_requirements_file("cron_requirements.txt"),
63
63
  },
64
- python_requires=">=3.10.0,<3.13",
64
+ python_requires=">=3.10.0,<3.14",
65
65
  classifiers=[
66
66
  "Development Status :: 5 - Production/Stable",
67
67
  "Framework :: AsyncIO",
@@ -71,6 +71,7 @@ setup(
71
71
  "Programming Language :: Python :: 3.10",
72
72
  "Programming Language :: Python :: 3.11",
73
73
  "Programming Language :: Python :: 3.12",
74
+ "Programming Language :: Python :: 3.13",
74
75
  "Programming Language :: Python :: Implementation :: CPython",
75
76
  "Programming Language :: Python :: 3 :: Only",
76
77
  "Topic :: Software Development :: Libraries",