hikari-arc 1.3.4__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.
- {hikari_arc-1.3.4/hikari_arc.egg-info → hikari_arc-1.4.0}/PKG-INFO +27 -16
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/README.md +11 -1
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/arc/__init__.py +2 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/arc/abc/client.py +1 -1
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/arc/abc/option.py +5 -2
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/arc/command/__init__.py +4 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/arc/command/message.py +1 -1
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/arc/command/option/__init__.py +12 -1
- hikari_arc-1.4.0/arc/command/option/custom/__init__.py +14 -0
- hikari_arc-1.4.0/arc/command/option/custom/emoji.py +96 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/arc/command/slash.py +5 -5
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/arc/command/user.py +1 -1
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/arc/context/base.py +5 -2
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/arc/internal/about.py +1 -1
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/arc/internal/options.py +1 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/arc/internal/sigparse.py +4 -0
- hikari_arc-1.4.0/cron_requirements.txt +2 -0
- hikari_arc-1.4.0/dev_requirements.txt +7 -0
- hikari_arc-1.4.0/doc_requirements.txt +6 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0/hikari_arc.egg-info}/PKG-INFO +27 -16
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/hikari_arc.egg-info/SOURCES.txt +1 -0
- hikari_arc-1.4.0/hikari_arc.egg-info/requires.txt +30 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/requirements.txt +1 -1
- hikari_arc-1.4.0/rest_requirements.txt +1 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/setup.py +2 -1
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/tests/test_command.py +61 -3
- hikari_arc-1.3.4/arc/command/option/custom/__init__.py +0 -4
- hikari_arc-1.3.4/cron_requirements.txt +0 -2
- hikari_arc-1.3.4/dev_requirements.txt +0 -7
- hikari_arc-1.3.4/doc_requirements.txt +0 -6
- hikari_arc-1.3.4/hikari_arc.egg-info/requires.txt +0 -30
- hikari_arc-1.3.4/rest_requirements.txt +0 -1
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/LICENSE +0 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/MANIFEST.in +0 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/arc/__main__.py +0 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/arc/abc/__init__.py +0 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/arc/abc/command.py +0 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/arc/abc/concurrency_limiting.py +0 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/arc/abc/error_handler.py +0 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/arc/abc/hookable.py +0 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/arc/abc/limiter.py +0 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/arc/abc/plugin.py +0 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/arc/client.py +0 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/arc/command/option/attachment.py +0 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/arc/command/option/bool.py +0 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/arc/command/option/channel.py +0 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/arc/command/option/custom/color.py +0 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/arc/command/option/custom/member.py +0 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/arc/command/option/float.py +0 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/arc/command/option/int.py +0 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/arc/command/option/mentionable.py +0 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/arc/command/option/role.py +0 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/arc/command/option/str.py +0 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/arc/command/option/user.py +0 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/arc/context/__init__.py +0 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/arc/context/autocomplete.py +0 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/arc/errors.py +0 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/arc/events.py +0 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/arc/ext/__init__.py +0 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/arc/extension.py +0 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/arc/internal/__init__.py +0 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/arc/internal/deprecation.py +0 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/arc/internal/sync.py +0 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/arc/internal/types.py +0 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/arc/internal/version.py +0 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/arc/locale.py +0 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/arc/plugin.py +0 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/arc/py.typed +0 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/arc/utils/__init__.py +0 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/arc/utils/concurrency_limiter.py +0 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/arc/utils/hooks/__init__.py +0 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/arc/utils/hooks/basic.py +0 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/arc/utils/hooks/limiters.py +0 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/arc/utils/loops.py +0 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/arc/utils/ratelimiter.py +0 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/hikari_arc.egg-info/dependency_links.txt +0 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/hikari_arc.egg-info/not-zip-safe +0 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/hikari_arc.egg-info/top_level.txt +0 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/pyproject.toml +0 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/setup.cfg +0 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/tests/test_client.py +0 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/tests/test_context_command.py +0 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/tests/test_di.py +0 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/tests/test_inheritance.py +0 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/tests/test_options.py +0 -0
- {hikari_arc-1.3.4 → hikari_arc-1.4.0}/tests/test_sigparse.py +0 -0
- {hikari_arc-1.3.4 → 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
|
+
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.
|
|
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
|
|
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.
|
|
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.
|
|
34
|
-
Requires-Dist: black~=24.
|
|
35
|
-
Requires-Dist: griffe-inherited-docstrings~=1.0.
|
|
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.
|
|
39
|
-
Requires-Dist: pyright==1.1.
|
|
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.12.
|
|
42
|
-
Requires-Dist: pytest==8.2
|
|
43
|
-
Requires-Dist: pytest-asyncio==0.
|
|
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
|
|
47
|
+
Requires-Dist: hikari[server]>=2.0.0; extra == "rest"
|
|
47
48
|
Provides-Extra: cron
|
|
48
|
-
Requires-Dist: croniter==
|
|
49
|
-
Requires-Dist: types-croniter==
|
|
49
|
+
Requires-Dist: croniter==3.0.3; extra == "cron"
|
|
50
|
+
Requires-Dist: types-croniter==3.0.3.20240731; extra == "cron"
|
|
50
51
|
|
|
51
|
-
|
|
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
|
-
|
|
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",
|
|
@@ -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.
|
|
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,
|
|
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
|
|
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,
|
|
114
|
-
description_localizations=self.description_localizations,
|
|
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,
|
|
269
|
-
description_localizations=self.description_localizations,
|
|
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
|
|
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,
|
|
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[
|
|
111
|
-
self._context: 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.
|
|
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] = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: hikari-arc
|
|
3
|
-
Version: 1.
|
|
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.
|
|
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
|
|
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.
|
|
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.
|
|
34
|
-
Requires-Dist: black~=24.
|
|
35
|
-
Requires-Dist: griffe-inherited-docstrings~=1.0.
|
|
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.
|
|
39
|
-
Requires-Dist: pyright==1.1.
|
|
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.12.
|
|
42
|
-
Requires-Dist: pytest==8.2
|
|
43
|
-
Requires-Dist: pytest-asyncio==0.
|
|
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
|
|
47
|
+
Requires-Dist: hikari[server]>=2.0.0; extra == "rest"
|
|
47
48
|
Provides-Extra: cron
|
|
48
|
-
Requires-Dist: croniter==
|
|
49
|
-
Requires-Dist: types-croniter==
|
|
49
|
+
Requires-Dist: croniter==3.0.3; extra == "cron"
|
|
50
|
+
Requires-Dist: types-croniter==3.0.3.20240731; extra == "cron"
|
|
50
51
|
|
|
51
|
-
|
|
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
|
|
@@ -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
|
|
@@ -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.
|
|
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",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import datetime
|
|
2
|
+
import typing as t
|
|
2
3
|
|
|
3
4
|
import hikari
|
|
4
5
|
import pytest
|
|
@@ -55,6 +56,25 @@ def build_member(
|
|
|
55
56
|
permissions=permissions or hikari.Permissions.NONE,
|
|
56
57
|
premium_since=None,
|
|
57
58
|
user=build_user(app, id),
|
|
59
|
+
guild_flags=hikari.GuildMemberFlags.NONE,
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def build_resolved(
|
|
64
|
+
members: dict[hikari.Snowflake, hikari.InteractionMember] | None = None,
|
|
65
|
+
roles: dict[hikari.Snowflake, hikari.Role] | None = None,
|
|
66
|
+
channels: dict[hikari.Snowflake, hikari.InteractionChannel] | None = None,
|
|
67
|
+
users: dict[hikari.Snowflake, hikari.User] | None = None,
|
|
68
|
+
attachments: dict[hikari.Snowflake, hikari.Attachment] | None = None,
|
|
69
|
+
messages: dict[hikari.Snowflake, hikari.Message] | None = None,
|
|
70
|
+
) -> hikari.ResolvedOptionData:
|
|
71
|
+
return hikari.ResolvedOptionData(
|
|
72
|
+
members=members or {},
|
|
73
|
+
roles=roles or {},
|
|
74
|
+
channels=channels or {},
|
|
75
|
+
users=users or {},
|
|
76
|
+
attachments=attachments or {},
|
|
77
|
+
messages=messages or {},
|
|
58
78
|
)
|
|
59
79
|
|
|
60
80
|
|
|
@@ -62,7 +82,7 @@ def build_inter(
|
|
|
62
82
|
app: hikari.GatewayBot,
|
|
63
83
|
*,
|
|
64
84
|
cmd_name: str,
|
|
65
|
-
options:
|
|
85
|
+
options: t.Sequence[hikari.CommandInteractionOption] | None = None,
|
|
66
86
|
resolved: hikari.ResolvedOptionData | None = None,
|
|
67
87
|
author_id: hikari.Snowflakeish = 123456789,
|
|
68
88
|
author_role_ids: list[hikari.Snowflake] | None = None,
|
|
@@ -100,11 +120,12 @@ def build_inter(
|
|
|
100
120
|
id=hikari.Snowflake(123456789),
|
|
101
121
|
application_id=hikari.Snowflake(123456789),
|
|
102
122
|
command_id=hikari.Snowflake(123456789),
|
|
123
|
+
registered_guild_id=hikari.Snowflake(123456789),
|
|
103
124
|
command_name=parts[0],
|
|
104
125
|
command_type=hikari.CommandType.SLASH,
|
|
105
126
|
entitlements=[],
|
|
106
127
|
app_permissions=hikari.Permissions.all_permissions(),
|
|
107
|
-
options=options,
|
|
128
|
+
options=options or [],
|
|
108
129
|
resolved=resolved,
|
|
109
130
|
type=hikari.InteractionType.APPLICATION_COMMAND,
|
|
110
131
|
token="padoru padoru",
|
|
@@ -113,7 +134,7 @@ def build_inter(
|
|
|
113
134
|
guild_id=hikari.Snowflake(123456789),
|
|
114
135
|
guild_locale="en-US",
|
|
115
136
|
user=build_user(app, author_id),
|
|
116
|
-
member=build_member(app, author_id, role_ids=author_role_ids, permissions=author_perms),
|
|
137
|
+
member=build_member(app, author_id, role_ids=author_role_ids or [], permissions=author_perms),
|
|
117
138
|
locale="en-US",
|
|
118
139
|
)
|
|
119
140
|
|
|
@@ -223,6 +244,20 @@ async def plugin_error_handler(ctx: MockContext, error: Exception) -> None:
|
|
|
223
244
|
raise error
|
|
224
245
|
|
|
225
246
|
|
|
247
|
+
@client.include
|
|
248
|
+
@arc.slash_command("converters")
|
|
249
|
+
async def converters(
|
|
250
|
+
ctx: MockContext,
|
|
251
|
+
user: arc.Option[hikari.Member, arc.MemberParams()],
|
|
252
|
+
color: arc.Option[hikari.Color, arc.ColorParams()],
|
|
253
|
+
emoji: arc.Option[hikari.Emoji, arc.EmojiParams()],
|
|
254
|
+
) -> None:
|
|
255
|
+
assert isinstance(user, hikari.InteractionMember)
|
|
256
|
+
assert isinstance(color, hikari.Color)
|
|
257
|
+
assert isinstance(emoji, hikari.Emoji)
|
|
258
|
+
await ctx.respond("All is well!")
|
|
259
|
+
|
|
260
|
+
|
|
226
261
|
@pytest.mark.asyncio
|
|
227
262
|
async def test_ping(app: hikari.GatewayBot) -> None:
|
|
228
263
|
response = await client.push_inter(build_inter(app, cmd_name="ping"))
|
|
@@ -317,3 +352,26 @@ async def test_nested_errhandler_unhandled(app: hikari.GatewayBot) -> None:
|
|
|
317
352
|
response = await client.push_inter(inter)
|
|
318
353
|
assert isinstance(response, hikari.impl.InteractionMessageBuilder)
|
|
319
354
|
assert response.content == "❌ Something went wrong. Please contact the bot developer."
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
@pytest.mark.asyncio
|
|
358
|
+
async def test_converters(app: hikari.GatewayBot) -> None:
|
|
359
|
+
inter = build_inter(
|
|
360
|
+
app,
|
|
361
|
+
cmd_name="converters",
|
|
362
|
+
resolved=build_resolved(members={hikari.Snowflake(123456789): build_member(app, 123456789)}),
|
|
363
|
+
options=[
|
|
364
|
+
hikari.CommandInteractionOption(
|
|
365
|
+
name="user", type=hikari.OptionType.USER, value=hikari.Snowflake(123456789), options=None
|
|
366
|
+
),
|
|
367
|
+
hikari.CommandInteractionOption(
|
|
368
|
+
name="color", type=hikari.OptionType.STRING, value="123 123 123", options=None
|
|
369
|
+
),
|
|
370
|
+
hikari.CommandInteractionOption(
|
|
371
|
+
name="emoji", type=hikari.OptionType.STRING, value="<:padoru:123456789>", options=None
|
|
372
|
+
),
|
|
373
|
+
],
|
|
374
|
+
)
|
|
375
|
+
response = await client.push_inter(inter)
|
|
376
|
+
assert isinstance(response, hikari.impl.InteractionMessageBuilder)
|
|
377
|
+
assert response.content == "All is well!"
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
hikari>=2.0.0.dev122
|
|
2
|
-
alluka<0.4,>=0.3.0
|
|
3
|
-
attrs>=23.1
|
|
4
|
-
|
|
5
|
-
[:sys_platform=="win32"]
|
|
6
|
-
colorama
|
|
7
|
-
|
|
8
|
-
[cron]
|
|
9
|
-
croniter==2.0.5
|
|
10
|
-
types-croniter==2.0.0.20240423
|
|
11
|
-
|
|
12
|
-
[dev]
|
|
13
|
-
ruff==0.4.6
|
|
14
|
-
pyright==1.1.365
|
|
15
|
-
nox==2024.4.15
|
|
16
|
-
typing_extensions==4.12.0
|
|
17
|
-
pytest==8.2.1
|
|
18
|
-
pytest-asyncio==0.23.7
|
|
19
|
-
slotscheck==0.19.0
|
|
20
|
-
|
|
21
|
-
[docs]
|
|
22
|
-
mkdocs-material[imaging]~=9.5.25
|
|
23
|
-
mkdocs~=1.6.0
|
|
24
|
-
mkdocstrings-python~=1.10.3
|
|
25
|
-
black~=24.4.2
|
|
26
|
-
griffe-inherited-docstrings~=1.0.0
|
|
27
|
-
mkdocs-glightbox~=0.4.0
|
|
28
|
-
|
|
29
|
-
[rest]
|
|
30
|
-
hikari[server]>=2.0.0.dev122
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
hikari[server]>=2.0.0.dev122
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|