Code Monkey home page Code Monkey logo

py-plugin's People

Contributors

hbj2457 avatar realhuhu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

py-plugin's Issues

似乎是适配器的事

[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的时候出现了这个

导入gspanel之后出现的问题

image
导入gspanel之后出现的问题上图是导入后的,下图是导入前的
image
下面是config.yaml配置项
image
请问这是什么原因,还有其他人碰到这个问题吗

启动错误

(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)

运行米游社兑换插件报错

输入完cookie以后报错

UnicodeEncodeError: 'ascii' codec can't encode characters in position 1-2: ordinal not in range(128)

image
Python版本是3.9.2
image

python install安装问题

执行python install后提示poetry安装完成,但是输入poetry -V提示bash: poetry: command not found
20220907

error when checking matcher

该报错在机器人接收到消息后出现。

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插件没有解决问题。
求教大佬如何解决?

send_group_forward_msg方法无法处理messages为MessageSegment的node消息

在使用nonebot_plugin_epicfree插件时遇到了调用py-plugin/nonebot/adapters/onebot/v11/bot.pysend_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']

PicMenu插件显示/报错异常

使用时雨脚本安装的py插件。理论上nonebot-plugin-bawiki是已经写好了picmenu的,所以能正常使用就能触发picmenu
但是尝试菜单时找不到该插件
image
尝试菜单 BAWiki时控制台报错(BAWiki是这个插件在它的init.py里设置的插件名)
WE$0L_}TIDE3R8T J{35WD9
最后尝试从json文件添加菜单,直接使用了参考的格式
image
这是添加文件的位置,menu_config/menus文件夹是安装插件后自动生成的,所以应该不存在说放置错误。
image
之所以说那么多,那自然是也报错了。当我尝试菜单时依旧看不到配置的文件
image
以下是我看到的完整日志(从bot启动开始)
GR6JBD6@MVZP7LZFIN))WCK

我在隔壁也投了issue,PicMenu插件的作者认为是云崽框架导致的问题

安装nonebot插件使用的是时雨的云崽脚本。云崽所处环境应该是MTArch
bash <(curl -L gitee.com/TimeRainStarSky/TRSS_Yunzai/raw/main/Install.sh)
俩个nonebot插件的安装过程如下
image

如果还有别的解决问题需要的内容的话请指导我提供 谢谢

在WIndows环境下,Powershell和GitBash均显示乱码

image

在Powershell Code Page 为 65001
image

在GitBash下已经设置为utf8
image

在yaml也设置成了 utf8 (但是奇怪的是设置成gkb则不会乱码)

我并不了解python,不知道在poetry虚拟环境中会不会影响到使用其他的coding

不知道是否有人可以解答我的疑问?

python install安装失败

PS C:\Yunzai-Bot\plugins\py-plugin> python install

安装poetry中...

Retrieving Poetry metadata

Welcome to Poetry!

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查看是否有输出

`message_id`类型不统一

matcher.send的时候拿到的dict里的message_id是已经base64编码过的字符串,直接使用这个message_id回复消息会导致反序列化时的message_id_to_str报错。而在消息处理时的event里的event.message_id是int类型的,二者不统一。

崩坏三插件无法绑定cookie

有体验过原作者(应该是原作者吧?)(https://github.com/chingkingm/honkai_mys)的插件,是可以绑定正常使用的。
但是目前在这里一直都绑定不了,也可能是格式有问题,能不能出个正确的绑定截图看看
尝试了很多种都没法成功绑定
2(5ILC`YW4A34N@ZYP)VDQH
确实会出现原神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插件载入错误

更新pnpm之后掉依赖了,然后重新安装依赖之后,插件就一直载入失败
OGEN0X(5 MB0$)6RX)~ _Q

`MessageSegment.reply`消息无效

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‘文本。

没有get_bots方法

昨天装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()}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.