Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

新版手机qq不方便带字发图了 #14

Closed
666dechaoge opened this issue Jun 3, 2024 · 10 comments
Closed

新版手机qq不方便带字发图了 #14

666dechaoge opened this issue Jun 3, 2024 · 10 comments

Comments

@666dechaoge
Copy link

能不能改成先发指令再发图

@watermellye
Copy link
Owner

你好!
最晚在端午期间实装此修改。
另,现在手机QQ可以通过[长按聊天文字输入框->右侧三点->全屏输入]的方式插入图片。

@666dechaoge

This comment was marked as off-topic.

@watermellye
Copy link
Owner

watermellye commented Jun 4, 2024

根据bot使用的前端(通信端)不一样,可能出现各种问题。有的可以通过修改代码临时解决(例如:将&转为&;删除spec及之后的字段);有的缺少了token,需要手动拼一段token上去,或者等待通信端更新。

如果您仍未解决此问题,可以在这里附上报错信息

@666dechaoge

This comment was marked as resolved.

@666dechaoge 666dechaoge changed the title 新版手机qq不允许带字发图了 新版手机qq不方便带字发图了 Jun 4, 2024
@watermellye
Copy link
Owner

ec4ccb8
@666dechaoge

@666dechaoge
Copy link
Author

无论群里发送什么,都在报这个错误,是on_message的问题吗
[2024-06-11 10:32:29,674 pcr-arena] ERROR: wrapper() takes 1 positional argument but 2 were given
Traceback (most recent call last):
File "/HoshinoBot/hoshino/service.py", line 192, in wrapper
return await func(self.bot, ctx)
TypeError: wrapper() takes 1 positional argument but 2 were given

@666dechaoge
Copy link
Author

666dechaoge commented Jun 11, 2024

去掉了一个

@sv.on_message('private')

之后不报错了,能用了,谢谢大佬

@watermellye
Copy link
Owner

明白了。是我修改了hoshino的wrapper。默认不能这么写。
你把on_group和on_private拆开就行。
或者你不需要私聊的话,on_private去掉即可。
我稍后上传修复。

@666dechaoge
Copy link
Author

666dechaoge commented Jun 11, 2024

指令前缀和图片分开发送时候,出现了不影响使用的报错

[2024-06-11 10:58:11,316 pcr-arena] ERROR: <class 'nonebot.message.CanceledException'> occured when QueryArenaMessageContextInterface handling message -2147483197.
[2024-06-11 10:58:11,316 pcr-arena] ERROR: ServiceFunc of HoshinoBot finished.
Traceback (most recent call last):
  File "/HoshinoBot/hoshino/service.py", line 192, in wrapper
    return await func(self.bot, ctx)
  File "/HoshinoBot/hoshino/modules/priconne/arena/__init__.py", line 88, in QueryArenaMessageContextInterface
    await QueryArenaImageAsync(image_url, req.region, bot, ev)
  File "/HoshinoBot/hoshino/modules/priconne/arena/__init__.py", line 92, in QueryArenaImageAsync
    await _QueryArenaImageAsync(image_url, Region2Int(region), bot, ev)
  File "/HoshinoBot/hoshino/modules/priconne/arena/old_main.py", line 484, in _QueryArenaImageAsync
    await generateCollisionFreeTeam(bot, ev, all_query_records, team_has_result, region, boxDict)  # 最多允许补两队
  File "/HoshinoBot/hoshino/modules/priconne/arena/old_main.py", line 659, in generateCollisionFreeTeam
    await bot.finish(ev, str(MessageSegment.image(pic2b64(teams))))
  File "/HoshinoBot/hoshino/__init__.py", line 30, in finish
    raise CanceledException('ServiceFunc of HoshinoBot finished.')
nonebot.message.CanceledException: ServiceFunc of HoshinoBot finished.

其中message -2147483197 是发指令之后发送的阵容截图

@watermellye
Copy link
Owner

这就是bot.finish的工作原理。通过抛出一个Exception来结束逻辑。
由于可能会导致外部代码出现意想不到的退出,并且由于该异常同样可被捕获,我在新写的代码里已经不再使用bot.finish。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants