molanp / zhenxun_plugin_niuniu

真寻群内小游戏插件牛牛大作战;也支持nonebot
GNU General Public License v3.0
16 stars 6 forks source link

【功能请求】可以移植到nonebot上嘛 #15

Open ElaineOwO opened 7 months ago

ElaineOwO commented 7 months ago

rt 球球了我什么都会做的(砰砰砰

molanp commented 7 months ago

可以的,最近会着手去做

ElaineOwO commented 7 months ago

可以的,最近会着手去做

哇 太感谢了 请问大佬有群嘛

molanp commented 7 months ago

可以的,最近会着手去做

哇 太感谢了 请问大佬有群嘛

啊?没有的,只是一个普通的插件为什么会有交流群()

ElaineOwO commented 7 months ago

可以的,最近会着手去做

哇 太感谢了 请问大佬有群嘛

啊?没有的,只是一个普通的插件为什么会有交流群()

嗯好吧 总之感谢更新~

molanp commented 7 months ago

我没有测试,理论上看是没问题的,你先测试一下 f796acb3ee1eb15a8ffb9f21e67ea5470a6a5430 @ElaineOwO

ElaineOwO commented 7 months ago

我没有测试,理论上看是没问题的,你先测试一下 f796acb @ElaineOwO

好的,我逝世看

ElaineOwO commented 7 months ago

我没有测试,理论上看是没问题的,你先测试一下 f796acb @ElaineOwO

报错力

04-14 00:22:01 [ERROR] nonebot | Failed to import "niuniu"
Traceback (most recent call last):
  File "<string>", line 12, in <module>
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\plugin\load.py", line 130, in load_from_toml
    return load_all_plugins(plugins, plugin_dirs)
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\plugin\load.py", line 64, in load_all_plugins
    return manager.load_all_plugins()
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\plugin\manager.py", line 176, in load_all_plugins
    return set(
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\plugin\manager.py", line 177, in <genexpr>
    filter(None, (self.load_plugin(name) for name in self.available_plugins))
> File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\plugin\manager.py", line 144, in load_plugin
    module = importlib.import_module(self._third_party_plugin_names[name])
  File "C:\Users\BOT\AppData\Local\Programs\Python\Python310\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 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\plugin\manager.py", line 242, in exec_module
    super().exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "C:\Users\BOT\Desktop\BOT\xyl\src\plugins\niuniu\__init__.py", line 4, in <module>
    from .image_utils import is_number, image, text2image
  File "C:\Users\BOT\Desktop\BOT\xyl\src\plugins\niuniu\image_utils.py", line 244
    self.draw = ImageDraw.Draw(self.markImg)
IndentationError: expected an indented block after 'except' statement on line 242
molanp commented 7 months ago

嗯... 加个pass

242 except Exception as e:
243              pass
244                #logger.warning(f"背景透明化发生错误..{type(e)}:{e}")

f622eb9818500238d763f99f8220cc8ecd7c0cd7

ElaineOwO commented 7 months ago

嗯... 加个pass

242 except Exception as e:
243              pass
244                #logger.warning(f"背景透明化发生错误..{type(e)}:{e}")

f622eb9

变成缺少模组了

04-14 00:31:22 [ERROR] nonebot | Failed to import "niuniu"
Traceback (most recent call last):
  File "<string>", line 12, in <module>
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\plugin\load.py", line 130, in load_from_toml
    return load_all_plugins(plugins, plugin_dirs)
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\plugin\load.py", line 64, in load_all_plugins
    return manager.load_all_plugins()
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\plugin\manager.py", line 176, in load_all_plugins
    return set(
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\plugin\manager.py", line 177, in <genexpr>
    filter(None, (self.load_plugin(name) for name in self.available_plugins))
> File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\plugin\manager.py", line 144, in load_plugin
    module = importlib.import_module(self._third_party_plugin_names[name])
  File "C:\Users\BOT\AppData\Local\Programs\Python\Python310\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 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\plugin\manager.py", line 242, in exec_module
    super().exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "C:\Users\BOT\Desktop\BOT\xyl\src\plugins\niuniu\__init__.py", line 4, in <module>
    from .image_utils import is_number, image, text2image
  File "C:\Users\BOT\Desktop\BOT\xyl\src\plugins\niuniu\image_utils.py", line 13, in <module>
    import imagehash
ModuleNotFoundError: No module named 'imagehash'
molanp commented 7 months ago

pip一下 忘写了这个依赖

ElaineOwO commented 7 months ago

pip一下 忘写了这个依赖

又出现变量问题了

04-14 00:37:02 [ERROR] nonebot | Failed to import "niuniu"
Traceback (most recent call last):
  File "<string>", line 12, in <module>
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\plugin\load.py", line 130, in load_from_toml
    return load_all_plugins(plugins, plugin_dirs)
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\plugin\load.py", line 64, in load_all_plugins
    return manager.load_all_plugins()
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\plugin\manager.py", line 176, in load_all_plugins
    return set(
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\plugin\manager.py", line 177, in <genexpr>
    filter(None, (self.load_plugin(name) for name in self.available_plugins))
> File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\plugin\manager.py", line 144, in load_plugin
    module = importlib.import_module(self._third_party_plugin_names[name])
  File "C:\Users\BOT\AppData\Local\Programs\Python\Python310\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 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\plugin\manager.py", line 242, in exec_module
    super().exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "C:\Users\BOT\Desktop\BOT\xyl\src\plugins\niuniu\__init__.py", line 9, in <module>
    from .data_source import *
  File "C:\Users\BOT\Desktop\BOT\xyl\src\plugins\niuniu\data_source.py", line 14, in <module>
    IMAGE_PATH = Path() / "image"
NameError: name 'Path' is not defined
molanp commented 7 months ago

那个文件开头加上

from pathlib import Path
ElaineOwO commented 7 months ago

那个文件开头加上

from pathlib import Path

启动好像没问题了,我再测逝一下功能。 话说插件里可以设置命令开头嘛?

molanp commented 7 months ago

没提供,不过你可以直接修改on_command函数的第一个参数,那个是触发命令 一般建议在.env.dev文件设置前缀

COMMAND_START=["/"]  # 配置命令起始字符
ElaineOwO commented 7 months ago

没提供,不过你可以直接修改on_command函数的第一个参数,那个是触发命令 一般建议在.env.dev文件设置前缀

COMMAND_START=["/"]  # 配置命令起始字符

好的,我先运行一段时间看看叭 群里已经变成聚众yp现场勒

molanp commented 7 months ago

没提供,不过你可以直接修改on_command函数的第一个参数,那个是触发命令 一般建议在.env.dev文件设置前缀

COMMAND_START=["/"]  # 配置命令起始字符

好的,我先运行一段时间看看叭 群里已经变成聚众yp现场勒

这么快已经玩上了吗() 建议先看一下排行榜能不能生成,毕竟只有这一个模块是移植自真寻

ElaineOwO commented 7 months ago

没提供,不过你可以直接修改on_command函数的第一个参数,那个是触发命令 一般建议在.env.dev文件设置前缀

COMMAND_START=["/"]  # 配置命令起始字符

好的,我先运行一段时间看看叭 群里已经变成聚众yp现场勒

这么快已经玩上了吗() 建议先看一下排行榜能不能生成,毕竟只有这一个模块是移植自真寻

果然生成图片出现问题勒

04-14 00:52:06 [ERROR] nonebot | Running Matcher(type='message', module=src.plugins.niuniu, lineno=33) failed.
Traceback (most recent call last):
  File "<string>", line 15, in <module>
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\__init__.py", line 334, in run
    get_driver().run(*args, **kwargs)
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\drivers\fastapi.py", line 186, in run
    uvicorn.run(
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\uvicorn\main.py", line 587, in run
    server.run()
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\uvicorn\server.py", line 61, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "C:\Users\BOT\AppData\Local\Programs\Python\Python310\lib\asyncio\runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "C:\Users\BOT\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 636, in run_until_complete
    self.run_forever()
  File "C:\Users\BOT\AppData\Local\Programs\Python\Python310\lib\asyncio\windows_events.py", line 321, in run_forever
    super().run_forever()
  File "C:\Users\BOT\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 603, in run_forever
    self._run_once()
  File "C:\Users\BOT\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 1909, in _run_once
    handle._run()
  File "C:\Users\BOT\AppData\Local\Programs\Python\Python310\lib\asyncio\events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\message.py", line 476, in check_and_run_matcher
    await _run_matcher(
> File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\message.py", line 428, in _run_matcher
    await matcher.run(bot, event, state, stack, dependency_cache)
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\internal\matcher\matcher.py", line 842, in run
    await self.simple_run(bot, event, state, stack, dependency_cache)
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\internal\matcher\matcher.py", line 817, in simple_run
    await handler(
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\dependencies\__init__.py", line 106, in __call__
    return await cast(Callable[..., Awaitable[R]], self.call)(**values)
  File "C:\Users\BOT\Desktop\BOT\xyl\src\plugins\niuniu\__init__.py", line 212, in _
    rank_image = await init_rank("牛子长度排行榜-单位cm", all_user_id, all_user_data, event.group_id, num)
  File "C:\Users\BOT\Desktop\BOT\xyl\src\plugins\niuniu\data_source.py", line 238, in init_rank
    return await asyncio.get_event_loop().run_in_executor(
  File "C:\Users\BOT\AppData\Local\Programs\Python\Python310\lib\concurrent\futures\thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "C:\Users\BOT\Desktop\BOT\xyl\src\plugins\niuniu\data_source.py", line 261, in _init_rank_graph
    for x in os.listdir(f"{IMAGE_PATH}/")
FileNotFoundError: [WinError 3] 系统找不到指定的路径。: 'image/'
molanp commented 7 months ago

没提供,不过你可以直接修改on_command函数的第一个参数,那个是触发命令 一般建议在.env.dev文件设置前缀

COMMAND_START=["/"]  # 配置命令起始字符

试试这个 d728fe3fd95950f64e2e8b4502bf96d14c98f5ff

ElaineOwO commented 7 months ago

没提供,不过你可以直接修改on_command函数的第一个参数,那个是触发命令 一般建议在.env.dev文件设置前缀

COMMAND_START=["/"]  # 配置命令起始字符

试试这个 d728fe3

04-14 01:03:49 [ERROR] nonebot | Running Matcher(type='message', module=src.plugins.niuniu, lineno=33) failed.
Traceback (most recent call last):
  File "<string>", line 15, in <module>
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\__init__.py", line 334, in run
    get_driver().run(*args, **kwargs)
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\drivers\fastapi.py", line 186, in run
    uvicorn.run(
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\uvicorn\main.py", line 587, in run
    server.run()
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\uvicorn\server.py", line 61, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "C:\Users\BOT\AppData\Local\Programs\Python\Python310\lib\asyncio\runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "C:\Users\BOT\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 636, in run_until_complete
    self.run_forever()
  File "C:\Users\BOT\AppData\Local\Programs\Python\Python310\lib\asyncio\windows_events.py", line 321, in run_forever
    super().run_forever()
  File "C:\Users\BOT\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 603, in run_forever
    self._run_once()
  File "C:\Users\BOT\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 1909, in _run_once
    handle._run()
  File "C:\Users\BOT\AppData\Local\Programs\Python\Python310\lib\asyncio\events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\message.py", line 476, in check_and_run_matcher
    await _run_matcher(
> File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\message.py", line 428, in _run_matcher
    await matcher.run(bot, event, state, stack, dependency_cache)
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\internal\matcher\matcher.py", line 842, in run
    await self.simple_run(bot, event, state, stack, dependency_cache)
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\internal\matcher\matcher.py", line 817, in simple_run
    await handler(
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\dependencies\__init__.py", line 106, in __call__
    return await cast(Callable[..., Awaitable[R]], self.call)(**values)
  File "C:\Users\BOT\Desktop\BOT\xyl\src\plugins\niuniu\__init__.py", line 212, in _
    rank_image = await init_rank("牛牛长度排行榜-单位cm", all_user_id, all_user_data, event.group_id, num)
  File "C:\Users\BOT\Desktop\BOT\xyl\src\plugins\niuniu\data_source.py", line 237, in init_rank
    return await asyncio.get_event_loop().run_in_executor(
  File "C:\Users\BOT\AppData\Local\Programs\Python\Python310\lib\concurrent\futures\thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "C:\Users\BOT\Desktop\BOT\xyl\src\plugins\niuniu\data_source.py", line 264, in _init_rank_graph
    image.gen_graph()
  File "C:\Users\BOT\Desktop\BOT\xyl\src\plugins\niuniu\image_utils.py", line 1065, in gen_graph
    self.markImg = self._init_graph(
  File "C:\Users\BOT\Desktop\BOT\xyl\src\plugins\niuniu\image_utils.py", line 1337, in _init_graph
    A = BuildImage(
  File "C:\Users\BOT\Desktop\BOT\xyl\src\plugins\niuniu\image_utils.py", line 204, in __init__
    self.font = ImageFont.truetype(str(FONT_PATH / font), int(font_size))
TypeError: unsupported operand type(s) for /: 'str' and 'str'

变成这样勒 好像是字体的问题?

molanp commented 7 months ago

是相对路径问题,现在应该可以了

3e8dce9bc6d5dfb1df11f583575ed7670e467358

ElaineOwO commented 7 months ago

是相对路径问题,现在应该可以了

3e8dce9

嗯? 刚刚看到是两个文件三个删除四个添加, 刷新了一下变成只有一个from pathlib import Path了

ElaineOwO commented 7 months ago

对了,有没有什么办法可以让用户用指令删除自己的数据,有人被一堆人薅到破防了(233

molanp commented 7 months ago

是相对路径问题,现在应该可以了

3e8dce9

嗯? 刚刚看到是两个文件三个删除四个添加, 刷新了一下变成只有一个from pathlib import Path了

因为又提交了一次,之前少加了一个模块,你看到的可能是 76de9f615e4c7a5d3e334355c6652fa1d0364b67 和 3e8dce9bc6d5dfb1df11f583575ed7670e467358

molanp commented 7 months ago

对了,有没有什么办法可以让用户用指令删除自己的数据,有人被一堆人薅到破防了(233

可以增加一个指令,用于注销牛子,也可以直接去long.json里删掉2333

ElaineOwO commented 7 months ago

对了,有没有什么办法可以让用户用指令删除自己的数据,有人被一堆人薅到破防了(233

可以增加一个指令,用于注销牛子,也可以直接去long.json里删掉2333

那就麻烦大佬加上啦 小白完全不懂——

ElaineOwO commented 7 months ago

是相对路径问题,现在应该可以了 3e8dce9

嗯? 刚刚看到是两个文件三个删除四个添加, 刷新了一下变成只有一个from pathlib import Path了

因为又提交了一次,之前少加了一个模块,你看到的可能是 76de9f63e8dce9

还是布星

04-14 01:28:01 [ERROR] nonebot | Running Matcher(type='message', module=src.plugins.niuniu, lineno=33) failed.
Traceback (most recent call last):
  File "<string>", line 15, in <module>
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\__init__.py", line 334, in run
    get_driver().run(*args, **kwargs)
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\drivers\fastapi.py", line 186, in run
    uvicorn.run(
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\uvicorn\main.py", line 587, in run
    server.run()
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\uvicorn\server.py", line 61, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "C:\Users\BOT\AppData\Local\Programs\Python\Python310\lib\asyncio\runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "C:\Users\BOT\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 636, in run_until_complete
    self.run_forever()
  File "C:\Users\BOT\AppData\Local\Programs\Python\Python310\lib\asyncio\windows_events.py", line 321, in run_forever
    super().run_forever()
  File "C:\Users\BOT\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 603, in run_forever
    self._run_once()
  File "C:\Users\BOT\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 1909, in _run_once
    handle._run()
  File "C:\Users\BOT\AppData\Local\Programs\Python\Python310\lib\asyncio\events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\message.py", line 476, in check_and_run_matcher
    await _run_matcher(
> File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\message.py", line 428, in _run_matcher
    await matcher.run(bot, event, state, stack, dependency_cache)
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\internal\matcher\matcher.py", line 842, in run
    await self.simple_run(bot, event, state, stack, dependency_cache)
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\internal\matcher\matcher.py", line 817, in simple_run
    await handler(
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\dependencies\__init__.py", line 106, in __call__
    return await cast(Callable[..., Awaitable[R]], self.call)(**values)
  File "C:\Users\BOT\Desktop\BOT\xyl\src\plugins\niuniu\__init__.py", line 212, in _
    rank_image = await init_rank("牛牛长度排行榜-单位cm", all_user_id, all_user_data, event.group_id, num)
  File "C:\Users\BOT\Desktop\BOT\xyl\src\plugins\niuniu\data_source.py", line 238, in init_rank
    return await asyncio.get_event_loop().run_in_executor(
  File "C:\Users\BOT\AppData\Local\Programs\Python\Python310\lib\concurrent\futures\thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "C:\Users\BOT\Desktop\BOT\xyl\src\plugins\niuniu\data_source.py", line 265, in _init_rank_graph
    image.gen_graph()
  File "C:\Users\BOT\Desktop\BOT\xyl\src\plugins\niuniu\image_utils.py", line 1064, in gen_graph
    self.markImg = self._init_graph(
  File "C:\Users\BOT\Desktop\BOT\xyl\src\plugins\niuniu\image_utils.py", line 1336, in _init_graph
    A = BuildImage(
  File "C:\Users\BOT\Desktop\BOT\xyl\src\plugins\niuniu\image_utils.py", line 231, in __init__
    (self.w, self.h), Image.ANTIALIAS
AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS'
ElaineOwO commented 7 months ago

变成魅魔后发'我的牛子'也报错咧

04-14 01:33:07 [ERROR] nonebot | Running Matcher(type='message', module=src.plugins.niuniu, lineno=32) failed.
Traceback (most recent call last):
  File "C:\Users\BOT\Desktop\BOT\xyl\src\plugins\niuniu\__init__.py", line 142, in _
    result = f"wtf?你已经进化成魅魔了!当前深度{format(my_long,'.1f')}cm" + image(b64=(await text2image("魅魔\n说明:\n击剑时有20%的几率消耗自身长度吞噬对方牛牛", color="#f9f6f2", padding=10)).pic2bs4())
  File "C:\Users\BOT\Desktop\BOT\xyl\src\plugins\niuniu\image_utils.py", line 1607, in text2image
    _, h = _tmp.getsize("正")
  File "C:\Users\BOT\Desktop\BOT\xyl\src\plugins\niuniu\image_utils.py", line 368, in getsize
    return self.font.getsize(str(msg))  # type: ignore
AttributeError: 'FreeTypeFont' object has no attribute 'getsize'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 15, in <module>
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\__init__.py", line 334, in run
    get_driver().run(*args, **kwargs)
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\drivers\fastapi.py", line 186, in run
    uvicorn.run(
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\uvicorn\main.py", line 587, in run
    server.run()
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\uvicorn\server.py", line 61, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "C:\Users\BOT\AppData\Local\Programs\Python\Python310\lib\asyncio\runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "C:\Users\BOT\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 636, in run_until_complete
    self.run_forever()
  File "C:\Users\BOT\AppData\Local\Programs\Python\Python310\lib\asyncio\windows_events.py", line 321, in run_forever
    super().run_forever()
  File "C:\Users\BOT\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 603, in run_forever
    self._run_once()
  File "C:\Users\BOT\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 1909, in _run_once
    handle._run()
  File "C:\Users\BOT\AppData\Local\Programs\Python\Python310\lib\asyncio\events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\message.py", line 476, in check_and_run_matcher
    await _run_matcher(
> File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\message.py", line 428, in _run_matcher
    await matcher.run(bot, event, state, stack, dependency_cache)
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\internal\matcher\matcher.py", line 842, in run
    await self.simple_run(bot, event, state, stack, dependency_cache)
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\internal\matcher\matcher.py", line 817, in simple_run
    await handler(
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\dependencies\__init__.py", line 106, in __call__
    return await cast(Callable[..., Awaitable[R]], self.call)(**values)
  File "C:\Users\BOT\Desktop\BOT\xyl\src\plugins\niuniu\__init__.py", line 194, in _
    await niuzi_my.finish(Message(result),at_sender=True)
UnboundLocalError: local variable 'result' referenced before assignment
molanp commented 7 months ago

...先把注销写好了

08246f4d907ccc2454c2cfbfb4f97e4649f6bec7

ElaineOwO commented 7 months ago

...先把注销写好了

08246f4

好耶 大佬加油哦

molanp commented 7 months ago

话说你pillow版本多少,建议 Pillow = "^9.0.1"

ElaineOwO commented 7 months ago

话说你pillow版本多少,建议 Pillow = "^9.0.1"

Name: pillow Version: 10.2.0 是10.2.0

molanp commented 7 months ago

话说你pillow版本多少,建议 Pillow = "^9.0.1"

Name: pillow Version: 10.2.0 是10.2.0

使用pip install "Pillow==9.0.1"试一下

ElaineOwO commented 7 months ago

话说你pillow版本多少,建议 Pillow = "^9.0.1"

Name: pillow Version: 10.2.0 是10.2.0

使用pip install "Pillow==9.0.1"试一下

emmm。 。下面写Requires: Required-by: ImageHash, matplotlib, nonebot-plugin-bili-push, nonebot-plugin-tarot, nonebot_plugin_remake, pil-utils 有点怕改了版本其他的插件也不能用勒QAQ

molanp commented 7 months ago

话说你pillow版本多少,建议 Pillow = "^9.0.1"

Name: pillow Version: 10.2.0 是10.2.0

使用pip install "Pillow==9.0.1"试一下

emmm。 。下面写Requires: Required-by: ImageHash, matplotlib, nonebot-plugin-bili-push, nonebot-plugin-tarot, nonebot_plugin_remake, pil-utils 有点怕改了版本其他的插件也不能用勒QAQ

先试一下,不能用就

pip install pillow -upgrade

回滚

ElaineOwO commented 7 months ago

话说你pillow版本多少,建议 Pillow = "^9.0.1"

Name: pillow Version: 10.2.0 是10.2.0

使用pip install "Pillow==9.0.1"试一下

emmm。 。下面写Requires: Required-by: ImageHash, matplotlib, nonebot-plugin-bili-push, nonebot-plugin-tarot, nonebot_plugin_remake, pil-utils 有点怕改了版本其他的插件也不能用勒QAQ

先试一下,不能用就

pip install pillow -upgrade

回滚

改了一下版本 排行可以正常显示图片勒 我在运行一阵子看看吧

molanp commented 7 months ago

我会考虑重构图片模块来适配pil10的

ElaineOwO commented 7 months ago

我会考虑重构图片模块来适配pil10的

谢谢啦,不过改了版本以后remake好像不能用了。。 顺便发现两个文本漏子 牛头人的牛字不见了 这里应该把已经很长呢 改成已经很长了呢

molanp commented 7 months ago

多谢

393fea07aacf5930ae0ab8808672ad5f3cacb6db

ElaineOwO commented 7 months ago

多谢

393fea0

好像图片的牛头人还是缺了个牛字。。不知道该怎么改 不过明天再说吧 我先睡啦

molanp commented 7 months ago

多谢

393fea0

好像图片的牛头人还是缺了个牛字。。不知道该怎么改 不过明天再说吧 我先睡啦

啊,那个不是一个分支的,你目前用的是nonebot分支的内容 https://github.com/molanp/zhenxun_plugin_niuniu/tree/nonebot

ElaineOwO commented 7 months ago

多谢 393fea0

好像图片的牛头人还是缺了个牛字。。不知道该怎么改 不过明天再说吧 我先睡啦

啊,那个不是一个分支的,你目前用的是nonebot分支的内容

原来是这样,刚刚重启了一下bot结果好像因为版本问题报错了。。

04-14 02:20:22 [ERROR] nonebot | Failed to import "nonebot_plugin_memes"
Traceback (most recent call last):
  File "<string>", line 12, in <module>
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\plugin\load.py", line 130, in load_from_toml
    return load_all_plugins(plugins, plugin_dirs)
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\plugin\load.py", line 64, in load_all_plugins
    return manager.load_all_plugins()
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\plugin\manager.py", line 176, in load_all_plugins
    return set(
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\plugin\manager.py", line 177, in <genexpr>
    filter(None, (self.load_plugin(name) for name in self.available_plugins))
> File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\plugin\manager.py", line 142, in load_plugin
    module = importlib.import_module(name)
  File "C:\Users\BOT\AppData\Local\Programs\Python\Python310\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 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\plugin\manager.py", line 242, in exec_module
    super().exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot_plugin_memes\__init__.py", line 8, in <module>
    from meme_generator.exception import (
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\meme_generator\__init__.py", line 4, in <module>
    from meme_generator.manager import add_meme as add_meme
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\meme_generator\manager.py", line 10, in <module>
    from .meme import Meme, MemeArgsType, MemeFunction, MemeParamsType
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\meme_generator\meme.py", line 22, in <module>
    from pil_utils import BuildImage
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\pil_utils\__init__.py", line 1, in <module>
    from .build_image import BuildImage
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\pil_utils\build_image.py", line 9, in <module>
    from PIL.Image import Resampling, Transpose
ImportError: cannot import name 'Resampling' from 'PIL.Image' (C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\PIL\Image.py)

要不先把牛头人和魅魔的描述改成文本发送叭

ElaineOwO commented 7 months ago

多谢 393fea0

好像图片的牛头人还是缺了个牛字。。不知道该怎么改 不过明天再说吧 我先睡啦

啊,那个不是一个分支的,你目前用的是nonebot分支的内容

原来是这样,刚刚重启了一下bot结果好像因为版本问题报错了。。

04-14 02:20:22 [ERROR] nonebot | Failed to import "nonebot_plugin_memes"
Traceback (most recent call last):
  File "<string>", line 12, in <module>
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\plugin\load.py", line 130, in load_from_toml
    return load_all_plugins(plugins, plugin_dirs)
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\plugin\load.py", line 64, in load_all_plugins
    return manager.load_all_plugins()
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\plugin\manager.py", line 176, in load_all_plugins
    return set(
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\plugin\manager.py", line 177, in <genexpr>
    filter(None, (self.load_plugin(name) for name in self.available_plugins))
> File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\plugin\manager.py", line 142, in load_plugin
    module = importlib.import_module(name)
  File "C:\Users\BOT\AppData\Local\Programs\Python\Python310\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 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\plugin\manager.py", line 242, in exec_module
    super().exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot_plugin_memes\__init__.py", line 8, in <module>
    from meme_generator.exception import (
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\meme_generator\__init__.py", line 4, in <module>
    from meme_generator.manager import add_meme as add_meme
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\meme_generator\manager.py", line 10, in <module>
    from .meme import Meme, MemeArgsType, MemeFunction, MemeParamsType
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\meme_generator\meme.py", line 22, in <module>
    from pil_utils import BuildImage
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\pil_utils\__init__.py", line 1, in <module>
    from .build_image import BuildImage
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\pil_utils\build_image.py", line 9, in <module>
    from PIL.Image import Resampling, Transpose
ImportError: cannot import name 'Resampling' from 'PIL.Image' (C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\PIL\Image.py)

要不先把牛头人和魅魔的描述改成文本发送叭

不用啦我已经改好了,等待大佬跟进新版本~我先睡啦晚安

ElaineOwO commented 7 months ago

貌似魅魔和牛头人的技能无法正常触发

04-15 00:01:55 [ERROR] nonebot | Running Matcher(type='message', module=src.plugins.niuniu, lineno=33) failed.
Traceback (most recent call last):
  File "C:\Users\BOT\Desktop\BOT\xyl\src\plugins\niuniu\__init__.py", line 135, in _
    result = fencing(my_long, opponent_long, at, qq, group, content)
  File "C:\Users\BOT\Desktop\BOT\xyl\src\plugins\niuniu\data_source.py", line 93, in fencing
    oppo = oppo + 0.5*my
TypeError: unsupported operand type(s) for *: 'float' and 'decimal.Decimal'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 15, in <module>
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\__init__.py", line 334, in run
    get_driver().run(*args, **kwargs)
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\drivers\fastapi.py", line 186, in run
    uvicorn.run(
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\uvicorn\main.py", line 587, in run
    server.run()
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\uvicorn\server.py", line 61, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "C:\Users\BOT\AppData\Local\Programs\Python\Python310\lib\asyncio\runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "C:\Users\BOT\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 636, in run_until_complete
    self.run_forever()
  File "C:\Users\BOT\AppData\Local\Programs\Python\Python310\lib\asyncio\windows_events.py", line 321, in run_forever
    super().run_forever()
  File "C:\Users\BOT\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 603, in run_forever
    self._run_once()
  File "C:\Users\BOT\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 1909, in _run_once
    handle._run()
  File "C:\Users\BOT\AppData\Local\Programs\Python\Python310\lib\asyncio\events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\message.py", line 476, in check_and_run_matcher
    await _run_matcher(
> File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\message.py", line 428, in _run_matcher
    await matcher.run(bot, event, state, stack, dependency_cache)
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\internal\matcher\matcher.py", line 842, in run
    await self.simple_run(bot, event, state, stack, dependency_cache)
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\internal\matcher\matcher.py", line 817, in simple_run
    await handler(
  File "C:\Users\BOT\Desktop\BOT\xyl\.venv\lib\site-packages\nonebot\dependencies\__init__.py", line 106, in __call__
    return await cast(Callable[..., Awaitable[R]], self.call)(**values)
  File "C:\Users\BOT\Desktop\BOT\xyl\src\plugins\niuniu\__init__.py", line 146, in _
    await niuzi_fencing.finish(Message(result),at_sender=True)
UnboundLocalError: local variable 'result' referenced before assignment
molanp commented 7 months ago

修好了

22da5a35a45c5332f87bcc72b51e3c2551b30541

由于代码长久没有维护, 再加上💩一样的逻辑, 我将于近期对代码进行重构

ElaineOwO commented 7 months ago

修好了

22da5a3

由于代码长久没有维护, ~再加上💩一样的逻辑,~ 我将于近期对代码进行重构

加油呀 写代码的大哥哥

molanp commented 7 months ago

“大哥哥”...

行吧

ElaineOwO commented 7 months ago

“大哥哥”...

行吧

我啜惹——对不起姐姐

ElaineOwO commented 7 months ago

“大哥哥”... 行吧

我啜惹——对不起姐姐

不过前面的22da5a3好像还是会遇到报错UnboundLocalError: local variable 'result' referenced before assignment 期待之后的重构版本~

molanp commented 7 months ago

具体是什么错误,给一下完整日志

ElaineOwO commented 7 months ago

具体是什么错误,给一下完整日志

和前面这里是一样的报错