hyper-bot 0.80.5__tar.gz → 0.80.7__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 (47) hide show
  1. {hyper_bot-0.80.5 → hyper_bot-0.80.7}/PKG-INFO +1 -1
  2. {hyper_bot-0.80.5 → hyper_bot-0.80.7}/hyper_bot.egg-info/PKG-INFO +1 -1
  3. hyper_bot-0.80.7/hyperot/__init__.py +82 -0
  4. {hyper_bot-0.80.5 → hyper_bot-0.80.7}/hyperot/common.py +9 -9
  5. {hyper_bot-0.80.5 → hyper_bot-0.80.7}/hyperot/listener.py +10 -8
  6. {hyper_bot-0.80.5 → hyper_bot-0.80.7}/hyperot/network.py +31 -27
  7. {hyper_bot-0.80.5 → hyper_bot-0.80.7}/hyperot/segments.py +14 -13
  8. hyper_bot-0.80.5/hyperot/__init__.py +0 -87
  9. {hyper_bot-0.80.5 → hyper_bot-0.80.7}/LICENSE +0 -0
  10. {hyper_bot-0.80.5 → hyper_bot-0.80.7}/hyper_bot.egg-info/SOURCES.txt +0 -0
  11. {hyper_bot-0.80.5 → hyper_bot-0.80.7}/hyper_bot.egg-info/dependency_links.txt +0 -0
  12. {hyper_bot-0.80.5 → hyper_bot-0.80.7}/hyper_bot.egg-info/requires.txt +0 -0
  13. {hyper_bot-0.80.5 → hyper_bot-0.80.7}/hyper_bot.egg-info/top_level.txt +0 -0
  14. {hyper_bot-0.80.5 → hyper_bot-0.80.7}/hyperot/Adapters/Kritor.py +0 -0
  15. {hyper_bot-0.80.5 → hyper_bot-0.80.7}/hyperot/Adapters/KritorLib/Manager.py +0 -0
  16. {hyper_bot-0.80.5 → hyper_bot-0.80.7}/hyperot/Adapters/KritorLib/Res.py +0 -0
  17. {hyper_bot-0.80.5 → hyper_bot-0.80.7}/hyperot/Adapters/KritorLib/protos/__init__.py +0 -0
  18. {hyper_bot-0.80.5 → hyper_bot-0.80.7}/hyperot/Adapters/KritorLib/protos/authentication/__init__.py +0 -0
  19. {hyper_bot-0.80.5 → hyper_bot-0.80.7}/hyperot/Adapters/KritorLib/protos/common/__init__.py +0 -0
  20. {hyper_bot-0.80.5 → hyper_bot-0.80.7}/hyperot/Adapters/KritorLib/protos/core/__init__.py +0 -0
  21. {hyper_bot-0.80.5 → hyper_bot-0.80.7}/hyperot/Adapters/KritorLib/protos/customization/__init__.py +0 -0
  22. {hyper_bot-0.80.5 → hyper_bot-0.80.7}/hyperot/Adapters/KritorLib/protos/developer/__init__.py +0 -0
  23. {hyper_bot-0.80.5 → hyper_bot-0.80.7}/hyperot/Adapters/KritorLib/protos/event/__init__.py +0 -0
  24. {hyper_bot-0.80.5 → hyper_bot-0.80.7}/hyperot/Adapters/KritorLib/protos/file/__init__.py +0 -0
  25. {hyper_bot-0.80.5 → hyper_bot-0.80.7}/hyperot/Adapters/KritorLib/protos/friend/__init__.py +0 -0
  26. {hyper_bot-0.80.5 → hyper_bot-0.80.7}/hyperot/Adapters/KritorLib/protos/group/__init__.py +0 -0
  27. {hyper_bot-0.80.5 → hyper_bot-0.80.7}/hyperot/Adapters/KritorLib/protos/guild/__init__.py +0 -0
  28. {hyper_bot-0.80.5 → hyper_bot-0.80.7}/hyperot/Adapters/KritorLib/protos/message/__init__.py +0 -0
  29. {hyper_bot-0.80.5 → hyper_bot-0.80.7}/hyperot/Adapters/KritorLib/protos/process/__init__.py +0 -0
  30. {hyper_bot-0.80.5 → hyper_bot-0.80.7}/hyperot/Adapters/KritorLib/protos/reverse/__init__.py +0 -0
  31. {hyper_bot-0.80.5 → hyper_bot-0.80.7}/hyperot/Adapters/KritorLib/protos/web/__init__.py +0 -0
  32. {hyper_bot-0.80.5 → hyper_bot-0.80.7}/hyperot/Adapters/OneBot.py +0 -0
  33. {hyper_bot-0.80.5 → hyper_bot-0.80.7}/hyperot/Adapters/OneBotLib/Manager.py +0 -0
  34. {hyper_bot-0.80.5 → hyper_bot-0.80.7}/hyperot/Adapters/OneBotLib/Res.py +0 -0
  35. {hyper_bot-0.80.5 → hyper_bot-0.80.7}/hyperot/configurator.py +0 -0
  36. {hyper_bot-0.80.5 → hyper_bot-0.80.7}/hyperot/events.py +0 -0
  37. {hyper_bot-0.80.5 → hyper_bot-0.80.7}/hyperot/hyperogger.py +0 -0
  38. {hyper_bot-0.80.5 → hyper_bot-0.80.7}/hyperot/service.py +0 -0
  39. {hyper_bot-0.80.5 → hyper_bot-0.80.7}/hyperot/utils/ArkSignHelper.py +0 -0
  40. {hyper_bot-0.80.5 → hyper_bot-0.80.7}/hyperot/utils/apiresponse.py +0 -0
  41. {hyper_bot-0.80.5 → hyper_bot-0.80.7}/hyperot/utils/errors.py +0 -0
  42. {hyper_bot-0.80.5 → hyper_bot-0.80.7}/hyperot/utils/hypetyping.py +0 -0
  43. {hyper_bot-0.80.5 → hyper_bot-0.80.7}/hyperot/utils/logic.py +0 -0
  44. {hyper_bot-0.80.5 → hyper_bot-0.80.7}/hyperot/utils/screens.py +0 -0
  45. {hyper_bot-0.80.5 → hyper_bot-0.80.7}/hyperot/utils/typextensions.py +0 -0
  46. {hyper_bot-0.80.5 → hyper_bot-0.80.7}/setup.cfg +0 -0
  47. {hyper_bot-0.80.5 → hyper_bot-0.80.7}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hyper-bot
3
- Version: 0.80.5
3
+ Version: 0.80.7
4
4
  Summary: 稳定高效、易于开发的QQ Bot框架
5
5
  Home-page: https://github.com/HarcicYang/HypeR_Bot
6
6
  Author: Harcic
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hyper-bot
3
- Version: 0.80.5
3
+ Version: 0.80.7
4
4
  Summary: 稳定高效、易于开发的QQ Bot框架
5
5
  Home-page: https://github.com/HarcicYang/HypeR_Bot
6
6
  Author: Harcic
@@ -0,0 +1,82 @@
1
+ from . import configurator
2
+ from .utils import screens
3
+
4
+ from typing import Union
5
+ import asyncio
6
+ import sys
7
+ import os
8
+
9
+ HYPER_BOT_VERSION = "0.80.7"
10
+
11
+ # listener = None
12
+
13
+ screens.play_startup()
14
+ screens.play_info(HYPER_BOT_VERSION)
15
+
16
+
17
+ class Client:
18
+ def __init__(self):
19
+ self.records = {}
20
+ self.lis = None
21
+
22
+ def subscribe(
23
+ self,
24
+ func: callable,
25
+ event: Union[
26
+ "events.GroupMessageEvent",
27
+ "events.PrivateMessageEvent",
28
+ "events.GroupFileUploadEvent",
29
+ "events.GroupAdminEvent",
30
+ "events.GroupMemberDecreaseEvent",
31
+ "events.GroupMemberIncreaseEvent",
32
+ "events.GroupMuteEvent",
33
+ "events.FriendAddEvent",
34
+ "events.GroupRecallEvent",
35
+ "events.FriendRecallEvent",
36
+ "events.NotifyEvent",
37
+ "events.GroupEssenceEvent",
38
+ "events.MessageReactionEvent",
39
+ "events.GroupAddInviteEvent",
40
+ "events.HyperListenerStartNotify",
41
+ "events.HyperListenerStopNotify"
42
+ ]
43
+ ) -> None:
44
+ if not self.records.get(event):
45
+ self.records[event] = [func]
46
+ else:
47
+ self.records[event].append(func)
48
+
49
+ async def distributor(
50
+ self, message_data: Union["events.Event", "events.HyperNotify"], actions: "Listener.Actions"
51
+ ) -> None:
52
+ if type(message_data) in list(self.records.keys()):
53
+ tasks = []
54
+ for i in self.records[type(message_data)]:
55
+ tasks.append(asyncio.create_task(i(message_data, actions)))
56
+ await asyncio.gather(*tasks)
57
+ else:
58
+ return
59
+
60
+ def run(self):
61
+ from . import listener
62
+ self.lis = listener
63
+ self.lis.reg(self.distributor)
64
+ if self.records:
65
+ self.lis.run()
66
+
67
+ def restart(self) -> None:
68
+ self.lis.stop()
69
+ os.execv(sys.executable, [sys.executable] + sys.argv)
70
+ # os._exit(1)
71
+
72
+ def __enter__(self):
73
+ return self
74
+
75
+ def __exit__(self, exc_type, exc_val, exc_tb):
76
+ pass
77
+
78
+ async def __aenter__(self):
79
+ return self
80
+
81
+ async def __aexit__(self, exc_type, exc_val, exc_tb):
82
+ pass
@@ -7,19 +7,19 @@ from typing import Generic, Type, Self
7
7
 
8
8
  config = configurator.BotConfig.get("hyper-bot")
9
9
 
10
- if config.protocol == "OneBot":
11
- from .Adapters.OneBotLib.Manager import *
12
- elif config.protocol == "Satori":
13
- raise NotImplementedError()
14
- elif config.protocol == "Lagrange":
15
- raise NotImplementedError()
16
- elif config.protocol == "Kritor":
17
- from .Adapters.KritorLib.Manager import *
10
+ # if config.protocol == "OneBot":
11
+ # from .Adapters.OneBotLib.Manager import *
12
+ # elif config.protocol == "Satori":
13
+ # raise NotImplementedError()
14
+ # elif config.protocol == "Lagrange":
15
+ # raise NotImplementedError()
16
+ # elif config.protocol == "Kritor":
17
+ # from .Adapters.KritorLib.Manager import *
18
18
 
19
+ from .Adapters.OneBotLib.Manager import *
19
20
 
20
21
  init()
21
22
 
22
-
23
23
  __all__ = ["Message", "MessageBuilder", "Packet", "Ret", "reports"]
24
24
 
25
25
 
@@ -4,14 +4,16 @@ config = configurator.BotConfig.get("hyper-bot")
4
4
 
5
5
  __all__ = ["run", "stop", "Actions"]
6
6
 
7
- if config.protocol == "OneBot":
8
- from .Adapters.OneBot import *
9
- elif config.protocol == "Satori":
10
- raise NotImplementedError()
11
- elif config.protocol == "Lagrange":
12
- raise NotImplementedError()
13
- elif config.protocol == "Kritor":
14
- from .Adapters.Kritor import *
7
+ # if config.protocol == "OneBot":
8
+ # from .Adapters.OneBot import *
9
+ # elif config.protocol == "Satori":
10
+ # raise NotImplementedError()
11
+ # elif config.protocol == "Lagrange":
12
+ # raise NotImplementedError()
13
+ # elif config.protocol == "Kritor":
14
+ # from .Adapters.Kritor import *
15
+
16
+ from .Adapters.OneBot import *
15
17
 
16
18
  events.init()
17
19
 
@@ -8,11 +8,11 @@ import traceback
8
8
  import json
9
9
  import logging
10
10
  import threading
11
- from grpclib.client import Channel
12
-
13
- from .Adapters.KritorLib.protos.authentication import AuthenticationServiceStub, AuthenticateRequest
14
- from .Adapters.KritorLib.protos.event import EventServiceStub
15
- from .Adapters.KritorLib.Res import EventService
11
+ # from grpclib.client import Channel
12
+ #
13
+ # from .Adapters.KritorLib.protos.authentication import AuthenticationServiceStub, AuthenticateRequest
14
+ # from .Adapters.KritorLib.protos.event import EventServiceStub
15
+ # from .Adapters.KritorLib.Res import EventService
16
16
 
17
17
 
18
18
  class WebsocketConnection:
@@ -131,35 +131,39 @@ class SatoriConnection:
131
131
  class KritorConnection:
132
132
  def __init__(self, host: str, port: int, account: str = None, ticket: str = None):
133
133
  # self.channel = grpc.insecure_channel(f"{host}:{port}")
134
- self.channel = Channel(host=host, port=port)
135
- self.account = account
136
- self.ticket = ticket
134
+ # self.channel = Channel(host=host, port=port)
135
+ # self.account = account
136
+ # self.ticket = ticket
137
+ raise NotImplementedError()
137
138
 
138
139
  def connect(self) -> None:
139
- if self.account and self.ticket:
140
- auth_stub = AuthenticationServiceStub(self.channel)
141
- response = asyncio.run(
142
- auth_stub.authenticate(
143
- AuthenticateRequest(
144
- account=self.account,
145
- ticket=self.ticket
146
- )
147
- )
148
- )
149
- if response.code != 0:
150
- raise ConnectionError("鉴权失败")
151
- else:
152
- pass
140
+ # if self.account and self.ticket:
141
+ # auth_stub = AuthenticationServiceStub(self.channel)
142
+ # response = asyncio.run(
143
+ # auth_stub.authenticate(
144
+ # AuthenticateRequest(
145
+ # account=self.account,
146
+ # ticket=self.ticket
147
+ # )
148
+ # )
149
+ # )
150
+ # if response.code != 0:
151
+ # raise ConnectionError("鉴权失败")
152
+ # else:
153
+ # pass
154
+ raise NotImplementedError()
153
155
  # threading.Thread(target=lambda: asyncio.run(self.event_service.run())).start()
154
156
 
155
157
  def send(self, stub, payload: dict, echo: str = None) -> None:
156
158
  raise NotImplementedError()
157
159
 
158
160
  def close(self) -> None:
159
- self.channel.close()
161
+ # self.channel.close()
162
+ raise NotImplementedError()
160
163
 
161
164
  async def recv(self) -> None:
162
- event_service = EventService(EventServiceStub(self.channel))
163
- # asyncio.run(event_service.run())
164
- # asyncio.get_running_loop().run_until_complete(event_service.run())
165
- await event_service.run()
165
+ # event_service = EventService(EventServiceStub(self.channel))
166
+ # # asyncio.run(event_service.run())
167
+ # # asyncio.get_running_loop().run_until_complete(event_service.run())
168
+ # await event_service.run()
169
+ raise NotImplementedError()
@@ -8,19 +8,20 @@ from .utils.hypetyping import Union
8
8
  from . import configurator
9
9
 
10
10
  config = configurator.BotConfig.get("hyper-bot")
11
- if config.protocol == "OneBot":
12
- # from Hyper.Adapters.OneBotLib.Res import segment_builder, Base, message_types
13
- from .Adapters.OneBotLib.Res import SegmentBase, message_types
14
- elif config.protocol == "Satori":
15
- # from Hyper.Adapters.SatoriLib.Res import segment_builder, Base, message_types
16
- raise NotImplementedError()
17
- elif config.protocol == "Lagrange":
18
- # from Hyper.Adapters.LagrangeLib.Res import segment_builder, Base, message_types
19
- raise NotImplementedError()
20
- elif config.protocol == "Kritor":
21
- # from Hyper.Adapters.KritorLib.Res import segment_builder, Base, message_types
22
- from .Adapters.KritorLib.Res import SegmentBase, message_types
23
-
11
+ # if config.protocol == "OneBot":
12
+ # # from Hyper.Adapters.OneBotLib.Res import segment_builder, Base, message_types
13
+ # from .Adapters.OneBotLib.Res import SegmentBase, message_types
14
+ # elif config.protocol == "Satori":
15
+ # # from Hyper.Adapters.SatoriLib.Res import segment_builder, Base, message_types
16
+ # raise NotImplementedError()
17
+ # elif config.protocol == "Lagrange":
18
+ # # from Hyper.Adapters.LagrangeLib.Res import segment_builder, Base, message_types
19
+ # raise NotImplementedError()
20
+ # elif config.protocol == "Kritor":
21
+ # # from Hyper.Adapters.KritorLib.Res import segment_builder, Base, message_types
22
+ # from .Adapters.KritorLib.Res import SegmentBase, message_types
23
+
24
+ from .Adapters.OneBotLib.Res import SegmentBase, message_types
24
25
 
25
26
  class MediaSeg(SegmentBase):
26
27
  @classmethod
@@ -1,87 +0,0 @@
1
- from . import configurator
2
- from .utils import screens
3
-
4
- from typing import Union
5
- import asyncio
6
- import importlib
7
- import sys
8
- import os
9
-
10
- HYPER_BOT_VERSION = "0.80.5"
11
-
12
- listener: "Listener"
13
-
14
- screens.play_startup()
15
- screens.play_info(HYPER_BOT_VERSION)
16
-
17
-
18
- def _load_listener() -> None:
19
- global listener
20
- listener = importlib.import_module("Hyper.Listener")
21
-
22
-
23
- def restart() -> None:
24
- listener.stop()
25
- os.execv(sys.executable, [sys.executable] + sys.argv)
26
- # os._exit(1)
27
-
28
-
29
- class Client:
30
- def __init__(self):
31
- self.records = {}
32
-
33
- def subscribe(
34
- self,
35
- func: callable,
36
- event: Union[
37
- "Events.GroupMessageEvent",
38
- "Events.PrivateMessageEvent",
39
- "Events.GroupFileUploadEvent",
40
- "Events.GroupAdminEvent",
41
- "Events.GroupMemberDecreaseEvent",
42
- "Events.GroupMemberIncreaseEvent",
43
- "Events.GroupMuteEvent",
44
- "Events.FriendAddEvent",
45
- "Events.GroupRecallEvent",
46
- "Events.FriendRecallEvent",
47
- "Events.NotifyEvent",
48
- "Events.GroupEssenceEvent",
49
- "Events.MessageReactionEvent",
50
- "Events.GroupAddInviteEvent",
51
- "Events.HyperListenerStartNotify",
52
- "Events.HyperListenerStopNotify"
53
- ]
54
- ) -> None:
55
- if not self.records.get(event):
56
- self.records[event] = [func]
57
- else:
58
- self.records[event].append(func)
59
-
60
- async def distributor(
61
- self, message_data: Union["Events.Event", "Events.HyperNotify"], actions: "Listener.Actions"
62
- ) -> None:
63
- if type(message_data) in list(self.records.keys()):
64
- tasks = []
65
- for i in self.records[type(message_data)]:
66
- tasks.append(asyncio.create_task(i(message_data, actions)))
67
- await asyncio.gather(*tasks)
68
- else:
69
- return
70
-
71
- def run(self):
72
- _load_listener()
73
- listener.reg(self.distributor)
74
- if self.records:
75
- listener.run()
76
-
77
- def __enter__(self):
78
- return self
79
-
80
- def __exit__(self, exc_type, exc_val, exc_tb):
81
- pass
82
-
83
- async def __aenter__(self):
84
- return self
85
-
86
- async def __aexit__(self, exc_type, exc_val, exc_tb):
87
- pass
File without changes
File without changes
File without changes
File without changes