hyper-bot 2.0.0__tar.gz → 2.0.1__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.
- {hyper_bot-2.0.0/src/hyper_bot.egg-info → hyper_bot-2.0.1}/PKG-INFO +1 -1
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/pyproject.toml +1 -1
- {hyper_bot-2.0.0 → hyper_bot-2.0.1/src/hyper_bot.egg-info}/PKG-INFO +1 -1
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyper_bot.egg-info/SOURCES.txt +1 -1
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/v2/__init__.py +7 -13
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/v2/actions/models.py +35 -35
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/v2/actions/result.py +9 -9
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/v2/api/base.py +20 -20
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/v2/common/__init__.py +0 -20
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/v2/common/models.py +2 -3
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/v2/events/base.py +4 -4
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/v2/events/models.py +30 -30
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/v2/messages/__init__.py +4 -0
- hyper_bot-2.0.1/src/hyperot/v2/messages/registry.py +73 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/v2/messages/segments.py +68 -43
- hyper_bot-2.0.0/src/hyperot/v2/common/ids.py +0 -11
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/LICENSE +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/readme.md +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/setup.cfg +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyper_bot.egg-info/dependency_links.txt +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyper_bot.egg-info/requires.txt +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyper_bot.egg-info/top_level.txt +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/__init__.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/adapters/__init__.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/adapters/milky/__init__.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/adapters/milky/actions.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/adapters/milky/listener.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/adapters/milky/packet.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/adapters/milky/translator.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/adapters/onebot/__init__.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/adapters/onebot/actions.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/adapters/onebot/listener.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/adapters/onebot/packet.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/common.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/configurator.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/events.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/hyperogger.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/listener.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/network.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/protocol/__init__.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/protocol/actions.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/protocol/builder.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/protocol/listener.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/protocol/segments.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/segments.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/utils/__init__.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/utils/apiresponse.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/utils/ark_sign_helper.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/utils/errors.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/utils/hypetyping.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/utils/screens.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/utils/typextensions.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/v2/actions/__init__.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/v2/actions/base.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/v2/actions/formatting.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/v2/adapter/__init__.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/v2/adapter/loader.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/v2/adapter/manifest.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/v2/adapter/protocol.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/v2/adapter/registry.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/v2/api/__init__.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/v2/api/context.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/v2/client/__init__.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/v2/client/client.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/v2/client/executor.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/v2/client/runtime.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/v2/common/enums.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/v2/common/errors.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/v2/config/__init__.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/v2/config/loader.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/v2/config/models.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/v2/events/__init__.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/v2/events/dispatcher.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/v2/events/formatting.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/v2/hyperogger.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/v2/logging.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/src/hyperot/v2/style.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/tests/test_configurator.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/tests/test_events.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/tests/test_listener.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/tests/test_milky.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/tests/test_network.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/tests/test_onebot.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/tests/test_registry.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/tests/test_segments.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/tests/test_utils.py +0 -0
- {hyper_bot-2.0.0 → hyper_bot-2.0.1}/tests/test_version.py +0 -0
|
@@ -60,7 +60,6 @@ src/hyperot/v2/client/runtime.py
|
|
|
60
60
|
src/hyperot/v2/common/__init__.py
|
|
61
61
|
src/hyperot/v2/common/enums.py
|
|
62
62
|
src/hyperot/v2/common/errors.py
|
|
63
|
-
src/hyperot/v2/common/ids.py
|
|
64
63
|
src/hyperot/v2/common/models.py
|
|
65
64
|
src/hyperot/v2/config/__init__.py
|
|
66
65
|
src/hyperot/v2/config/loader.py
|
|
@@ -71,6 +70,7 @@ src/hyperot/v2/events/dispatcher.py
|
|
|
71
70
|
src/hyperot/v2/events/formatting.py
|
|
72
71
|
src/hyperot/v2/events/models.py
|
|
73
72
|
src/hyperot/v2/messages/__init__.py
|
|
73
|
+
src/hyperot/v2/messages/registry.py
|
|
74
74
|
src/hyperot/v2/messages/segments.py
|
|
75
75
|
tests/test_configurator.py
|
|
76
76
|
tests/test_events.py
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
from .api import ClientAPI
|
|
2
2
|
from .client import Client
|
|
3
3
|
from .common import (
|
|
4
|
-
FileId,
|
|
5
|
-
GroupId,
|
|
6
4
|
MemberRole,
|
|
7
|
-
MessageId,
|
|
8
|
-
RequestId,
|
|
9
|
-
SceneId,
|
|
10
5
|
SceneType,
|
|
11
|
-
UserId,
|
|
12
6
|
)
|
|
13
7
|
from .events import (
|
|
14
8
|
BotOfflineEvent,
|
|
@@ -32,12 +26,15 @@ from .messages import (
|
|
|
32
26
|
Message,
|
|
33
27
|
Quote,
|
|
34
28
|
Segment,
|
|
29
|
+
SegmentDecoder,
|
|
30
|
+
SegmentEncoder,
|
|
31
|
+
SegmentRegistry,
|
|
35
32
|
Text,
|
|
36
33
|
UnknownSegment,
|
|
37
34
|
Video,
|
|
38
35
|
)
|
|
39
36
|
|
|
40
|
-
__version__ = "2.0.
|
|
37
|
+
__version__ = "2.0.1"
|
|
41
38
|
|
|
42
39
|
__all__ = [
|
|
43
40
|
"Audio",
|
|
@@ -50,26 +47,23 @@ __all__ = [
|
|
|
50
47
|
"Event",
|
|
51
48
|
"Face",
|
|
52
49
|
"File",
|
|
53
|
-
"FileId",
|
|
54
50
|
"Forward",
|
|
55
51
|
"ForwardNode",
|
|
56
|
-
"GroupId",
|
|
57
52
|
"Image",
|
|
58
53
|
"Markdown",
|
|
59
54
|
"MemberRole",
|
|
60
55
|
"Mention",
|
|
61
56
|
"MentionAll",
|
|
62
57
|
"Message",
|
|
63
|
-
"MessageId",
|
|
64
58
|
"MessageReceivedEvent",
|
|
65
59
|
"Quote",
|
|
66
|
-
"RequestId",
|
|
67
60
|
"SceneEvent",
|
|
68
|
-
"SceneId",
|
|
69
61
|
"SceneType",
|
|
70
62
|
"Segment",
|
|
63
|
+
"SegmentDecoder",
|
|
64
|
+
"SegmentEncoder",
|
|
65
|
+
"SegmentRegistry",
|
|
71
66
|
"Text",
|
|
72
67
|
"UnknownSegment",
|
|
73
|
-
"UserId",
|
|
74
68
|
"Video",
|
|
75
69
|
]
|
|
@@ -3,7 +3,7 @@ from typing import ClassVar
|
|
|
3
3
|
from pydantic import Field, JsonValue
|
|
4
4
|
from typing_extensions import override
|
|
5
5
|
|
|
6
|
-
from ..common import
|
|
6
|
+
from ..common import MemberRole, SceneType
|
|
7
7
|
from ..messages import Message
|
|
8
8
|
from .base import Action
|
|
9
9
|
from .formatting import format_actor, format_message, format_preview, format_scene, format_text, format_value
|
|
@@ -38,7 +38,7 @@ class RawAction(Action[RawResult]):
|
|
|
38
38
|
|
|
39
39
|
class SendMessageAction(Action[SendResult]):
|
|
40
40
|
scene_type: SceneType
|
|
41
|
-
scene_id:
|
|
41
|
+
scene_id: str
|
|
42
42
|
message: Message
|
|
43
43
|
|
|
44
44
|
@override
|
|
@@ -47,7 +47,7 @@ class SendMessageAction(Action[SendResult]):
|
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
class RecallMessageAction(Action[None]):
|
|
50
|
-
message_id:
|
|
50
|
+
message_id: str
|
|
51
51
|
|
|
52
52
|
@override
|
|
53
53
|
def log_summary(self) -> str:
|
|
@@ -56,7 +56,7 @@ class RecallMessageAction(Action[None]):
|
|
|
56
56
|
|
|
57
57
|
class FetchMessageAction(Action[Message]):
|
|
58
58
|
log_level: ClassVar[str] = "TRACE"
|
|
59
|
-
message_id:
|
|
59
|
+
message_id: str
|
|
60
60
|
|
|
61
61
|
@override
|
|
62
62
|
def log_summary(self) -> str:
|
|
@@ -89,7 +89,7 @@ class GetVersionAction(Action[VersionInfo]):
|
|
|
89
89
|
|
|
90
90
|
class GetUserProfileAction(Action[UserProfile]):
|
|
91
91
|
log_level: ClassVar[str] = "TRACE"
|
|
92
|
-
user_id:
|
|
92
|
+
user_id: str
|
|
93
93
|
|
|
94
94
|
@override
|
|
95
95
|
def log_summary(self) -> str:
|
|
@@ -106,7 +106,7 @@ class GetFriendListAction(Action[list[FriendInfo]]):
|
|
|
106
106
|
|
|
107
107
|
class GetGroupProfileAction(Action[GroupProfile]):
|
|
108
108
|
log_level: ClassVar[str] = "TRACE"
|
|
109
|
-
group_id:
|
|
109
|
+
group_id: str
|
|
110
110
|
|
|
111
111
|
@override
|
|
112
112
|
def log_summary(self) -> str:
|
|
@@ -123,8 +123,8 @@ class GetGroupListAction(Action[list[GroupProfile]]):
|
|
|
123
123
|
|
|
124
124
|
class GetGroupMemberAction(Action[GroupMemberProfile]):
|
|
125
125
|
log_level: ClassVar[str] = "TRACE"
|
|
126
|
-
group_id:
|
|
127
|
-
user_id:
|
|
126
|
+
group_id: str
|
|
127
|
+
user_id: str
|
|
128
128
|
|
|
129
129
|
@override
|
|
130
130
|
def log_summary(self) -> str:
|
|
@@ -133,7 +133,7 @@ class GetGroupMemberAction(Action[GroupMemberProfile]):
|
|
|
133
133
|
|
|
134
134
|
class GetGroupMemberListAction(Action[list[GroupMemberProfile]]):
|
|
135
135
|
log_level: ClassVar[str] = "TRACE"
|
|
136
|
-
group_id:
|
|
136
|
+
group_id: str
|
|
137
137
|
|
|
138
138
|
@override
|
|
139
139
|
def log_summary(self) -> str:
|
|
@@ -141,8 +141,8 @@ class GetGroupMemberListAction(Action[list[GroupMemberProfile]]):
|
|
|
141
141
|
|
|
142
142
|
|
|
143
143
|
class KickMemberAction(Action[None]):
|
|
144
|
-
group_id:
|
|
145
|
-
user_id:
|
|
144
|
+
group_id: str
|
|
145
|
+
user_id: str
|
|
146
146
|
|
|
147
147
|
@override
|
|
148
148
|
def log_summary(self) -> str:
|
|
@@ -150,8 +150,8 @@ class KickMemberAction(Action[None]):
|
|
|
150
150
|
|
|
151
151
|
|
|
152
152
|
class MuteMemberAction(Action[None]):
|
|
153
|
-
group_id:
|
|
154
|
-
user_id:
|
|
153
|
+
group_id: str
|
|
154
|
+
user_id: str
|
|
155
155
|
duration: int
|
|
156
156
|
|
|
157
157
|
@override
|
|
@@ -160,8 +160,8 @@ class MuteMemberAction(Action[None]):
|
|
|
160
160
|
|
|
161
161
|
|
|
162
162
|
class UnmuteMemberAction(Action[None]):
|
|
163
|
-
group_id:
|
|
164
|
-
user_id:
|
|
163
|
+
group_id: str
|
|
164
|
+
user_id: str
|
|
165
165
|
|
|
166
166
|
@override
|
|
167
167
|
def log_summary(self) -> str:
|
|
@@ -169,8 +169,8 @@ class UnmuteMemberAction(Action[None]):
|
|
|
169
169
|
|
|
170
170
|
|
|
171
171
|
class SetMemberRoleAction(Action[None]):
|
|
172
|
-
group_id:
|
|
173
|
-
user_id:
|
|
172
|
+
group_id: str
|
|
173
|
+
user_id: str
|
|
174
174
|
role: MemberRole
|
|
175
175
|
|
|
176
176
|
@override
|
|
@@ -181,8 +181,8 @@ class SetMemberRoleAction(Action[None]):
|
|
|
181
181
|
|
|
182
182
|
|
|
183
183
|
class SetMemberTitleAction(Action[None]):
|
|
184
|
-
group_id:
|
|
185
|
-
user_id:
|
|
184
|
+
group_id: str
|
|
185
|
+
user_id: str
|
|
186
186
|
title: str
|
|
187
187
|
|
|
188
188
|
@override
|
|
@@ -194,8 +194,8 @@ class SetMemberTitleAction(Action[None]):
|
|
|
194
194
|
|
|
195
195
|
|
|
196
196
|
class SetMemberCardAction(Action[None]):
|
|
197
|
-
group_id:
|
|
198
|
-
user_id:
|
|
197
|
+
group_id: str
|
|
198
|
+
user_id: str
|
|
199
199
|
card: str
|
|
200
200
|
|
|
201
201
|
@override
|
|
@@ -206,7 +206,7 @@ class SetMemberCardAction(Action[None]):
|
|
|
206
206
|
|
|
207
207
|
|
|
208
208
|
class SetGroupNameAction(Action[None]):
|
|
209
|
-
group_id:
|
|
209
|
+
group_id: str
|
|
210
210
|
name: str
|
|
211
211
|
|
|
212
212
|
@override
|
|
@@ -215,7 +215,7 @@ class SetGroupNameAction(Action[None]):
|
|
|
215
215
|
|
|
216
216
|
|
|
217
217
|
class SetGroupMuteAction(Action[None]):
|
|
218
|
-
group_id:
|
|
218
|
+
group_id: str
|
|
219
219
|
muted: bool
|
|
220
220
|
|
|
221
221
|
@override
|
|
@@ -225,7 +225,7 @@ class SetGroupMuteAction(Action[None]):
|
|
|
225
225
|
|
|
226
226
|
|
|
227
227
|
class LeaveGroupAction(Action[None]):
|
|
228
|
-
group_id:
|
|
228
|
+
group_id: str
|
|
229
229
|
|
|
230
230
|
@override
|
|
231
231
|
def log_summary(self) -> str:
|
|
@@ -233,7 +233,7 @@ class LeaveGroupAction(Action[None]):
|
|
|
233
233
|
|
|
234
234
|
|
|
235
235
|
class ReactMessageAction(Action[None]):
|
|
236
|
-
message_id:
|
|
236
|
+
message_id: str
|
|
237
237
|
reaction: str
|
|
238
238
|
enabled: bool = True
|
|
239
239
|
|
|
@@ -244,7 +244,7 @@ class ReactMessageAction(Action[None]):
|
|
|
244
244
|
|
|
245
245
|
|
|
246
246
|
class SetEssenceAction(Action[None]):
|
|
247
|
-
message_id:
|
|
247
|
+
message_id: str
|
|
248
248
|
enabled: bool = True
|
|
249
249
|
|
|
250
250
|
@override
|
|
@@ -255,8 +255,8 @@ class SetEssenceAction(Action[None]):
|
|
|
255
255
|
|
|
256
256
|
class PokeAction(Action[None]):
|
|
257
257
|
scene_type: SceneType
|
|
258
|
-
scene_id:
|
|
259
|
-
user_id:
|
|
258
|
+
scene_id: str
|
|
259
|
+
user_id: str
|
|
260
260
|
|
|
261
261
|
@override
|
|
262
262
|
def log_summary(self) -> str:
|
|
@@ -264,7 +264,7 @@ class PokeAction(Action[None]):
|
|
|
264
264
|
|
|
265
265
|
|
|
266
266
|
class ApproveFriendRequestAction(Action[None]):
|
|
267
|
-
request_id:
|
|
267
|
+
request_id: str
|
|
268
268
|
|
|
269
269
|
@override
|
|
270
270
|
def log_summary(self) -> str:
|
|
@@ -272,7 +272,7 @@ class ApproveFriendRequestAction(Action[None]):
|
|
|
272
272
|
|
|
273
273
|
|
|
274
274
|
class RejectFriendRequestAction(Action[None]):
|
|
275
|
-
request_id:
|
|
275
|
+
request_id: str
|
|
276
276
|
reason: str | None = None
|
|
277
277
|
|
|
278
278
|
@override
|
|
@@ -282,7 +282,7 @@ class RejectFriendRequestAction(Action[None]):
|
|
|
282
282
|
|
|
283
283
|
|
|
284
284
|
class ApproveGroupRequestAction(Action[None]):
|
|
285
|
-
request_id:
|
|
285
|
+
request_id: str
|
|
286
286
|
|
|
287
287
|
@override
|
|
288
288
|
def log_summary(self) -> str:
|
|
@@ -290,7 +290,7 @@ class ApproveGroupRequestAction(Action[None]):
|
|
|
290
290
|
|
|
291
291
|
|
|
292
292
|
class RejectGroupRequestAction(Action[None]):
|
|
293
|
-
request_id:
|
|
293
|
+
request_id: str
|
|
294
294
|
reason: str | None = None
|
|
295
295
|
|
|
296
296
|
@override
|
|
@@ -301,7 +301,7 @@ class RejectGroupRequestAction(Action[None]):
|
|
|
301
301
|
|
|
302
302
|
class GetFileInfoAction(Action[FileReference]):
|
|
303
303
|
log_level: ClassVar[str] = "TRACE"
|
|
304
|
-
file_id:
|
|
304
|
+
file_id: str
|
|
305
305
|
|
|
306
306
|
@override
|
|
307
307
|
def log_summary(self) -> str:
|
|
@@ -310,7 +310,7 @@ class GetFileInfoAction(Action[FileReference]):
|
|
|
310
310
|
|
|
311
311
|
class DownloadFileAction(Action[FileUrl]):
|
|
312
312
|
log_level: ClassVar[str] = "TRACE"
|
|
313
|
-
file_id:
|
|
313
|
+
file_id: str
|
|
314
314
|
|
|
315
315
|
@override
|
|
316
316
|
def log_summary(self) -> str:
|
|
@@ -318,7 +318,7 @@ class DownloadFileAction(Action[FileUrl]):
|
|
|
318
318
|
|
|
319
319
|
|
|
320
320
|
class SendLikeAction(Action[None]):
|
|
321
|
-
user_id:
|
|
321
|
+
user_id: str
|
|
322
322
|
times: int = 1
|
|
323
323
|
|
|
324
324
|
@override
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from pydantic import BaseModel, ConfigDict, JsonValue
|
|
2
2
|
from typing_extensions import override
|
|
3
3
|
|
|
4
|
-
from ..common import
|
|
4
|
+
from ..common import MemberRole
|
|
5
5
|
from ..messages import Message
|
|
6
6
|
from .formatting import format_actor, format_message, format_text, format_url, format_value
|
|
7
7
|
|
|
@@ -14,7 +14,7 @@ class ResultModel(BaseModel):
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
class SendResult(ResultModel):
|
|
17
|
-
message_id:
|
|
17
|
+
message_id: str
|
|
18
18
|
|
|
19
19
|
@override
|
|
20
20
|
def log_summary(self) -> str:
|
|
@@ -22,7 +22,7 @@ class SendResult(ResultModel):
|
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
class UserProfile(ResultModel):
|
|
25
|
-
user_id:
|
|
25
|
+
user_id: str
|
|
26
26
|
display_name: str | None = None
|
|
27
27
|
sex: str | None = None
|
|
28
28
|
age: int | None = None
|
|
@@ -39,7 +39,7 @@ class UserProfile(ResultModel):
|
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
class FriendInfo(ResultModel):
|
|
42
|
-
user_id:
|
|
42
|
+
user_id: str
|
|
43
43
|
display_name: str | None = None
|
|
44
44
|
|
|
45
45
|
@override
|
|
@@ -48,7 +48,7 @@ class FriendInfo(ResultModel):
|
|
|
48
48
|
|
|
49
49
|
|
|
50
50
|
class GroupProfile(ResultModel):
|
|
51
|
-
group_id:
|
|
51
|
+
group_id: str
|
|
52
52
|
name: str
|
|
53
53
|
member_count: int | None = None
|
|
54
54
|
max_member_count: int | None = None
|
|
@@ -66,8 +66,8 @@ class GroupProfile(ResultModel):
|
|
|
66
66
|
|
|
67
67
|
|
|
68
68
|
class GroupMemberProfile(ResultModel):
|
|
69
|
-
group_id:
|
|
70
|
-
user_id:
|
|
69
|
+
group_id: str
|
|
70
|
+
user_id: str
|
|
71
71
|
display_name: str | None = None
|
|
72
72
|
card: str | None = None
|
|
73
73
|
role: MemberRole | None = None
|
|
@@ -90,7 +90,7 @@ class FileUrl(ResultModel):
|
|
|
90
90
|
|
|
91
91
|
|
|
92
92
|
class BotProfile(ResultModel):
|
|
93
|
-
user_id:
|
|
93
|
+
user_id: str
|
|
94
94
|
display_name: str
|
|
95
95
|
|
|
96
96
|
@override
|
|
@@ -150,7 +150,7 @@ class RawResult(ResultModel):
|
|
|
150
150
|
|
|
151
151
|
|
|
152
152
|
class FileReference(ResultModel):
|
|
153
|
-
file_id:
|
|
153
|
+
file_id: str
|
|
154
154
|
name: str | None = None
|
|
155
155
|
url: str | None = None
|
|
156
156
|
|
|
@@ -44,7 +44,7 @@ from ..actions import (
|
|
|
44
44
|
UserProfile,
|
|
45
45
|
VersionInfo,
|
|
46
46
|
)
|
|
47
|
-
from ..common import
|
|
47
|
+
from ..common import MemberRole, SceneType
|
|
48
48
|
from ..messages import Message, Quote
|
|
49
49
|
from .context import APIContext
|
|
50
50
|
|
|
@@ -55,7 +55,7 @@ IdInput = str | int
|
|
|
55
55
|
class SceneAPI:
|
|
56
56
|
_context: APIContext
|
|
57
57
|
_scene_type: SceneType
|
|
58
|
-
_scene_id:
|
|
58
|
+
_scene_id: str
|
|
59
59
|
|
|
60
60
|
async def send(self, message: Message | str) -> SendResult:
|
|
61
61
|
if isinstance(message, str):
|
|
@@ -68,7 +68,7 @@ class SceneAPI:
|
|
|
68
68
|
)
|
|
69
69
|
)
|
|
70
70
|
|
|
71
|
-
async def recall(self, message_id:
|
|
71
|
+
async def recall(self, message_id: str) -> None:
|
|
72
72
|
await self._context.execute(RecallMessageAction(message_id=message_id))
|
|
73
73
|
|
|
74
74
|
async def poke(self, user_id: IdInput) -> None:
|
|
@@ -76,14 +76,14 @@ class SceneAPI:
|
|
|
76
76
|
PokeAction(
|
|
77
77
|
scene_type=self._scene_type,
|
|
78
78
|
scene_id=self._scene_id,
|
|
79
|
-
user_id=
|
|
79
|
+
user_id=str(user_id),
|
|
80
80
|
)
|
|
81
81
|
)
|
|
82
82
|
|
|
83
83
|
|
|
84
84
|
@dataclass(frozen=True, slots=True)
|
|
85
85
|
class UserAPI(SceneAPI):
|
|
86
|
-
user_id:
|
|
86
|
+
user_id: str
|
|
87
87
|
|
|
88
88
|
async def profile(self) -> UserProfile:
|
|
89
89
|
return await self._context.execute(GetUserProfileAction(user_id=self.user_id))
|
|
@@ -92,8 +92,8 @@ class UserAPI(SceneAPI):
|
|
|
92
92
|
@dataclass(frozen=True, slots=True)
|
|
93
93
|
class GroupMemberAPI:
|
|
94
94
|
_context: APIContext
|
|
95
|
-
group_id:
|
|
96
|
-
user_id:
|
|
95
|
+
group_id: str
|
|
96
|
+
user_id: str
|
|
97
97
|
|
|
98
98
|
async def profile(self) -> GroupMemberProfile:
|
|
99
99
|
return await self._context.execute(
|
|
@@ -148,10 +148,10 @@ class GroupMemberAPI:
|
|
|
148
148
|
|
|
149
149
|
@dataclass(frozen=True, slots=True)
|
|
150
150
|
class GroupAPI(SceneAPI):
|
|
151
|
-
group_id:
|
|
151
|
+
group_id: str
|
|
152
152
|
|
|
153
153
|
def member(self, user_id: IdInput) -> GroupMemberAPI:
|
|
154
|
-
return GroupMemberAPI(self._context, self.group_id,
|
|
154
|
+
return GroupMemberAPI(self._context, self.group_id, str(user_id))
|
|
155
155
|
|
|
156
156
|
async def profile(self) -> GroupProfile:
|
|
157
157
|
return await self._context.execute(GetGroupProfileAction(group_id=self.group_id))
|
|
@@ -175,7 +175,7 @@ class GroupAPI(SceneAPI):
|
|
|
175
175
|
@dataclass(frozen=True, slots=True)
|
|
176
176
|
class MessageAPI:
|
|
177
177
|
_context: APIContext
|
|
178
|
-
message_id:
|
|
178
|
+
message_id: str
|
|
179
179
|
|
|
180
180
|
async def fetch(self) -> Message:
|
|
181
181
|
return await self._context.execute(FetchMessageAction(message_id=self.message_id))
|
|
@@ -215,7 +215,7 @@ class MessageAPI:
|
|
|
215
215
|
@dataclass(frozen=True, slots=True)
|
|
216
216
|
class FriendRequestAPI:
|
|
217
217
|
_context: APIContext
|
|
218
|
-
request_id:
|
|
218
|
+
request_id: str
|
|
219
219
|
|
|
220
220
|
async def approve(self) -> None:
|
|
221
221
|
await self._context.execute(ApproveFriendRequestAction(request_id=self.request_id))
|
|
@@ -232,7 +232,7 @@ class FriendRequestAPI:
|
|
|
232
232
|
@dataclass(frozen=True, slots=True)
|
|
233
233
|
class GroupRequestAPI:
|
|
234
234
|
_context: APIContext
|
|
235
|
-
request_id:
|
|
235
|
+
request_id: str
|
|
236
236
|
|
|
237
237
|
async def approve(self) -> None:
|
|
238
238
|
await self._context.execute(ApproveGroupRequestAction(request_id=self.request_id))
|
|
@@ -249,7 +249,7 @@ class GroupRequestAPI:
|
|
|
249
249
|
@dataclass(frozen=True, slots=True)
|
|
250
250
|
class FileAPI:
|
|
251
251
|
_context: APIContext
|
|
252
|
-
file_id:
|
|
252
|
+
file_id: str
|
|
253
253
|
|
|
254
254
|
async def info(self) -> FileReference:
|
|
255
255
|
return await self._context.execute(GetFileInfoAction(file_id=self.file_id))
|
|
@@ -277,25 +277,25 @@ class ClientAPI:
|
|
|
277
277
|
self._context = context
|
|
278
278
|
|
|
279
279
|
def scene(self, scene_type: SceneType, scene_id: IdInput) -> SceneAPI:
|
|
280
|
-
return SceneAPI(self._context, scene_type,
|
|
280
|
+
return SceneAPI(self._context, scene_type, str(scene_id))
|
|
281
281
|
|
|
282
282
|
def user(self, user_id: IdInput) -> UserAPI:
|
|
283
|
-
return UserAPI(self._context, SceneType.USER,
|
|
283
|
+
return UserAPI(self._context, SceneType.USER, str(user_id), str(user_id))
|
|
284
284
|
|
|
285
285
|
def group(self, group_id: IdInput) -> GroupAPI:
|
|
286
|
-
return GroupAPI(self._context, SceneType.GROUP,
|
|
286
|
+
return GroupAPI(self._context, SceneType.GROUP, str(group_id), str(group_id))
|
|
287
287
|
|
|
288
288
|
def message(self, message_id: IdInput) -> MessageAPI:
|
|
289
|
-
return MessageAPI(self._context,
|
|
289
|
+
return MessageAPI(self._context, str(message_id))
|
|
290
290
|
|
|
291
291
|
def friend_request(self, request_id: IdInput) -> FriendRequestAPI:
|
|
292
|
-
return FriendRequestAPI(self._context,
|
|
292
|
+
return FriendRequestAPI(self._context, str(request_id))
|
|
293
293
|
|
|
294
294
|
def group_request(self, request_id: IdInput) -> GroupRequestAPI:
|
|
295
|
-
return GroupRequestAPI(self._context,
|
|
295
|
+
return GroupRequestAPI(self._context, str(request_id))
|
|
296
296
|
|
|
297
297
|
def file(self, file_id: IdInput) -> FileAPI:
|
|
298
|
-
return FileAPI(self._context,
|
|
298
|
+
return FileAPI(self._context, str(file_id))
|
|
299
299
|
|
|
300
300
|
async def raw(self, action: str, params: Mapping[str, JsonValue] | None = None) -> RawResult:
|
|
301
301
|
return await self._context.execute(RawAction(action=action, params=dict(params or {})))
|
|
@@ -14,21 +14,9 @@ from .errors import (
|
|
|
14
14
|
ExtensionNotAvailableError,
|
|
15
15
|
HyperotError,
|
|
16
16
|
)
|
|
17
|
-
from .ids import (
|
|
18
|
-
AccountId,
|
|
19
|
-
EventId,
|
|
20
|
-
FileId,
|
|
21
|
-
GroupId,
|
|
22
|
-
MessageId,
|
|
23
|
-
RequestId,
|
|
24
|
-
SceneId,
|
|
25
|
-
SessionId,
|
|
26
|
-
UserId,
|
|
27
|
-
)
|
|
28
17
|
from .models import FileInfo, ReactionValue, UserSnapshot
|
|
29
18
|
|
|
30
19
|
__all__ = [
|
|
31
|
-
"AccountId",
|
|
32
20
|
"ActionError",
|
|
33
21
|
"ActionNotFoundError",
|
|
34
22
|
"ActionRejectedError",
|
|
@@ -40,21 +28,13 @@ __all__ = [
|
|
|
40
28
|
"CapabilityNotSupportedError",
|
|
41
29
|
"ClientNotRunningError",
|
|
42
30
|
"ConfigurationError",
|
|
43
|
-
"EventId",
|
|
44
31
|
"ExtensionNotAvailableError",
|
|
45
|
-
"FileId",
|
|
46
32
|
"FileInfo",
|
|
47
|
-
"GroupId",
|
|
48
33
|
"HyperotError",
|
|
49
34
|
"MemberRole",
|
|
50
|
-
"MessageId",
|
|
51
35
|
"ReactionKind",
|
|
52
36
|
"ReactionValue",
|
|
53
|
-
"RequestId",
|
|
54
|
-
"SceneId",
|
|
55
37
|
"SceneType",
|
|
56
|
-
"SessionId",
|
|
57
|
-
"UserId",
|
|
58
38
|
"UserSex",
|
|
59
39
|
"UserSnapshot",
|
|
60
40
|
]
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
from pydantic import BaseModel, ConfigDict
|
|
2
2
|
|
|
3
3
|
from .enums import MemberRole, ReactionKind, UserSex
|
|
4
|
-
from .ids import FileId, UserId
|
|
5
4
|
|
|
6
5
|
|
|
7
6
|
class FileInfo(BaseModel):
|
|
8
7
|
model_config = ConfigDict(frozen=True, extra="forbid", strict=True)
|
|
9
8
|
|
|
10
|
-
file_id:
|
|
9
|
+
file_id: str
|
|
11
10
|
name: str
|
|
12
11
|
size: int
|
|
13
12
|
|
|
@@ -15,7 +14,7 @@ class FileInfo(BaseModel):
|
|
|
15
14
|
class UserSnapshot(BaseModel):
|
|
16
15
|
model_config = ConfigDict(frozen=True, extra="forbid", strict=True)
|
|
17
16
|
|
|
18
|
-
user_id:
|
|
17
|
+
user_id: str
|
|
19
18
|
nick_name: str | None = None
|
|
20
19
|
display_name: str | None = None
|
|
21
20
|
sex: UserSex | None = None
|
|
@@ -6,7 +6,7 @@ from uuid import uuid4
|
|
|
6
6
|
|
|
7
7
|
from pydantic import BaseModel, ConfigDict, Field
|
|
8
8
|
|
|
9
|
-
from ..common import
|
|
9
|
+
from ..common import SceneType
|
|
10
10
|
from ..hyperogger import Logger
|
|
11
11
|
|
|
12
12
|
logger = Logger.fetch("hyperot.v2.events")
|
|
@@ -20,7 +20,7 @@ class Event(BaseModel):
|
|
|
20
20
|
model_config = ConfigDict(frozen=True, extra="forbid", strict=True)
|
|
21
21
|
|
|
22
22
|
log_enabled: ClassVar[bool] = True
|
|
23
|
-
event_id:
|
|
23
|
+
event_id: str = Field(default_factory=lambda: uuid4().hex)
|
|
24
24
|
timestamp: datetime = Field(default_factory=utc_now)
|
|
25
25
|
|
|
26
26
|
def print_log(self) -> None:
|
|
@@ -37,5 +37,5 @@ class Event(BaseModel):
|
|
|
37
37
|
|
|
38
38
|
class SceneEvent(Event):
|
|
39
39
|
scene_type: SceneType
|
|
40
|
-
scene_id:
|
|
41
|
-
user_id:
|
|
40
|
+
scene_id: str
|
|
41
|
+
user_id: str | None = None
|