realhuhu / py-plugin Goto Github PK
View Code? Open in Web Editor NEWmiao py-plugin
License: GNU General Public License v3.0
miao py-plugin
License: GNU General Public License v3.0
我的某条消息的id是12731076781779739960144581948328236663737506941952
,在转字符串的过程中出现了ValueError: non-hexadecimal number found in fromhex() arg at position 41
错误,似乎是因为16进制数不是偶数位的。
[PyBot][18:17:10.481][ERROR] [plugin.manager]插件导入失败: "nonebot_plugin_minesweeper"
Traceback (most recent call last):
File "D:\A-Bot\Yunzai-Bot\plugins\py-plugin\main.py", line 13, in
nonebot.run(root)
File "D:\A-Bot\Yunzai-Bot\plugins\py-plugin\nonebot_init_.py", line 56, in run
_driver.run([str(x) for x in _driver.config.plugins])
File "D:\A-Bot\Yunzai-Bot\plugins\py-plugin\nonebot\drivers.py", line 48, in run
loop.run_until_complete(self.serve(plugins))
File "C:\Users\35840\scoop\apps\python\current\lib\asyncio\base_events.py", line 634, in run_until_complete
self.run_forever()
File "C:\Users\35840\scoop\apps\python\current\lib\asyncio\windows_events.py", line 321, in run_forever
super().run_forever()
File "C:\Users\35840\scoop\apps\python\current\lib\asyncio\base_events.py", line 601, in run_forever
self._run_once()
File "C:\Users\35840\scoop\apps\python\current\lib\asyncio\base_events.py", line 1905, in _run_once
handle._run()
File "C:\Users\35840\scoop\apps\python\current\lib\asyncio\events.py", line 80, in _run
self._context.run(self._callback, *self.args)
File "D:\A-Bot\Yunzai-Bot\plugins\py-plugin\nonebot\drivers.py", line 62, in serve
load_plugin(plugin.replace("-", ""))
File "D:\A-Bot\Yunzai-Bot\plugins\py-plugin\nonebot\plugin\load.py", line 34, in load_plugin
return manager.load_plugin(module_path)
File "D:\A-Bot\Yunzai-Bot\plugins\py-plugin\nonebot\plugin\manager.py", line 141, in load_plugin
module = importlib.import_module(name)
File "C:\Users\35840\scoop\apps\python\current\lib\importlib_init_.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "D:\A-Bot\Yunzai-Bot\plugins\py-plugin\nonebot\plugin\manager.py", line 233, in exec_module
super().exec_module(module)
File "", line 850, in exec_module
File "", line 228, in call_with_frames_removed
File "C:\Users\35840\AppData\Local\pypoetry\Cache\virtualenvs\py-plugin-07sXw6t8-py3.9\lib\site-packages\nonebot_plugin_minesweeper_init.py", line 22, in
from nonebot.adapters.onebot.v12 import Bot as V12Bot
ModuleNotFoundError: No module named 'nonebot.adapters.onebot.v12'
我加载nonebot_plugin_minesweeper的时候出现了这个
如题,希望可以使用#py更新插件[插件名]
来更新指定插件,#py更新插件
来更新所有插件。以及希望加入手动重启python服务器的指令来重新加载配置文件等。
(node:158706) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use node --trace-warnings ...
to show where the warning was created)
[YzBot][14:34:06.861][ERRO] 载入插件错误:py-plugin
[YzBot][14:34:06.862][ERRO] /home/lighthouse/YunzaiV3/Yunzai-Bot/plugins/py-plugin/index.js:1
import {exec} from "child_process";
^^^^^^
SyntaxError: Cannot use import statement outside a module
at Object.compileFunction (node:vm:360:18)
at wrapSafe (node:internal/modules/cjs/loader:1055:15)
at Module._compile (node:internal/modules/cjs/loader:1090:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
at Module.load (node:internal/modules/cjs/loader:1004:32)
at Function.Module._load (node:internal/modules/cjs/loader:839:12)
at ModuleWrap. (node:internal/modules/esm/translators:170:29)
at ModuleJob.run (node:internal/modules/esm/module_job:193:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:533:24)
https://gitee.com/TimeRainStarSky/TRSS_Yunzai/issues/I647V5
上面是我在时雨佬那边沟通的issue记录,不知道哪里出问题了orz
这个问题可以解决嘛,或者说应该怎么解决。本地装不上才用的远程。
建议把插件统一到Gitee或者使用ghproxy.com加速
该报错在机器人接收到消息后出现。
0|Yunzai-Bot | [PyBot][14:51:13.716][ERROR] [message]Error when checking Matcher.
0|Yunzai-Bot | Traceback (most recent call last):
0|Yunzai-Bot | > File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\py-plugin-4GILPm_X-py3.10\lib\site-packages\nonebot\message.py", line 457, in check_and_run_matcher
0|Yunzai-Bot | if not await _check_matcher(
0|Yunzai-Bot | File "C:\Users\Administrator\Downloads\Yunzai-Bot\plugins\py-plugin\yunzai_nonebot\hijack\message.py", line 6, in wrapper
0|Yunzai-Bot | matcher = args[0]
0|Yunzai-Bot | IndexError: tuple index out of range
尝试重新安装依赖与py插件没有解决问题。
求教大佬如何解决?
日志如下
报错.txt
Installing dependencies from lock file
No dependencies to install or update
请问是为什么呢
安装了插件,但不知道具体有哪些功能和如何使用各功能,希望作者添加相关文档
在使用nonebot_plugin_epicfree插件时遇到了调用py-plugin/nonebot/adapters/onebot/v11/bot.py
中send_group_forward_msg
失败的问题。此时messages中的元素为type为node的MessageSegment类型,需要使用i.data['nickname']
, i.data['user_id']
和i.data['content']
读取其中内容而不是i['data']['name']
, i['data']['uin']
, i['data']['content']
使用时雨脚本安装的py插件。理论上nonebot-plugin-bawiki是已经写好了picmenu的,所以能正常使用就能触发picmenu
但是尝试菜单
时找不到该插件
尝试菜单 BAWiki
时控制台报错(BAWiki是这个插件在它的init.py里设置的插件名)
最后尝试从json文件添加菜单,直接使用了参考的格式。
这是添加文件的位置,menu_config/menus文件夹是安装插件后自动生成的,所以应该不存在说放置错误。
之所以说那么多,那自然是也报错了。当我尝试菜单
时依旧看不到配置的文件
以下是我看到的完整日志(从bot启动开始)
我在隔壁也投了issue,PicMenu插件的作者认为是云崽框架导致的问题。
安装nonebot插件使用的是时雨的云崽脚本。云崽所处环境应该是MTArch
bash <(curl -L gitee.com/TimeRainStarSky/TRSS_Yunzai/raw/main/Install.sh)
俩个nonebot插件的安装过程如下
如果还有别的解决问题需要的内容的话请指导我提供 谢谢
PS C:\Yunzai-Bot\plugins\py-plugin> python install
Retrieving Poetry metadata
This will download and install the latest version of Poetry,
a dependency and package manager for Python.
It will add the poetry
command to Poetry's bin directory, located at:
C:\Users\Administrator\AppData\Roaming\Python\Scripts
You can uninstall at any time by executing this script with the --uninstall option,
and these changes will be reverted.
Installing Poetry (1.2.1)
Installing Poetry (1.2.1): Saving existing environment
Installing Poetry (1.2.1): Creating environment
Installing Poetry (1.2.1): Installing Poetry
Installing Poetry (1.2.1): An error occurred. Removing partial environment.
Installing Poetry (1.2.1): Restoring previously saved environment.
Poetry installation failed.
See C:\Yunzai-Bot\plugins\py-plugin\poetry-installer-error-arxgw6ul.log for error logs.
poetry安装完成,打开新的cmd窗口,输入poetry -V查看是否有输出
#添加米游币任务 无法绑定cookie,输入ck后bot无响应
在matcher.send
的时候拿到的dict
里的message_id是已经base64编码过的字符串,直接使用这个message_id回复消息会导致反序列化时的message_id_to_str
报错。而在消息处理时的event
里的event.message_id
是int类型的,二者不统一。
有体验过原作者(应该是原作者吧?)(https://github.com/chingkingm/honkai_mys)的插件,是可以绑定正常使用的。
但是目前在这里一直都绑定不了,也可能是格式有问题,能不能出个正确的绑定截图看看
尝试了很多种都没法成功绑定
确实会出现原神cookie拦截的情况,但是删除ltuid后,就绑定不了捏。我想是不是我格式错了,所以问问有没有正确绑定成功的截图参考一下
日志如下
[PyBot][05:31:44.890][ERROR] [plugin.manager]插件导入失败: " nonebot_plugin_dialectlist"
Traceback (most recent call last):
File "C:\Users\24551\Desktop\yz\Yunzai-Bot\plugins\py-plugin\main.py", line 15, in <module>
nonebot.run(root)
File "C:\Users\24551\Desktop\yz\Yunzai-Bot\plugins\py-plugin\nonebot\__init__.py", line 46, in run
_driver.run(filter(lambda x: x, map(str, _driver.config.plugins)))
File "C:\Users\24551\Desktop\yz\Yunzai-Bot\plugins\py-plugin\nonebot\drivers.py", line 63, in run
loop.run_until_complete(self.serve(plugins))
File "C:\Users\24551\Desktop\chat_bot\py3.10\lib\asyncio\base_events.py", line 636, in run_until_complete
self.run_forever()
File "C:\Users\24551\Desktop\chat_bot\py3.10\lib\asyncio\windows_events.py", line 321, in run_forever
super().run_forever()
File "C:\Users\24551\Desktop\chat_bot\py3.10\lib\asyncio\base_events.py", line 603, in run_forever
self._run_once()
File "C:\Users\24551\Desktop\chat_bot\py3.10\lib\asyncio\base_events.py", line 1899, in _run_once
handle._run()
File "C:\Users\24551\Desktop\chat_bot\py3.10\lib\asyncio\events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "C:\Users\24551\Desktop\yz\Yunzai-Bot\plugins\py-plugin\nonebot\drivers.py", line 69, in serve
load_plugin(plugin.replace("-", "_"))
File "C:\Users\24551\Desktop\yz\Yunzai-Bot\plugins\py-plugin\nonebot\plugin\load.py", line 35, in load_plugin
return manager.load_plugin(module_path)
> File "C:\Users\24551\Desktop\yz\Yunzai-Bot\plugins\py-plugin\nonebot\plugin\manager.py", line 141, in load_plugin
module = importlib.import_module(name)
File "C:\Users\24551\Desktop\chat_bot\py3.10\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named ' nonebot_plugin_dialectlist'
[PyBot][05:31:44.899][ERROR] [plugin.manager]插件导入失败: " nonebot_plugin_picstatus"
Traceback (most recent call last):
File "C:\Users\24551\Desktop\yz\Yunzai-Bot\plugins\py-plugin\main.py", line 15, in <module>
nonebot.run(root)
File "C:\Users\24551\Desktop\yz\Yunzai-Bot\plugins\py-plugin\nonebot\__init__.py", line 46, in run
_driver.run(filter(lambda x: x, map(str, _driver.config.plugins)))
File "C:\Users\24551\Desktop\yz\Yunzai-Bot\plugins\py-plugin\nonebot\drivers.py", line 63, in run
loop.run_until_complete(self.serve(plugins))
File "C:\Users\24551\Desktop\chat_bot\py3.10\lib\asyncio\base_events.py", line 636, in run_until_complete
self.run_forever()
File "C:\Users\24551\Desktop\chat_bot\py3.10\lib\asyncio\windows_events.py", line 321, in run_forever
super().run_forever()
File "C:\Users\24551\Desktop\chat_bot\py3.10\lib\asyncio\base_events.py", line 603, in run_forever
self._run_once()
File "C:\Users\24551\Desktop\chat_bot\py3.10\lib\asyncio\base_events.py", line 1899, in _run_once
handle._run()
File "C:\Users\24551\Desktop\chat_bot\py3.10\lib\asyncio\events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "C:\Users\24551\Desktop\yz\Yunzai-Bot\plugins\py-plugin\nonebot\drivers.py", line 69, in serve
load_plugin(plugin.replace("-", "_"))
File "C:\Users\24551\Desktop\yz\Yunzai-Bot\plugins\py-plugin\nonebot\plugin\load.py", line 35, in load_plugin
return manager.load_plugin(module_path)
> File "C:\Users\24551\Desktop\yz\Yunzai-Bot\plugins\py-plugin\nonebot\plugin\manager.py", line 141, in load_plugin
module = importlib.import_module(name)
File "C:\Users\24551\Desktop\chat_bot\py3.10\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named ' nonebot_plugin_picstatus'
如果在#py下载插件
指令和插件名之间有空格的话,会在config.yaml里插入" 插件名"
而不是插件名
导致启动时加载失败。
发送命令 #运行状态 或 #status 均报错
报错如下(由于实在是太长,只能发文件)
报错.txt
实测nonebot原生运行无问题 但py插件无法使用该插件
from nonebot import Bot
from nonebot.params import CommandArg, EventMessage
from nonebot.matcher import Matcher
from nonebot.adapters.onebot.v11 import (
Message,
MessageSegment,
MessageEvent,
GroupMessageEvent,
PrivateMessageEvent,
)
async def test(
bot: Bot,
event: MessageEvent,
matcher: Matcher,
arg: Message = CommandArg(),
user_data: Optional[UserData] = None,
):
await matcher.finish(MessageSegment.reply(event.message_id) + MessageSegment.at(event.sender.user_id) + MessageSegment.text('test'))
这样产生的消息没有引用效果,只有at和'test‘文本。
昨天装mcstatus插件的时候遇到了无法从nonebot中import get_bots的问题。我自己在py-plugin/nonebot/__init__.py
中插入了下列实现作为workaround。
from typing import Dict
def get_bots() -> Dict[str, Bot]:
return {'default':get_bot()}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.