hyper-bot 1.0.0.post3__tar.gz → 1.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-1.0.0.post3/src/hyper_bot.egg-info → hyper_bot-1.0.1}/PKG-INFO +1 -1
- {hyper_bot-1.0.0.post3 → hyper_bot-1.0.1}/pyproject.toml +1 -1
- {hyper_bot-1.0.0.post3 → hyper_bot-1.0.1/src/hyper_bot.egg-info}/PKG-INFO +1 -1
- {hyper_bot-1.0.0.post3 → hyper_bot-1.0.1}/src/hyperot/adapters/milky/translator.py +3 -3
- {hyper_bot-1.0.0.post3 → hyper_bot-1.0.1}/src/hyperot/protocol/builder.py +1 -1
- {hyper_bot-1.0.0.post3 → hyper_bot-1.0.1}/src/hyperot/protocol/listener.py +2 -2
- {hyper_bot-1.0.0.post3 → hyper_bot-1.0.1}/src/hyperot/segments.py +2 -2
- {hyper_bot-1.0.0.post3 → hyper_bot-1.0.1}/tests/test_milky.py +2 -2
- {hyper_bot-1.0.0.post3 → hyper_bot-1.0.1}/LICENSE +0 -0
- {hyper_bot-1.0.0.post3 → hyper_bot-1.0.1}/setup.cfg +0 -0
- {hyper_bot-1.0.0.post3 → hyper_bot-1.0.1}/src/hyper_bot.egg-info/SOURCES.txt +0 -0
- {hyper_bot-1.0.0.post3 → hyper_bot-1.0.1}/src/hyper_bot.egg-info/dependency_links.txt +0 -0
- {hyper_bot-1.0.0.post3 → hyper_bot-1.0.1}/src/hyper_bot.egg-info/requires.txt +0 -0
- {hyper_bot-1.0.0.post3 → hyper_bot-1.0.1}/src/hyper_bot.egg-info/top_level.txt +0 -0
- {hyper_bot-1.0.0.post3 → hyper_bot-1.0.1}/src/hyperot/__init__.py +0 -0
- {hyper_bot-1.0.0.post3 → hyper_bot-1.0.1}/src/hyperot/adapters/__init__.py +0 -0
- {hyper_bot-1.0.0.post3 → hyper_bot-1.0.1}/src/hyperot/adapters/milky/__init__.py +0 -0
- {hyper_bot-1.0.0.post3 → hyper_bot-1.0.1}/src/hyperot/adapters/milky/actions.py +0 -0
- {hyper_bot-1.0.0.post3 → hyper_bot-1.0.1}/src/hyperot/adapters/milky/listener.py +0 -0
- {hyper_bot-1.0.0.post3 → hyper_bot-1.0.1}/src/hyperot/adapters/milky/packet.py +0 -0
- {hyper_bot-1.0.0.post3 → hyper_bot-1.0.1}/src/hyperot/adapters/onebot/__init__.py +0 -0
- {hyper_bot-1.0.0.post3 → hyper_bot-1.0.1}/src/hyperot/adapters/onebot/actions.py +0 -0
- {hyper_bot-1.0.0.post3 → hyper_bot-1.0.1}/src/hyperot/adapters/onebot/listener.py +0 -0
- {hyper_bot-1.0.0.post3 → hyper_bot-1.0.1}/src/hyperot/adapters/onebot/packet.py +0 -0
- {hyper_bot-1.0.0.post3 → hyper_bot-1.0.1}/src/hyperot/common.py +0 -0
- {hyper_bot-1.0.0.post3 → hyper_bot-1.0.1}/src/hyperot/configurator.py +0 -0
- {hyper_bot-1.0.0.post3 → hyper_bot-1.0.1}/src/hyperot/events.py +0 -0
- {hyper_bot-1.0.0.post3 → hyper_bot-1.0.1}/src/hyperot/hyperogger.py +0 -0
- {hyper_bot-1.0.0.post3 → hyper_bot-1.0.1}/src/hyperot/listener.py +0 -0
- {hyper_bot-1.0.0.post3 → hyper_bot-1.0.1}/src/hyperot/network.py +0 -0
- {hyper_bot-1.0.0.post3 → hyper_bot-1.0.1}/src/hyperot/protocol/__init__.py +0 -0
- {hyper_bot-1.0.0.post3 → hyper_bot-1.0.1}/src/hyperot/protocol/actions.py +0 -0
- {hyper_bot-1.0.0.post3 → hyper_bot-1.0.1}/src/hyperot/protocol/segments.py +0 -0
- {hyper_bot-1.0.0.post3 → hyper_bot-1.0.1}/src/hyperot/utils/__init__.py +0 -0
- {hyper_bot-1.0.0.post3 → hyper_bot-1.0.1}/src/hyperot/utils/apiresponse.py +0 -0
- {hyper_bot-1.0.0.post3 → hyper_bot-1.0.1}/src/hyperot/utils/ark_sign_helper.py +0 -0
- {hyper_bot-1.0.0.post3 → hyper_bot-1.0.1}/src/hyperot/utils/errors.py +0 -0
- {hyper_bot-1.0.0.post3 → hyper_bot-1.0.1}/src/hyperot/utils/hypetyping.py +0 -0
- {hyper_bot-1.0.0.post3 → hyper_bot-1.0.1}/src/hyperot/utils/screens.py +0 -0
- {hyper_bot-1.0.0.post3 → hyper_bot-1.0.1}/src/hyperot/utils/typextensions.py +0 -0
- {hyper_bot-1.0.0.post3 → hyper_bot-1.0.1}/tests/test_configurator.py +0 -0
- {hyper_bot-1.0.0.post3 → hyper_bot-1.0.1}/tests/test_events.py +0 -0
- {hyper_bot-1.0.0.post3 → hyper_bot-1.0.1}/tests/test_listener.py +0 -0
- {hyper_bot-1.0.0.post3 → hyper_bot-1.0.1}/tests/test_network.py +0 -0
- {hyper_bot-1.0.0.post3 → hyper_bot-1.0.1}/tests/test_onebot.py +0 -0
- {hyper_bot-1.0.0.post3 → hyper_bot-1.0.1}/tests/test_registry.py +0 -0
- {hyper_bot-1.0.0.post3 → hyper_bot-1.0.1}/tests/test_segments.py +0 -0
- {hyper_bot-1.0.0.post3 → hyper_bot-1.0.1}/tests/test_utils.py +0 -0
- {hyper_bot-1.0.0.post3 → hyper_bot-1.0.1}/tests/test_version.py +0 -0
|
@@ -41,7 +41,7 @@ class MilkyOutGoingSegBuilder:
|
|
|
41
41
|
self.segments.append({"type": "reply", "data": {"message_seq": seq}})
|
|
42
42
|
return self
|
|
43
43
|
|
|
44
|
-
def image(self, uri: str, summary: str = "[
|
|
44
|
+
def image(self, uri: str, summary: str = "[图片]", sub_type: str = "normal") -> "MilkyOutGoingSegBuilder":
|
|
45
45
|
self.segments.append({"type": "image", "data": {"uri": uri, "summary": summary, "sub_type": sub_type}})
|
|
46
46
|
return self
|
|
47
47
|
|
|
@@ -86,7 +86,7 @@ def message_translator(milky_message: list[dict], peer_id: int, scene: int = 0)
|
|
|
86
86
|
case "text":
|
|
87
87
|
builder.text(seg_data["text"])
|
|
88
88
|
case "image":
|
|
89
|
-
builder.image(file=seg_data["temp_url"], summary=seg_data.get("summary", "[
|
|
89
|
+
builder.image(file=seg_data["temp_url"], summary=seg_data.get("summary", "[图片]"))
|
|
90
90
|
case "mention":
|
|
91
91
|
builder.at(seg_data["user_id"])
|
|
92
92
|
case "mention_all":
|
|
@@ -177,7 +177,7 @@ def _to_milky_seg(seg: dict) -> dict:
|
|
|
177
177
|
"type": "image",
|
|
178
178
|
"data": {
|
|
179
179
|
"uri": seg_data.get("file"),
|
|
180
|
-
"summary": seg_data.get("summary", "[
|
|
180
|
+
"summary": seg_data.get("summary", "[图片]"),
|
|
181
181
|
"sub_type": seg_data.get("sub_type", "normal"),
|
|
182
182
|
},
|
|
183
183
|
}
|
|
@@ -191,7 +191,7 @@ class OneBotJsonMessageBuilder:
|
|
|
191
191
|
self.message.append({"type": "text", "data": {"text": text}})
|
|
192
192
|
return self
|
|
193
193
|
|
|
194
|
-
def image(self, file: str, summary: str = "[
|
|
194
|
+
def image(self, file: str, summary: str = "[图片]") -> "OneBotJsonMessageBuilder":
|
|
195
195
|
self.message.append({"type": "image", "data": {"file": file, "url": file, "summary": summary}})
|
|
196
196
|
return self
|
|
197
197
|
|
|
@@ -5,7 +5,7 @@ import time
|
|
|
5
5
|
from collections.abc import Callable
|
|
6
6
|
from typing import Any
|
|
7
7
|
|
|
8
|
-
from websockets.exceptions import
|
|
8
|
+
from websockets.exceptions import ConnectionClosed
|
|
9
9
|
|
|
10
10
|
from .. import configurator, hyperogger
|
|
11
11
|
from ..events import HyperListenerStartNotify, HyperListenerStopNotify, HyperNotify
|
|
@@ -90,7 +90,7 @@ class BaseListener:
|
|
|
90
90
|
while True:
|
|
91
91
|
try:
|
|
92
92
|
data = await connection.recv()
|
|
93
|
-
except (
|
|
93
|
+
except (ConnectionClosed, ConnectionResetError):
|
|
94
94
|
logger.error("连接断开")
|
|
95
95
|
break
|
|
96
96
|
except json.decoder.JSONDecodeError:
|
|
@@ -81,9 +81,9 @@ class StreamTest(SegmentBase, st="stream", su="[Stream] <text>"):
|
|
|
81
81
|
|
|
82
82
|
|
|
83
83
|
@dataclasses.dataclass
|
|
84
|
-
class Image(MediaSeg, st="image", su="[
|
|
84
|
+
class Image(MediaSeg, st="image", su="[图片]"):
|
|
85
85
|
file: str
|
|
86
|
-
summary: str = "[
|
|
86
|
+
summary: str = "[图片]"
|
|
87
87
|
url: str | None = None
|
|
88
88
|
|
|
89
89
|
|
|
@@ -39,7 +39,7 @@ def test_message_translator_basic():
|
|
|
39
39
|
)
|
|
40
40
|
assert ob == [
|
|
41
41
|
{"type": "text", "data": {"text": "hi"}},
|
|
42
|
-
{"type": "image", "data": {"file": "http://a/b.png", "url": "http://a/b.png", "summary": "[
|
|
42
|
+
{"type": "image", "data": {"file": "http://a/b.png", "url": "http://a/b.png", "summary": "[图片]"}},
|
|
43
43
|
{"type": "at", "data": {"qq": 123}},
|
|
44
44
|
{"type": "at", "data": {"qq": "all"}},
|
|
45
45
|
]
|
|
@@ -494,7 +494,7 @@ def test_milky_outgoing_seg_at():
|
|
|
494
494
|
def test_milky_outgoing_seg_image():
|
|
495
495
|
assert Image(file="http://a/b.png").milky_outgoing_seg() == {
|
|
496
496
|
"type": "image",
|
|
497
|
-
"data": {"uri": "http://a/b.png", "summary": "[
|
|
497
|
+
"data": {"uri": "http://a/b.png", "summary": "[图片]", "sub_type": "normal"},
|
|
498
498
|
}
|
|
499
499
|
|
|
500
500
|
|
|
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
|