OneBotConnecter 0.3.7__tar.gz → 0.3.8__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: OneBotConnecter
3
- Version: 0.3.7
3
+ Version: 0.3.8
4
4
  Summary: 基于websocket(服务器正向)连接的onebot11通用python接口
5
5
  Author-email: Sugar51243 <1733682365@qq.com>
6
6
  License: MIT License
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "OneBotConnecter"
7
- version = "0.3.07"
7
+ version = "0.3.08"
8
8
  authors = [
9
9
  { name="Sugar51243", email="1733682365@qq.com" },
10
10
  ]
@@ -80,8 +80,6 @@ class OneBot:
80
80
  if self.owner != None: print(f"机器人管理员: {self.owner}")
81
81
  if self.localtion != None: print(f"机器人根目录地址: {self.localtion}")
82
82
  print(f"开始监听机器人信息推送\n")
83
- #持续从接口收取信息
84
- counter = 0
85
83
  while True:
86
84
  #连接失败 => 直到连接成功为止,持续尝试重连
87
85
  if self.bot == None:
@@ -93,7 +91,7 @@ class OneBot:
93
91
  await asyncio.sleep(5)
94
92
  #连接正常
95
93
  if self.bot != None:
96
- print(f"下一轮信息收集[{counter}]", needPrint=self.testMode)
94
+ print(f"下一轮信息收集", needPrint=self.testMode)
97
95
  #从接口收取信息,并进行信息处理
98
96
  task = asyncio.create_task(self._receive_messages(on_message))
99
97
  try:
@@ -102,7 +100,7 @@ class OneBot:
102
100
  #可以不作处理
103
101
  except Exception: pass
104
102
  await asyncio.sleep(sleep_time)
105
- print(f"此轮结束[{counter}]", needPrint=self.testMode)
103
+ print(f"此轮结束\n", needPrint=self.testMode)
106
104
  counter+=1
107
105
 
108
106
  #收到信息时
@@ -113,7 +111,7 @@ class OneBot:
113
111
  if self.get_message:
114
112
  message = await self.bot.recv()
115
113
  message = json.loads(message)
116
- print(f"获取信息:\n{message}", needPrint=self.testMode)
114
+ print(f"获取信息: {message}", needPrint=self.testMode)
117
115
  #处理 => 缓存
118
116
  try:
119
117
  #识别是否为心跳信息
@@ -132,7 +130,7 @@ class OneBot:
132
130
  while len(self.message_list) > 0:
133
131
  try:
134
132
  message = self.message_list.pop(0)
135
- print(f"正在处理: \n{message}", needPrint=self.testMode)
133
+ print(f"正在处理: {message}", needPrint=self.testMode)
136
134
  await callback(self, message)
137
135
  except Exception as e:
138
136
  tb = e.__traceback__
@@ -178,7 +176,7 @@ class OneBot:
178
176
  #从接口收取信息
179
177
  callback = await self.bot.recv()
180
178
  message = json.loads(callback)
181
- print(f"数据包发送后收取: \n{message}", needPrint=self.testMode)
179
+ print(f"数据包发送后收取: {message}", needPrint=self.testMode)
182
180
  #识别是否为正常信息
183
181
  try:
184
182
  #正常信息 => 缓存
@@ -20,5 +20,6 @@ def print(data: str = "", needPrint = True):
20
20
  #文件写入
21
21
  if not os.path.isdir("log"): os.makedirs("log")
22
22
  file = open(f'log/OneBotConnecter_{current_time}.log', 'a', encoding="utf-8")
23
- file.write(f"{data}\n")
23
+ now = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
24
+ file.write(f"[{now}]: {data}\n")
24
25
  file.close()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: OneBotConnecter
3
- Version: 0.3.7
3
+ Version: 0.3.8
4
4
  Summary: 基于websocket(服务器正向)连接的onebot11通用python接口
5
5
  Author-email: Sugar51243 <1733682365@qq.com>
6
6
  License: MIT License
File without changes