sophisticate9008 / draw_helper

真寻bot插件 花费金币抽明日方舟干员, 价格可分群设置, 可收集,可设置助理, 可看立绘, 可听中日文语音,可黄票兑换 ,内置小游戏猜语音, 数据来自prts.wiki
3 stars 1 forks source link

构造插件数据失败 #4

Closed PackageInstaller closed 1 year ago

PackageInstaller commented 1 year ago

image

sophisticate9008 commented 1 year ago

影响使用不,我看后面代码都执行了

PackageInstaller commented 1 year ago

除了语音方面报错(好像是nb的原因),其他正常,感谢大佬

PackageInstaller commented 1 year ago

好像只有这个插件的语音无法发出,真寻自带的钉宫语音是能正常发送出去,具体报错如图,麻烦大佬帮我看看 Screenshot_20230119_173648

PackageInstaller commented 1 year ago

go-cqhttp给的是这个warning

[2023-01-19 17:36:45] [WARNING]: 转换CQ码 ({"type": "record", "data": {"file": "https://static.prts.wiki/voice/char_388_mint/CN_034.wav?filename=\u6233\u4e00\u4e0b.wav", "magic": null, "cache": null, "proxy": null, "timeout": null}}) 到MiraiGo Element时出现错误: encode silk failed: convert pcm file error: exit status 1 将忽略本段CQ码. [2023-01-19 17:36:45] [WARNING]: 群消息发送失败: 消息为空.

sophisticate9008 commented 1 year ago

%)RK8(`~{5PA(@43ARLWE_I 不过你这个还是unicode码没转成中文

sophisticate9008 commented 1 year ago

image 1027行之后加 url_voice_cn = url_voice_cn.encode("unicode_escape").decode('unicode_escape') url_voice_jp = url_voice_jp.encode("unicode_escape").decode('unicode_escape') voice_text = voice_text.encode("unicode_escape").decode('unicode_escape')

注意对齐

PackageInstaller commented 1 year ago

image 啊,加了还是报错(还是之前那个),指令是方舟猜语音

sophisticate9008 commented 1 year ago

那网上搜搜怎么将unicode转成字符,大概是把decode改成encode("utf-8")

PackageInstaller commented 1 year ago

啊,我不会啊 image

sophisticate9008 commented 1 year ago

decode("unicode_escape")换成encode("utf-8")试试

PackageInstaller commented 1 year ago

加了之后发送指令方舟猜语音,报错如下,机器人回复:网络问题,请稍后再试(我网络正常,挂不挂梯都是这个报错)

01-20 19:06:08 [ERROR] nonebot | Running Matcher(type='message', module=extensive_plugin.draw_helper) failed. Traceback (most recent call last): File "/home/Neko/QQBot/zhenxun_bot/bot.py", line 21, in nonebot.run() File "/home/Neko/.cache/pypoetry/virtualenvs/zhenxun-bot-PzlhPUjk-py3.10/lib/python3.10/site-packages/nonebot/init.py", line 273, in run get_driver().run(*args, **kwargs) File "/home/Neko/.cache/pypoetry/virtualenvs/zhenxun-bot-PzlhPUjk-py3.10/lib/python3.10/site-packages/nonebot/drivers/fastapi.py", line 172, in run uvicorn.run( File "/home/Neko/.cache/pypoetry/virtualenvs/zhenxun-bot-PzlhPUjk-py3.10/lib/python3.10/site-packages/uvicorn/main.py", line 569, in run server.run() File "/home/Neko/.cache/pypoetry/virtualenvs/zhenxun-bot-PzlhPUjk-py3.10/lib/python3.10/site-packages/uvicorn/server.py", line 60, in run return asyncio.run(self.serve(sockets=sockets)) File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) File "/home/Neko/.cache/pypoetry/virtualenvs/zhenxun-bot-PzlhPUjk-py3.10/lib/python3.10/site-packages/nonebot/message.py", line 142, in _check_matcher await _run_matcher(Matcher, bot, event, state, stack, dependency_cache)

File "/home/Neko/.cache/pypoetry/virtualenvs/zhenxun-bot-PzlhPUjk-py3.10/lib/python3.10/site-packages/nonebot/message.py", line 188, in _run_matcher await matcher.run(bot, event, state, stack, dependency_cache) File "/home/Neko/.cache/pypoetry/virtualenvs/zhenxun-bot-PzlhPUjk-py3.10/lib/python3.10/site-packages/nonebot/internal/matcher/matcher.py", line 727, in run await self.simple_run(bot, event, state, stack, dependency_cache) File "/home/Neko/.cache/pypoetry/virtualenvs/zhenxun-bot-PzlhPUjk-py3.10/lib/python3.10/site-packages/nonebot/internal/matcher/matcher.py", line 702, in simple_run await handler( File "/home/Neko/.cache/pypoetry/virtualenvs/zhenxun-bot-PzlhPUjk-py3.10/lib/python3.10/site-packages/nonebot/dependencies/init.py", line 108, in call return await cast(Callable[..., Awaitable[R]], self.call)(**values) File "/home/Neko/QQBot/zhenxun_bot/extensive_plugin/drawhelper/init.py", line 254, in list_voice.remove(list_voice[2]) UnboundLocalError: local variable 'list_voice' referenced before assignment

PackageInstaller commented 1 year ago

image

PackageInstaller commented 1 year ago

image

sophisticate9008 commented 1 year ago

可能随机到那些预备干员了了,预备干员是没有语音的

sophisticate9008 commented 1 year ago

其他有发出来么

PackageInstaller commented 1 year ago

不行 Screenshot_20230120_195810

sophisticate9008 commented 1 year ago

那自己百度一下怎么python怎么将unicode码转成字符串吧,然后测试测试吧(回家没有电脑

PackageInstaller commented 1 year ago

好吧,我试试(

image

sophisticate9008 commented 1 year ago

非常抱歉经过多次测试,不是上述问题,gocq会将我的中文变成unicode,现已经变为文件流发送而不是网址发送

PackageInstaller commented 1 year ago

好的,我去试试,祝大佬新年快乐啊 -538226385babc13f

PackageInstaller commented 1 year ago

感谢大佬,没问题了