nonebot-plugin-latex 0.0.3__tar.gz → 0.0.3.1__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (16) hide show
  1. {nonebot_plugin_latex-0.0.3 → nonebot_plugin_latex-0.0.3.1}/PKG-INFO +3 -4
  2. {nonebot_plugin_latex-0.0.3 → nonebot_plugin_latex-0.0.3.1}/nonebot_plugin_latex/__init__.py +5 -7
  3. {nonebot_plugin_latex-0.0.3 → nonebot_plugin_latex-0.0.3.1}/nonebot_plugin_latex/main.py +14 -26
  4. {nonebot_plugin_latex-0.0.3 → nonebot_plugin_latex-0.0.3.1}/nonebot_plugin_latex.egg-info/PKG-INFO +3 -4
  5. nonebot_plugin_latex-0.0.3.1/nonebot_plugin_latex.egg-info/requires.txt +3 -0
  6. {nonebot_plugin_latex-0.0.3 → nonebot_plugin_latex-0.0.3.1}/pyproject.toml +6 -4
  7. nonebot_plugin_latex-0.0.3/nonebot_plugin_latex.egg-info/requires.txt +0 -4
  8. {nonebot_plugin_latex-0.0.3 → nonebot_plugin_latex-0.0.3.1}/LICENSE +0 -0
  9. {nonebot_plugin_latex-0.0.3 → nonebot_plugin_latex-0.0.3.1}/README.md +0 -0
  10. {nonebot_plugin_latex-0.0.3 → nonebot_plugin_latex-0.0.3.1}/nonebot_plugin_latex/config.py +0 -0
  11. {nonebot_plugin_latex-0.0.3 → nonebot_plugin_latex-0.0.3.1}/nonebot_plugin_latex/converter.py +0 -0
  12. {nonebot_plugin_latex-0.0.3 → nonebot_plugin_latex-0.0.3.1}/nonebot_plugin_latex/data.py +0 -0
  13. {nonebot_plugin_latex-0.0.3 → nonebot_plugin_latex-0.0.3.1}/nonebot_plugin_latex.egg-info/SOURCES.txt +0 -0
  14. {nonebot_plugin_latex-0.0.3 → nonebot_plugin_latex-0.0.3.1}/nonebot_plugin_latex.egg-info/dependency_links.txt +0 -0
  15. {nonebot_plugin_latex-0.0.3 → nonebot_plugin_latex-0.0.3.1}/nonebot_plugin_latex.egg-info/top_level.txt +0 -0
  16. {nonebot_plugin_latex-0.0.3 → nonebot_plugin_latex-0.0.3.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: nonebot-plugin-latex
3
- Version: 0.0.3
3
+ Version: 0.0.3.1
4
4
  Summary: 通过互联网公共服务渲染LaTeX公式
5
5
  Author-email: Eilles <EillesWan@outlook.com>
6
6
  License: 木兰宽松许可证, 第2版
@@ -136,10 +136,9 @@ Project-URL: Bug Tracker, https://github.com/EillesWan/nonebot-plugin-latex/issu
136
136
  Requires-Python: <4.0,>=3.9
137
137
  Description-Content-Type: text/markdown
138
138
  License-File: LICENSE
139
- Requires-Dist: nonebot2
139
+ Requires-Dist: nonebot2<1000.0.0,>=2.2.0
140
140
  Requires-Dist: httpx<0.28.0,>=0.27.0
141
- Requires-Dist: nonebot-adapter-onebot
142
- Requires-Dist: nonebot-plugin-alconna
141
+ Requires-Dist: nonebot-plugin-alconna<1000.0.0,>=0.48.0
143
142
 
144
143
  # nonebot-plugin-latex
145
144
 
@@ -14,25 +14,23 @@ See the Mulan PSL v2 for more details.
14
14
  """
15
15
 
16
16
  from nonebot import get_plugin_config, get_driver
17
- from nonebot.plugin import PluginMetadata
17
+ from nonebot.plugin import PluginMetadata, inherit_supported_adapters
18
18
 
19
19
  from .config import Config
20
20
  from .converter import _converter, get_converter
21
21
 
22
- __version__ = "0.0.3"
22
+ __version__ = "0.0.3.1"
23
23
 
24
24
  __author__ = "Eilles"
25
25
 
26
26
  __plugin_meta__ = PluginMetadata(
27
- name="LaTeX图形渲染插件",
28
- description="从互联网服务渲染LaTeX公式并发送",
27
+ name="LaTeX 在线渲染插件",
28
+ description="从互联网服务渲染 LaTeX 公式",
29
29
  usage="发送 latex 或 公式,后接内容或回复公式信息。",
30
30
  type="library",
31
31
  homepage="https://github.com/EillesWan/nonebot-plugin-latex",
32
32
  config=Config,
33
- supported_adapters={
34
- "~onebot.v11",
35
- },
33
+ supported_adapters=inherit_supported_adapters("nonebot_plugin_alconna"),
36
34
  extra={"License": "Mulan PSL v2", "Author": __author__},
37
35
  )
38
36
 
@@ -15,17 +15,17 @@ See the Mulan PSL v2 for more details.
15
15
 
16
16
  import nonebot
17
17
 
18
- from nonebot.adapters.onebot.v11 import MessageEvent
18
+ from nonebot_plugin_alconna.uniseg import Text
19
19
 
20
- # from nonebot.matcher import Matcher
21
20
 
22
21
  nonebot.require("nonebot_plugin_alconna")
23
22
 
24
- # from nonebot_plugin_alconna.util import annotation
25
23
  from nonebot_plugin_alconna import (
26
24
  Image as Alconna_Image,
25
+ Reply,
27
26
  Text as Alconnna_Text,
28
27
  UniMessage,
28
+ UniMsg
29
29
  )
30
30
 
31
31
  from .data import LATEX_PATTERN
@@ -47,29 +47,16 @@ command_heads = (
47
47
 
48
48
 
49
49
  async def check_for_scan(
50
- event: MessageEvent,
50
+ msg: UniMsg,
51
51
  # state: T_State,
52
52
  ) -> bool:
53
53
  """
54
54
  检查是否为 LaTeX 指令
55
55
  """
56
-
57
- # print("检查消息满足渲染要求:", event)
58
- if isinstance(event, MessageEvent):
59
- # print("此为原始信息:", event.raw_message)
60
- # event.message
61
- for msg in event.message:
62
- # print("这是其中一个信息---", msg)
63
- if msg.type == "text" and (msgdata := msg.data["text"].strip()):
64
- if msgdata.startswith(command_heads):
65
-
66
- # print("判断:这确实是指令发出")
67
- return True
68
- else:
69
- # print("判断:这不是指令")
70
- return False
71
- return False
72
- return False
56
+ return any(
57
+ isinstance(seg, Text) and seg.text.strip().startswith(command_heads)
58
+ for seg in msg
59
+ )
73
60
 
74
61
 
75
62
  latexg = nonebot.on_message(
@@ -81,18 +68,19 @@ latexg = nonebot.on_message(
81
68
 
82
69
  @latexg.handle()
83
70
  async def handle_pic(
84
- event: MessageEvent,
71
+ msgs: UniMsg,
85
72
  # state: T_State,
86
73
  # arg: Optional[Message] = CommandArg(),
87
74
  ):
88
75
  # print("正在解决reply指令……")
89
76
  latexes = []
90
- if event.reply:
91
- latexes.extend(LATEX_PATTERN.finditer(event.reply.message.extract_plain_text()))
77
+ if msgs.has(Reply):
78
+ i = msgs[Reply, 0]
79
+ if i.msg:
80
+ latexes.extend(LATEX_PATTERN.finditer(i.msg if isinstance(i.msg, str) else i.msg.extract_plain_text()))
92
81
 
93
82
  # print(arg)
94
- if event.message:
95
- latexes.extend(LATEX_PATTERN.finditer(event.message.extract_plain_text()))
83
+ latexes.extend(LATEX_PATTERN.finditer(msgs.extract_plain_text()))
96
84
 
97
85
  if not latexes:
98
86
  await latexg.finish(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: nonebot-plugin-latex
3
- Version: 0.0.3
3
+ Version: 0.0.3.1
4
4
  Summary: 通过互联网公共服务渲染LaTeX公式
5
5
  Author-email: Eilles <EillesWan@outlook.com>
6
6
  License: 木兰宽松许可证, 第2版
@@ -136,10 +136,9 @@ Project-URL: Bug Tracker, https://github.com/EillesWan/nonebot-plugin-latex/issu
136
136
  Requires-Python: <4.0,>=3.9
137
137
  Description-Content-Type: text/markdown
138
138
  License-File: LICENSE
139
- Requires-Dist: nonebot2
139
+ Requires-Dist: nonebot2<1000.0.0,>=2.2.0
140
140
  Requires-Dist: httpx<0.28.0,>=0.27.0
141
- Requires-Dist: nonebot-adapter-onebot
142
- Requires-Dist: nonebot-plugin-alconna
141
+ Requires-Dist: nonebot-plugin-alconna<1000.0.0,>=0.48.0
143
142
 
144
143
  # nonebot-plugin-latex
145
144
 
@@ -0,0 +1,3 @@
1
+ nonebot2<1000.0.0,>=2.2.0
2
+ httpx<0.28.0,>=0.27.0
3
+ nonebot-plugin-alconna<1000.0.0,>=0.48.0
@@ -1,13 +1,12 @@
1
1
  [project]
2
2
  name = "nonebot-plugin-latex"
3
- version = "0.0.3"
3
+ version = "0.0.3.1"
4
4
  description = "通过互联网公共服务渲染LaTeX公式"
5
5
  authors = [{ name = "Eilles", email = "EillesWan@outlook.com" }]
6
6
  dependencies = [
7
- "nonebot2",
7
+ "nonebot2>=2.2.0,<1000.0.0",
8
8
  "httpx>=0.27.0,<0.28.0",
9
- "nonebot-adapter-onebot",
10
- "nonebot-plugin-alconna",
9
+ "nonebot-plugin-alconna>=0.48.0,<1000.0.0",
11
10
  ]
12
11
  requires-python = ">=3.9,<4.0"
13
12
  readme = "README.md"
@@ -16,3 +15,6 @@ license = { file = "LICENSE" }
16
15
  [project.urls]
17
16
  "Homepage" = "https://github.com/EillesWan/nonebot-plugin-latex"
18
17
  "Bug Tracker" = "https://github.com/EillesWan/nonebot-plugin-latex/issues"
18
+
19
+ [tool.pyright]
20
+ typeCheckingMode = "standard"
@@ -1,4 +0,0 @@
1
- nonebot2
2
- httpx<0.28.0,>=0.27.0
3
- nonebot-adapter-onebot
4
- nonebot-plugin-alconna