satori-python-adapter-milky 0.5.1__tar.gz → 0.5.2__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.
- {satori_python_adapter_milky-0.5.1 → satori_python_adapter_milky-0.5.2}/.mina/adapter_milky.toml +1 -1
- {satori_python_adapter_milky-0.5.1 → satori_python_adapter_milky-0.5.2}/PKG-INFO +2 -1
- {satori_python_adapter_milky-0.5.1 → satori_python_adapter_milky-0.5.2}/README.md +1 -0
- {satori_python_adapter_milky-0.5.1 → satori_python_adapter_milky-0.5.2}/pyproject.toml +1 -1
- {satori_python_adapter_milky-0.5.1 → satori_python_adapter_milky-0.5.2}/src/satori/adapters/milky/base.py +6 -1
- {satori_python_adapter_milky-0.5.1 → satori_python_adapter_milky-0.5.2}/src/satori/adapters/milky/events/group.py +19 -0
- {satori_python_adapter_milky-0.5.1 → satori_python_adapter_milky-0.5.2}/src/satori/adapters/milky/message.py +13 -1
- {satori_python_adapter_milky-0.5.1 → satori_python_adapter_milky-0.5.2}/LICENSE +0 -0
- {satori_python_adapter_milky-0.5.1 → satori_python_adapter_milky-0.5.2}/src/satori/adapters/milky/__init__.py +0 -0
- {satori_python_adapter_milky-0.5.1 → satori_python_adapter_milky-0.5.2}/src/satori/adapters/milky/api.py +0 -0
- {satori_python_adapter_milky-0.5.1 → satori_python_adapter_milky-0.5.2}/src/satori/adapters/milky/events/__init__.py +0 -0
- {satori_python_adapter_milky-0.5.1 → satori_python_adapter_milky-0.5.2}/src/satori/adapters/milky/events/base.py +0 -0
- {satori_python_adapter_milky-0.5.1 → satori_python_adapter_milky-0.5.2}/src/satori/adapters/milky/events/message.py +0 -0
- {satori_python_adapter_milky-0.5.1 → satori_python_adapter_milky-0.5.2}/src/satori/adapters/milky/events/request.py +0 -0
- {satori_python_adapter_milky-0.5.1 → satori_python_adapter_milky-0.5.2}/src/satori/adapters/milky/main.py +0 -0
- {satori_python_adapter_milky-0.5.1 → satori_python_adapter_milky-0.5.2}/src/satori/adapters/milky/sse.py +0 -0
- {satori_python_adapter_milky-0.5.1 → satori_python_adapter_milky-0.5.2}/src/satori/adapters/milky/utils.py +0 -0
- {satori_python_adapter_milky-0.5.1 → satori_python_adapter_milky-0.5.2}/src/satori/adapters/milky/webhook.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: satori-python-adapter-milky
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.2
|
|
4
4
|
Summary: Satori Protocol SDK for python, adapter for Milky
|
|
5
5
|
Home-page: https://github.com/RF-Tar-Railt/satori-python
|
|
6
6
|
Author-Email: RF-Tar-Railt <rf_tar_railt@qq.com>
|
|
@@ -77,6 +77,7 @@ pip install satori-python-server
|
|
|
77
77
|
| Console | `pip install satori-python-adapter-console` | satori.adapters.console |
|
|
78
78
|
| Milky | `pip install satori-python-adapter-milky` | satori.adapters.milky.main, satori.adapters.milky.webhook, satori.adapters.milky.sse |
|
|
79
79
|
| QQ | `pip install satori-python-adapter-qq` | satori.adapters.qq.main, satori.adapters.qq.websocket |
|
|
80
|
+
| WxClaw | `pip install satori-python-adapter-wxclaw` | satori.adapters.wxclaw |
|
|
80
81
|
|
|
81
82
|
### 社区适配器
|
|
82
83
|
|
|
@@ -55,6 +55,7 @@ pip install satori-python-server
|
|
|
55
55
|
| Console | `pip install satori-python-adapter-console` | satori.adapters.console |
|
|
56
56
|
| Milky | `pip install satori-python-adapter-milky` | satori.adapters.milky.main, satori.adapters.milky.webhook, satori.adapters.milky.sse |
|
|
57
57
|
| QQ | `pip install satori-python-adapter-qq` | satori.adapters.qq.main, satori.adapters.qq.websocket |
|
|
58
|
+
| WxClaw | `pip install satori-python-adapter-wxclaw` | satori.adapters.wxclaw |
|
|
58
59
|
|
|
59
60
|
### 社区适配器
|
|
60
61
|
|
|
@@ -155,7 +155,12 @@ class MilkyBaseAdapter(BaseAdapter[TMilkyBaseConfig], ABC):
|
|
|
155
155
|
return
|
|
156
156
|
user = decode_login_user(data)
|
|
157
157
|
login = Login(
|
|
158
|
-
sn=0,
|
|
158
|
+
sn=0,
|
|
159
|
+
status=LoginStatus.ONLINE,
|
|
160
|
+
adapter="milky",
|
|
161
|
+
platform="qq-client",
|
|
162
|
+
user=user,
|
|
163
|
+
features=self.features.copy(),
|
|
159
164
|
)
|
|
160
165
|
self_id = login.id
|
|
161
166
|
previous = self.logins.get(self_id)
|
|
@@ -75,6 +75,25 @@ async def group_member_decrease(login, net, raw):
|
|
|
75
75
|
)
|
|
76
76
|
|
|
77
77
|
|
|
78
|
+
@register_event("group_disband")
|
|
79
|
+
async def group_disband(login, net, raw):
|
|
80
|
+
data = raw["data"]
|
|
81
|
+
guild_id = str(data["group_id"])
|
|
82
|
+
guild = Guild(guild_id, avatar=group_avatar(guild_id))
|
|
83
|
+
channel = Channel(guild_id, ChannelType.TEXT)
|
|
84
|
+
operator = None
|
|
85
|
+
if data.get("operator_id"):
|
|
86
|
+
operator = User(str(data["operator_id"]), avatar=user_avatar(data["operator_id"]))
|
|
87
|
+
return Event(
|
|
88
|
+
EventType.GUILD_REMOVED,
|
|
89
|
+
datetime.now(),
|
|
90
|
+
login,
|
|
91
|
+
guild=guild,
|
|
92
|
+
channel=channel,
|
|
93
|
+
operator=operator,
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
|
|
78
97
|
@register_event("group_name_change")
|
|
79
98
|
async def group_name_change(login, net, raw):
|
|
80
99
|
data = raw["data"]
|
|
@@ -139,10 +139,17 @@ class MilkyMessageEncoder:
|
|
|
139
139
|
return
|
|
140
140
|
if match := _BASE64_RE.match(uri):
|
|
141
141
|
uri = f"base64://{uri[len(match.group(0)) :]}"
|
|
142
|
+
sub_type = "normal"
|
|
143
|
+
if "sub_type" in attrs:
|
|
144
|
+
sub_type = attrs["sub_type"]
|
|
145
|
+
if "subType" in attrs:
|
|
146
|
+
sub_type = attrs["subType"]
|
|
147
|
+
if "milky:type" in attrs:
|
|
148
|
+
sub_type = attrs["milky:type"]
|
|
142
149
|
self.segments.append(
|
|
143
150
|
{
|
|
144
151
|
"type": "image",
|
|
145
|
-
"data": {"uri": uri, "sub_type":
|
|
152
|
+
"data": {"uri": uri, "sub_type": sub_type},
|
|
146
153
|
}
|
|
147
154
|
)
|
|
148
155
|
case "audio":
|
|
@@ -177,6 +184,9 @@ class MilkyMessageEncoder:
|
|
|
177
184
|
self.segments.append(
|
|
178
185
|
{"type": "light_app", "data": {"json_payload": attrs.get("json_payload", attrs["jsonPayload"])}}
|
|
179
186
|
)
|
|
187
|
+
case "markdown" | "milky:markdown":
|
|
188
|
+
await self.flush()
|
|
189
|
+
self.segments.append({"type": "markdown", "data": {"content": str(children[0])}})
|
|
180
190
|
case "author":
|
|
181
191
|
self.stack[0].author.update(attrs)
|
|
182
192
|
case "quote":
|
|
@@ -255,6 +265,7 @@ class MilkyMessageEncoder:
|
|
|
255
265
|
"user_id": origin["message"]["sender_id"],
|
|
256
266
|
"sender_name": nickname,
|
|
257
267
|
"segments": await self.sendable(segments),
|
|
268
|
+
"time": origin["message"]["time"],
|
|
258
269
|
}
|
|
259
270
|
)
|
|
260
271
|
else:
|
|
@@ -263,6 +274,7 @@ class MilkyMessageEncoder:
|
|
|
263
274
|
"user_id": int(author.get("id", self.login.id)),
|
|
264
275
|
"sender_name": author.get("name", self.login.user.name or self.login.id),
|
|
265
276
|
"segments": self.segments,
|
|
277
|
+
"time": int(author.get("time", datetime.now().timestamp())),
|
|
266
278
|
}
|
|
267
279
|
)
|
|
268
280
|
self.segments = []
|
|
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
|