|
|
lanly109 / headimg_generator Goto Github PK
View Code? Open in Web Editor NEW基于HoshinoBot的制作头像相关的表情包插件,移植自nonebot-plugin-petpet
License: MIT License
基于HoshinoBot的制作头像相关的表情包插件,移植自nonebot-plugin-petpet
License: MIT License
这是什么情况
aiocache 0.11.1
aiocqhttp 1.4.3
aiofiles 0.8.0
aiohttp 3.8.1
aiosignal 1.2.0
altgraph 0.17.2
annotated-types 0.5.0
ansimarkup 1.5.0
anyio 3.7.1
appdirs 1.4.4
APScheduler 3.9.1
arrow 0.14.0
async-generator 1.10
async-timeout 4.0.2
attrs 21.4.0
backports.zoneinfo 0.2.1
bbcode 1.1.0
beautifulsoup4 4.11.0
better-exceptions-fork 0.2.1.post6
binaryornot 0.4.4
blinker 1.4
bs4 0.0.1
CacheControl 0.12.11
cachy 0.3.0
cairocffi 1.3.0
CairoSVG 2.5.2
cattrs 1.10.0
certifi 2022.5.18.1
cffi 1.15.0
chardet 3.0.4
charset-normalizer 2.0.12
cleo 0.8.1
click 8.1.3
clikit 0.6.2
cloudscraper 1.2.48
colorama 0.4.4
cookiecutter 1.7.3
crashtest 0.3.1
cryptography 37.0.4
cssselect2 0.6.0
cycler 0.11.0
dateparser 1.1.8
defusedxml 0.7.1
demjson 2.2.4
dill 0.3.5.1
distlib 0.3.5
emoji 1.7.0
et-xmlfile 1.1.0
exceptiongroup 1.1.1
expiringdict 1.2.2
fastapi 0.103.1
feedparser 6.0.0
ffmpeg 1.4
filelock 3.7.1
filetype 1.2.0
fonttools 4.33.3
frozenlist 1.3.0
future 0.18.2
fuzzywuzzy 0.18.0
gitdb 4.0.9
greenlet 1.1.2
h11 0.12.0
h2 4.1.0
hpack 4.0.0
html5lib 1.1
httpcore 0.15.0
httptools 0.4.0
httpx 0.23.0
hypercorn 0.13.2
hyperframe 6.0.1
idna 3.3
imageio 2.19.2
importlib-metadata 4.12.0
itsdangerous 2.1.2
Jinja2 2.11.3
jinja2-time 0.2.0
jmespath 1.0.0
keyring 23.7.0
kiwisolver 1.4.2
kth-timeoutdecorator 0.0.5
langid 1.1.6
lockfile 0.12.2
loguru 0.6.0
logzero 1.7.0
lxml 4.9.1
Markdown 3.3.4
markdown-it-py 3.0.0
MarkupSafe 2.0.1
matplotlib 3.5.2
mdurl 0.1.2
meme-generator 0.0.15
msgpack 1.0.2
msgpack-python 0.5.6
multidict 4.7.6
multiprocess 0.70.13
nb-cli 0.6.7
nest-asyncio 1.5.5
nonebot 1.9.1
numpy 1.20.3
oauthlib 3.2.0
opencc-python-reimplemented 0.1.6
opencv-python-headless 4.1.2.30
outcome 1.2.0
packaging 20.9
pastel 0.2.1
pathlib 1.0.1
peewee 3.13.0
pefile 2021.9.3
pexpect 4.8.0
pil-utils 0.1.8
Pillow 9.4.0
pip 23.0.1
PixivPy 3.6.2
pkginfo 1.8.3
platformdirs 2.5.2
playwright 1.20.1
poetry 1.1.14
poetry-core 1.0.8
pox 0.3.1
poyo 0.5.0
ppft 1.7.6.5
prettytable 3.3.0
priority 2.0.0
prompt-toolkit 3.0.30
psutil 5.9.1
ptyprocess 0.7.0
pycparser 2.21
pycryptodome 3.14.1
pydantic 1.9.1
pydantic_core 2.6.3
pydub 0.25.1
pyee 8.1.0
pyfiglet 0.8.post1
Pygments 2.16.1
pygtrie 2.4.2
pyinstaller 5.1
pyinstaller-hooks-contrib 2022.5
pylev 1.4.0
pyOpenSSL 22.0.0
pyparsing 3.0.9
pypinyin 0.49.0
PySocks 1.7.1
python-dateutil 2.8.2
python-dotenv 0.20.0
python-engineio 3.14.2
python-multipart 0.0.6
python-slugify 6.1.2
python-socketio 4.6.1
pytoml 0.1.21
pytz 2022.1
pytz-deprecation-shim 0.1.0.post0
pywin32-ctypes 0.2.0
PyYAML 6.0b1
pyyaml_env_tag 0.1
pyzbar 0.1.9
quart 0.17.0
regex 2023.8.8
requests 2.28.2
requests-cache 0.9.4
requests-oauthlib 1.3.1
requests-toolbelt 0.9.1
retrying 1.3.3
rfc3986 1.5.0
rich 13.5.2
selenium 4.3.0
setuptools 47.1.0
sgmllib3k 1.0.0
shellingham 1.5.0
six 1.16.0
smmap 5.0.0
sniffio 1.2.0
sogou-tr 0.1.1
sogou-tr-free 0.0.11
some-package 0.1
sortedcontainers 2.4.0
soupsieve 2.3.2.post1
sqlitedict 2.1.0
starlette 0.27.0
text-unidecode 1.3
thulac 0.2.1
tinycss2 1.1.1
tinydb 4.7.0
toml 0.10.2
tomli 2.0.1
tomlkit 0.10.2
tqdm 4.65.0
trio 0.21.0
trio-websocket 0.9.2
TwitterAPI 2.7.12
typing_extensions 4.7.1
tzdata 2022.1
tzlocal 4.2
ujson 5.3.0
url-normalize 1.4.3
urllib3 1.26.9
urllib3-secure-extra 0.1.0
urwid 2.1.2
uvicorn 0.23.2
virtualenv 20.16.3
watchfiles 0.16.1
wcwidth 0.2.5
webencodings 0.5.1
websocket-client 1.3.3
websockets 10.1
Werkzeug 2.1.2
win32-setctime 1.1.0
wsproto 1.1.0
yarl 1.7.2
zhconv 1.4.3
zipp 3.8.1
[notice] A new release of pip is available: 23.0.1 -> 23.2.1
[notice] To update, run: python.exe -m pip install --upgrade pip
File "C:\Users\Administrator\Desktop\HoshinoBot-master - 1\HoshinoBot-master\hoshino\modules\headimg_generator_init_.py", line 17, in
from meme_generator.download import check_resources
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\meme_generator_init_.py", line 4, in
from meme_generator.manager import add_meme as add_meme
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\meme_generator\manager.py", line 10, in
from .meme import Meme, MemeArgsType, MemeFunction, MemeParamsType
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\meme_generator\meme.py", line 37, in
class UserInfo(BaseModel):
仅 指令+@/图片的功能可使用
后面可接文本的指令发出后表现如下:
[2022-08-20 23:45:39,159 nonebot] INFO: Self: 527283676, Message -436180408 from 2284496866@[群:295087963]: '#典中典 [CQ:at,qq=527283676] 111'
[2022-08-20 23:45:39,159 头像表情包] INFO: Message -436180408 triggered handle by PrefixTrigger.
[2022-08-20 23:45:40,170 nonebot] INFO: Message -436180408 is ignored: Handled by PrefixTrigger of Hoshino
我记得整合文字表情包前的版本是可以回复触发的,不知能否加上这个功能?
请在release中下载resources.zip,并解压其放置于此目录。
这个 resources.zip 在哪里呀?
Originally posted by @1055169799 in #6 (comment)
python版本:3.8.3
安装依赖时报错:
ERROR: No matching distribution found for dataclasses==0.8
原因:
RROR: No matching distribution found for dataclasses==0.8 - Streamlit Cloud - Streamlit
解决方案:
新建一个 py38requirements.txt 拷贝原本的 requirements 删去 dataclasses==0.8
除此以外, py38 首次安装依赖时报找不到 dataclasses, 后续删除 dataclasses 后再安装依赖会导致前置依赖冲突, 需要先 pip uninstall -r requirements.txt -y 后再重新 pip install -r requirements.txt
原插件新加了几个表情包,但同时对源代码进行了重构,表示还没看懂nonebot2
的depend
用法,等哪天有空了研究研究
ERROR: Could not find a version that satisfies the requirement pydantic==1.10.2 (from -r requirements.txt (line 11)) (from versions: 0.0.1, 0.0.2, 0.0.3, 0.0.4, 0.0.5, 0.0.6, 0.0.7, 0.0.8, 0.1, 0.2, 0.2.1, 0.3, 0.4, 0.5, 0.6, 0.6.1, 0.6.2, 0.6.3, 0.6.4, 0.7, 0.7.1, 0.8, 0.9, 0.9.1, 0.10, 0.11, 0.11.1, 0.11.2, 0.12, 0.12.1, 0.13, 0.13.1, 0.14, 0.15, 0.16, 0.16.1, 0.17, 0.18, 0.18.1, 0.18.2, 0.19, 0.20a1, 0.20, 0.20.1, 0.21, 0.22, 0.23, 0.24, 0.25, 0.26, 0.27a1, 0.27, 0.28, 0.29, 0.30, 0.30.1, 0.31, 0.31.1, 0.32, 0.32.1, 0.32.2, 1.0b1, 1.0b2, 1.0, 1.1, 1.1.1, 1.2, 1.3, 1.4, 1.5, 1.5.1, 1.6, 1.6.1, 1.6.2, 1.7, 1.7.1, 1.7.2, 1.7.3, 1.7.4, 1.8, 1.8.1, 1.8.2, 1.9.0a1, 1.9.0a2, 1.9.0, 1.9.1)
ERROR: No matching distribution found for pydantic==1.10.2 (from -r requirements.txt (line 11))
看到大伙都对该报错不知道怎么解决,
对于此报错解决方法:
在 manager.py 中,第139行的
raw_list = yaml.safe_load(f)
改成
raw_list = yaml.unsafe_load(f)
即可
建议将字体文件单独给出
当前仓库比较大,网络不好 git clone 容易失败
系统是Debian 11
尝试了把字体放在resources/fonts
、/usr/share/fonts/meme
,然后fc-cache -fv
均无效。
具体表现为表情包制作
内显示方块,表情帮助 字符画
后台提示findfont: Font family ['Consolas'] not found. Falling back to DejaVu Sans.
最后参考了 http://bcxw.net/article/849.html
进入python命令行,执行
import matplotlib
print(matplotlib.matplotlib_fname())
应该会得到一个类似/usr/local/lib/python3.9/dist-packages/matplotlib/mpl-data/matplotlibrc
的路径,注意python版本号的区别
然后进入这个路径下的mpl-data/fonts/
路径,把其他用到的字体一股脑丢进来。
root@debian:/usr/local/lib/python3.9/dist-packages/matplotlib/mpl-data/fonts/ttf# cp /usr/share/fonts/meme/* .
再次进入python命令行,执行
import matplotlib
print(matplotlib.get_cachedir())
应该会得到一个类似/root/.cache/matplotlib
的路径
把这个路径下的内容删干净rm -rf /root/.cache/matplotlib/*
然后重启Hoshino,应该就可以了
猜测是meme_generator用了mpl但是没有设置字体路径导致的。python小白,没翻meme_generator源码。
也不排除是系统或者python版本的原因。
附:系统信息
root@debian:/usr# uname -a
Linux debian 5.10.0-21-amd64 #1 SMP Debian 5.10.162-1 (2023-01-21) x86_64 GNU/Linux
root@debian:/usr# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
不知道是不是高并发导致的问题。。
[2022-06-21 14:11:00,305 头像表情包] ERROR: 'str' object has no attribute 'parent'
Traceback (most recent call last):
File "/root/mybot/hoshino/msghandler.py", line 28, in handle_message
await service_func.func(bot, event)
File "/root/mybot/hoshino/service.py", line 219, in wrapper
return await func(bot, event)
File "/root/mybot/hoshino/modules/headimg_generator/init.py", line 18, in help
File "/root/mybot/hoshino/modules/headimg_generator/utils.py", line 425, in help_image
File "/root/mybot/hoshino/modules/headimg_generator/utils.py", line 369, in load_font
File "/usr/local/lib/python3.9/site-packages/aiocache/decorators.py", line 93, in wrapper
return await self.decorator(f, *args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/aiocache/decorators.py", line 108, in decorator
result = await f(*args, **kwargs)
File "/root/mybot/hoshino/modules/headimg_generator/download.py", line 55, in get_font
File "/root/mybot/hoshino/modules/headimg_generator/download.py", line 36, in get_resource
AttributeError: 'str' object has no attribute 'parent'
纯小白不会弄分支,直接贴请见谅。
文件: __init__.py
import shlex
import traceback
import base64
from typing import List
from .utils import help_image
from hoshino.typing import CQEvent, MessageSegment
from nonebot import on_startup
from hoshino import Service, priv, HoshinoBot
from hoshino.util import DailyNumberLimiter
from .data_source import make_image, commands
from .download import DownloadError, ResourceError
from .models import UserInfo, Command
sv = Service('头像表情包', help_='''
![](https://s2.loli.net/2022/09/18/zrhvqdCMDyOSpZj.jpg)
'''.strip(), enable_on_default=True, bundle='娱乐', visible = True)
_lmt = DailyNumberLimiter(12)
@sv.on_fullmatch(("帮助头像表情包"))
async def help(bot, ev: CQEvent):
img = await help_image(commands)
base64_str = base64.b64encode(img.getvalue()).decode()
img = 'base64://' + base64_str
img = str(MessageSegment.image(img))
await bot.send(ev, img)
def is_qq(msg: str):
return msg.isdigit() and 11 >= len(msg) >= 5
async def get_user_info(bot: HoshinoBot, user: UserInfo, ev: CQEvent):
uid = ev.user_id
if not _lmt.check(uid):
await bot.finish(ev, '已经玩6次了!今天你不许玩这个了!', at_sender=True)
if not user.qq:
return
if user.group:
info = await bot.get_group_member_info(
group_id=int(user.group), user_id=int(user.qq)
)
user.name = info.get("card", "") or info.get("nickname", "")
user.gender = info.get("sex", "")
else:
info = await bot.get_stranger_info(user_id=int(user.qq))
user.name = info.get("nickname", "")
user.gender = info.get("sex", "")
_lmt.increase(uid)
class Handler:
def __init__(self, command):
self.command = command
async def handle(self, bot, ev: CQEvent):
users: List[UserInfo] = []
args: List[str] = []
msg = ev.message
# if ev.reply:
# reply_imgs = ev.reply.message["image"]
# for reply_img in reply_imgs:
# users.append(UserInfo(img_url=reply_img.data["url"]))
for msg_seg in msg:
if msg_seg.type == "at":
users.append(
UserInfo(
qq=msg_seg.data["qq"],
group=str(ev.group_id)
)
)
elif msg_seg.type == "image":
users.append(UserInfo(img_url=msg_seg.data["url"]))
elif msg_seg.type == "text":
raw_text = str(msg_seg)
try:
texts = shlex.split(raw_text)
except:
texts = raw_text.split()
for text in texts:
if is_qq(text):
users.append(UserInfo(qq=text))
elif text == "自己":
users.append(
UserInfo(
qq=str(ev.user_id),
group=str(ev.group_id)
)
)
else:
text = text.strip()
if text:
args.append(text)
if len(args) > self.command.arg_num:
return False
if ev.raw_message.find(f"[CQ:at,qq={str(ev.self_id)}") != -1:
users.append(UserInfo(qq=str(ev.self_id), group=str(ev.group_id)))
if not users:
return False
sender = UserInfo(qq=str(ev.user_id))
await get_user_info(bot, sender, ev)
for user in users:
await get_user_info(bot, user, ev)
try:
img = await make_image(command = self.command, sender = sender, users = users, args = args)
base64_str = base64.b64encode(img.getvalue()).decode()
img = 'base64://' + base64_str
img = str(MessageSegment.image(img))
except Exception as e:
print(traceback.format_exc())
img = str(e)
await bot.send(ev, img)
@on_startup
async def register_handler():
for command in commands:
func = getattr(sv, "on_prefix")
key = command.keywords
func = func(key, only_to_me=False)
func(Handler(command).handle)
print('petpet register done.')
[2023-03-13 16:56:42,512 nonebot] ERROR: Failed to import "hoshino.modules.headimg_generator.config", error: libGL.so.1: cannot open shared object file: No such file or directory
[2023-03-13 16:56:42,512 nonebot] ERROR: libGL.so.1: cannot open shared object file: No such file or directory
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/nonebot/plugin.py", line 253, in load_plugin
module = importlib.import_module(module_path)
File "/usr/lib/python3.8/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 961, in _find_and_load_unlocked
File "", line 219, in _call_with_frames_removed
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 975, in _find_and_load_unlocked
File "", line 671, in _load_unlocked
File "", line 848, in exec_module
File "", line 219, in _call_with_frames_removed
File "/root/newBot/HoshinoBot/hoshino/modules/headimg_generator/init.py", line 15, in
from .data_source import commands, make_image
File "/root/newBot/HoshinoBot/hoshino/modules/headimg_generator/data_source.py", line 1, in
from .download import download_url, download_avatar
File "/root/newBot/HoshinoBot/hoshino/modules/headimg_generator/download.py", line 11, in
from .nonebot_plugin_imageutils.fonts import add_font, Font
File "/root/newBot/HoshinoBot/hoshino/modules/headimg_generator/nonebot_plugin_imageutils/init.py", line 1, in
from .build_image import BuildImage
File "/root/newBot/HoshinoBot/hoshino/modules/headimg_generator/nonebot_plugin_imageutils/build_image.py", line 5, in
import cv2
File "/usr/local/lib/python3.8/dist-packages/cv2/init.py", line 5, in
from .cv2 import *
ImportError: libGL.so.1: cannot open shared object file: No such file or directory
[2023-03-13 16:56:42,522 nonebot] ERROR: Failed to import "hoshino.modules.headimg_generator.functions", error: libGL.so.1: cannot open shared object file: No such file or directory
[2023-03-13 16:56:42,523 nonebot] ERROR: libGL.so.1: cannot open shared object file: No such file or directory
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/nonebot/plugin.py", line 253, in load_plugin
module = importlib.import_module(module_path)
File "/usr/lib/python3.8/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 961, in _find_and_load_unlocked
File "", line 219, in _call_with_frames_removed
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 975, in _find_and_load_unlocked
File "", line 671, in _load_unlocked
File "", line 848, in exec_module
File "", line 219, in _call_with_frames_removed
File "/root/newBot/HoshinoBot/hoshino/modules/headimg_generator/init.py", line 15, in
from .data_source import commands, make_image
File "/root/newBot/HoshinoBot/hoshino/modules/headimg_generator/data_source.py", line 1, in
from .download import download_url, download_avatar
File "/root/newBot/HoshinoBot/hoshino/modules/headimg_generator/download.py", line 11, in
from .nonebot_plugin_imageutils.fonts import add_font, Font
File "/root/newBot/HoshinoBot/hoshino/modules/headimg_generator/nonebot_plugin_imageutils/init.py", line 1, in
from .build_image import BuildImage
File "/root/newBot/HoshinoBot/hoshino/modules/headimg_generator/nonebot_plugin_imageutils/build_image.py", line 5, in
import cv2
File "/usr/local/lib/python3.8/dist-packages/cv2/init.py", line 5, in
from .cv2 import *
ImportError: libGL.so.1: cannot open shared object file: No such file or directory
[2023-03-13 16:56:42,532 nonebot] ERROR: Failed to import "hoshino.modules.headimg_generator.data_source", error: libGL.so.1: cannot open shared object file: No such file or directory
[2023-03-13 16:56:42,532 nonebot] ERROR: libGL.so.1: cannot open shared object file: No such file or directory
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/nonebot/plugin.py", line 253, in load_plugin
module = importlib.import_module(module_path)
File "/usr/lib/python3.8/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 961, in _find_and_load_unlocked
File "", line 219, in _call_with_frames_removed
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 975, in _find_and_load_unlocked
File "", line 671, in _load_unlocked
File "", line 848, in exec_module
File "", line 219, in _call_with_frames_removed
File "/root/newBot/HoshinoBot/hoshino/modules/headimg_generator/init.py", line 15, in
from .data_source import commands, make_image
File "/root/newBot/HoshinoBot/hoshino/modules/headimg_generator/data_source.py", line 1, in
from .download import download_url, download_avatar
File "/root/newBot/HoshinoBot/hoshino/modules/headimg_generator/download.py", line 11, in
from .nonebot_plugin_imageutils.fonts import add_font, Font
File "/root/newBot/HoshinoBot/hoshino/modules/headimg_generator/nonebot_plugin_imageutils/init.py", line 1, in
from .build_image import BuildImage
File "/root/newBot/HoshinoBot/hoshino/modules/headimg_generator/nonebot_plugin_imageutils/build_image.py", line 5, in
import cv2
File "/usr/local/lib/python3.8/dist-packages/cv2/init.py", line 5, in
from .cv2 import *
ImportError: libGL.so.1: cannot open shared object file: No such file or directory
[2023-03-13 16:56:42,542 nonebot] ERROR: Failed to import "hoshino.modules.headimg_generator.nonebot_plugin_imageutils", error: libGL.so.1: cannot open shared object file: No such file or directory
[2023-03-13 16:56:42,542 nonebot] ERROR: libGL.so.1: cannot open shared object file: No such file or directory
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/nonebot/plugin.py", line 253, in load_plugin
module = importlib.import_module(module_path)
File "/usr/lib/python3.8/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 961, in _find_and_load_unlocked
File "", line 219, in _call_with_frames_removed
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 975, in _find_and_load_unlocked
File "", line 671, in _load_unlocked
File "", line 848, in exec_module
File "", line 219, in _call_with_frames_removed
File "/root/newBot/HoshinoBot/hoshino/modules/headimg_generator/init.py", line 15, in
from .data_source import commands, make_image
File "/root/newBot/HoshinoBot/hoshino/modules/headimg_generator/data_source.py", line 1, in
from .download import download_url, download_avatar
File "/root/newBot/HoshinoBot/hoshino/modules/headimg_generator/download.py", line 11, in
from .nonebot_plugin_imageutils.fonts import add_font, Font
File "/root/newBot/HoshinoBot/hoshino/modules/headimg_generator/nonebot_plugin_imageutils/init.py", line 1, in
from .build_image import BuildImage
File "/root/newBot/HoshinoBot/hoshino/modules/headimg_generator/nonebot_plugin_imageutils/build_image.py", line 5, in
import cv2
File "/usr/local/lib/python3.8/dist-packages/cv2/init.py", line 5, in
from .cv2 import *
ImportError: libGL.so.1: cannot open shared object file: No such file or directory
[2023-03-13 16:56:42,551 nonebot] ERROR: Failed to import "hoshino.modules.headimg_generator.models", error: libGL.so.1: cannot open shared object file: No such file or directory
[2023-03-13 16:56:42,552 nonebot] ERROR: libGL.so.1: cannot open shared object file: No such file or directory
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/nonebot/plugin.py", line 253, in load_plugin
module = importlib.import_module(module_path)
File "/usr/lib/python3.8/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 961, in _find_and_load_unlocked
File "", line 219, in _call_with_frames_removed
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 975, in _find_and_load_unlocked
File "", line 671, in _load_unlocked
File "", line 848, in exec_module
File "", line 219, in _call_with_frames_removed
File "/root/newBot/HoshinoBot/hoshino/modules/headimg_generator/init.py", line 15, in
from .data_source import commands, make_image
File "/root/newBot/HoshinoBot/hoshino/modules/headimg_generator/data_source.py", line 1, in
from .download import download_url, download_avatar
File "/root/newBot/HoshinoBot/hoshino/modules/headimg_generator/download.py", line 11, in
from .nonebot_plugin_imageutils.fonts import add_font, Font
File "/root/newBot/HoshinoBot/hoshino/modules/headimg_generator/nonebot_plugin_imageutils/init.py", line 1, in
from .build_image import BuildImage
File "/root/newBot/HoshinoBot/hoshino/modules/headimg_generator/nonebot_plugin_imageutils/build_image.py", line 5, in
import cv2
File "/usr/local/lib/python3.8/dist-packages/cv2/init.py", line 5, in
from .cv2 import *
ImportError: libGL.so.1: cannot open shared object file: No such file or directory
[2023-03-13 16:56:42,561 nonebot] ERROR: Failed to import "hoshino.modules.headimg_generator.download", error: libGL.so.1: cannot open shared object file: No such file or directory
[2023-03-13 16:56:42,561 nonebot] ERROR: libGL.so.1: cannot open shared object file: No such file or directory
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/nonebot/plugin.py", line 253, in load_plugin
module = importlib.import_module(module_path)
File "/usr/lib/python3.8/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 961, in _find_and_load_unlocked
File "", line 219, in _call_with_frames_removed
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 975, in _find_and_load_unlocked
File "", line 671, in _load_unlocked
File "", line 848, in exec_module
File "", line 219, in _call_with_frames_removed
File "/root/newBot/HoshinoBot/hoshino/modules/headimg_generator/init.py", line 15, in
from .data_source import commands, make_image
File "/root/newBot/HoshinoBot/hoshino/modules/headimg_generator/data_source.py", line 1, in
from .download import download_url, download_avatar
File "/root/newBot/HoshinoBot/hoshino/modules/headimg_generator/download.py", line 11, in
from .nonebot_plugin_imageutils.fonts import add_font, Font
File "/root/newBot/HoshinoBot/hoshino/modules/headimg_generator/nonebot_plugin_imageutils/init.py", line 1, in
from .build_image import BuildImage
File "/root/newBot/HoshinoBot/hoshino/modules/headimg_generator/nonebot_plugin_imageutils/build_image.py", line 5, in
import cv2
File "/usr/local/lib/python3.8/dist-packages/cv2/init.py", line 5, in
from .cv2 import *
ImportError: libGL.so.1: cannot open shared object file: No such file or directory
[2023-03-13 16:56:42,580 nonebot] ERROR: Failed to import "hoshino.modules.headimg_generator.utils", error: libGL.so.1: cannot open shared object file: No such file or directory
[2023-03-13 16:56:42,580 nonebot] ERROR: libGL.so.1: cannot open shared object file: No such file or directory
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/nonebot/plugin.py", line 253, in load_plugin
module = importlib.import_module(module_path)
File "/usr/lib/python3.8/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 961, in _find_and_load_unlocked
File "", line 219, in _call_with_frames_removed
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 975, in _find_and_load_unlocked
File "", line 671, in _load_unlocked
File "", line 848, in exec_module
File "", line 219, in _call_with_frames_removed
File "/root/newBot/HoshinoBot/hoshino/modules/headimg_generator/init.py", line 15, in
from .data_source import commands, make_image
File "/root/newBot/HoshinoBot/hoshino/modules/headimg_generator/data_source.py", line 1, in
from .download import download_url, download_avatar
File "/root/newBot/HoshinoBot/hoshino/modules/headimg_generator/download.py", line 11, in
from .nonebot_plugin_imageutils.fonts import add_font, Font
File "/root/newBot/HoshinoBot/hoshino/modules/headimg_generator/nonebot_plugin_imageutils/init.py", line 1, in
from .build_image import BuildImage
File "/root/newBot/HoshinoBot/hoshino/modules/headimg_generator/nonebot_plugin_imageutils/build_image.py", line 5, in
import cv2
File "/usr/local/lib/python3.8/dist-packages/cv2/init.py", line 5, in
from .cv2 import *
ImportError: libGL.so.1: cannot open shared object file: No such file or directory
[2023-03-13 16:56:42,583 nonebot] INFO: Succeeded to import "hoshino.modules.biliminiapp_to_link.biliminiapp_to_link"
[2023-03-13 16:56:42,688 nonebot] ERROR: Failed to import "hoshino.modules.shebot.conhead", error: libGL.so.1: cannot open shared object file: No such file or directory
[2023-03-13 16:56:42,689 nonebot] ERROR: libGL.so.1: cannot open shared object file: No such file or directory
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/nonebot/plugin.py", line 253, in load_plugin
module = importlib.import_module(module_path)
File "/usr/lib/python3.8/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 975, in _find_and_load_unlocked
File "", line 671, in _load_unlocked
File "", line 848, in exec_module
File "", line 219, in _call_with_frames_removed
File "/root/newBot/HoshinoBot/hoshino/modules/shebot/conhead/init.py", line 17, in
from .opencv import add
File "/root/newBot/HoshinoBot/hoshino/modules/shebot/conhead/opencv.py", line 4, in
import cv2
File "/usr/local/lib/python3.8/dist-packages/cv2/init.py", line 5, in
from .cv2 import *
ImportError: libGL.so.1: cannot open shared object file: No such file or directory
24-02-14 15:45:44,723 nonebot] ERROR: Failed to import and load "hoshino.modules.headimg_generator.utils", error: issubclass() arg 1 must be a class
[2024-02-14 15:45:44,723 nonebot] ERROR: issubclass() arg 1 must be a class
Traceback (most recent call last):
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\nonebot\plugin.py", line 419, in load_plugin
module = importlib.import_module(module_path)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\importlib_init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 961, in _find_and_load_unlocked
File "", line 219, in _call_with_frames_removed
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 975, in _find_and_load_unlocked
File "", line 671, in load_unlocked
File "", line 783, in exec_module
File "", line 219, in call_with_frames_removed
File "C:\Users\Administrator\Desktop\HoshinoBot-master - 1\HoshinoBot-master\hoshino\modules\headimg_generator_init.py", line 17, in
from meme_generator.download import check_resources
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\meme_generator_init.py", line 4, in
from meme_generator.manager import add_meme as add_meme
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\meme_generator\manager.py", line 10, in
from .meme import Meme, MemeArgsType, MemeFunction, MemeParamsType
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\meme_generator\meme.py", line 37, in
class UserInfo(BaseModel):
File "pydantic\main.py", line 198, in pydantic.main.ModelMetaclass.new
File "pydantic\fields.py", line 506, in pydantic.fields.ModelField.infer
File "pydantic\fields.py", line 436, in pydantic.fields.ModelField.init
File "pydantic\fields.py", line 552, in pydantic.fields.ModelField.prepare
File "pydantic\fields.py", line 668, in pydantic.fields.ModelField._type_analysis
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\typing.py", line 774, in subclasscheck
return issubclass(cls, self.origin)
TypeError: issubclass() arg 1 must be a class
抛开回复
来看,图片触发都是前缀触发,而extract_plain_text
貌似不包括回复
信息,可以用Tries
来判断触发。
随机表情
也可以用单独的函数来表示,这样能统一代码。
源仓库:
“头像表情包” 与 “文字表情包” 已合并!
表情包制作相关移至 表情包生成器 meme-generator
Nonebot 插件端由 nonebot-plugin-memes v0.4.x 对接
本插件将继续维护一段时间,将不再添加新表情
将进行新仓库的移植
error.log
还请大佬看看
Event对象没有to_me属性,把event.to_me换成event['to_me']也不行。这个地方的判断有没有其他方式实现?
[2023-11-30 17:52:58,788 头像表情包] ERROR: <class 'AttributeError'> occured when
handle handling message 1740221763.
[2023-11-30 17:52:58,788 头像表情包] ERROR: 'Event' object has no attribute 'to_m
e'
Traceback (most recent call last):
File "/HoshinoBot/hoshino/service.py", line 189, in wrapper
return await func(self.bot, ctx)
File "/HoshinoBot/hoshino/modules/headimg_generator/__init__.py", line 332, in
handle
split_msg = await split_msg_v11(bot, ev, msg, meme, trigger)
File "/HoshinoBot/hoshino/modules/headimg_generator/depends.py", line 73, in sp
lit_msg_v11
restore_last_at_me_seg(event, msg)
File "/HoshinoBot/hoshino/modules/headimg_generator/depends.py", line 29, in re
store_last_at_me_seg
if event.to_me:
AttributeError: 'Event' object has no attribute 'to_me'
在根目录代码中似乎找不到有加载字体的实现,仅在 nonebot_plugin_imageutils/fonts.py 中找到。
同时代码中有多处错误,使用 /
号拼接字符串,例如
headimg_generator/nonebot_plugin_imageutils/fonts.py
Lines 43 to 44 in 3ea26f3
Lines 74 to 75 in 3ea26f3
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.