Open
Description
requirements
- token type(web protocol, padlocal) [required]
- version of python-wechaty [0.8.66]
- version of wechaty docker image [latest]
Describe your problem
之前一直都是好好的,大概从昨天开始,发现,使用FileBox.from_url(),不能发送网络图片了。from_file还能用。
Reproduce your problem
@logger.catch()
async def on_message(self, msg: Message) -> None:
if msg.is_self():
return
text = msg.text()
if text == '我的测试图片':
file_box = FileBox.from_url(url='https://img2.woyaogexing.com/2022/07/21/03e08cd0ad72c979.jpg', name='test.jpg')
await msg.ready()
await msg.say(file_box)
Error info
2022-08-12 09:26:03.756 | ERROR | wechaty.plugin:emit_events:743 - An error has been caught in function 'emit_events', process 'MainProcess' (4729), thread 'MainThread' (139784813381376):
Traceback (most recent call last):
File "/opt/wechat/bot.py", line 38, in <module>
asyncio.run(main())
│ │ └ <function main at 0x7f2229c86040>
│ └ <function run at 0x7f2229a82d30>
└ <module 'asyncio' from '/usr/local/lib/python3.9/asyncio/__init__.py'>
File "/usr/local/lib/python3.9/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
│ │ └ <coroutine object main at 0x7f222469a2c0>
│ └ <function BaseEventLoop.run_until_complete at 0x7f2227c78700>
└ <_UnixSelectorEventLoop running=True closed=False debug=False>
File "/usr/local/lib/python3.9/asyncio/base_events.py", line 629, in run_until_complete
self.run_forever()
│ └ <function BaseEventLoop.run_forever at 0x7f2227c78670>
└ <_UnixSelectorEventLoop running=True closed=False debug=False>
File "/usr/local/lib/python3.9/asyncio/base_events.py", line 596, in run_forever
self._run_once()
│ └ <function BaseEventLoop._run_once at 0x7f2227c7a1f0>
└ <_UnixSelectorEventLoop running=True closed=False debug=False>
File "/usr/local/lib/python3.9/asyncio/base_events.py", line 1890, in _run_once
handle._run()
│ └ <function Handle._run at 0x7f2227cade50>
└ <Handle <TaskWakeupMethWrapper object at 0x7f222431c340>(<Future finished result=True>)>
File "/usr/local/lib/python3.9/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
│ │ │ │ │ └ <member '_args' of 'Handle' objects>
│ │ │ │ └ <Handle <TaskWakeupMethWrapper object at 0x7f222431c340>(<Future finished result=True>)>
│ │ │ └ <member '_callback' of 'Handle' objects>
│ │ └ <Handle <TaskWakeupMethWrapper object at 0x7f222431c340>(<Future finished result=True>)>
│ └ <member '_context' of 'Handle' objects>
└ <Handle <TaskWakeupMethWrapper object at 0x7f222431c340>(<Future finished result=True>)>
File "/usr/local/lib/python3.9/site-packages/wechaty/wechaty.py", line 564, in message_listener
await self._plugin_manager.emit_events('message', msg)
│ │ │ └ <wechaty.wechaty.Message object at 0x7f22243743a0>
│ │ └ <function WechatyPluginManager.emit_events at 0x7f2225668310>
│ └ <wechaty.plugin.WechatyPluginManager object at 0x7f2224629d90>
└ <wechaty.wechaty.Wechaty object at 0x7f2224629a90>
> File "/usr/local/lib/python3.9/site-packages/wechaty/plugin.py", line 743, in emit_events
await plugin.on_message(message)
│ │ └ <wechaty.wechaty.Message object at 0x7f22243743a0>
│ └ <function TestPlugin.on_message at 0x7f22246324c0>
└ <plugin.TestPlugin object at 0x7f22245a6790>
File "/opt/wechat/plugin.py", line 19, in on_message
await msg.say(file_box)
│ │ └ <wechaty_puppet.file_box.file_box.FileBox object at 0x7f2224374340>
│ └ <function Message.say at 0x7f22246dc550>
└ <wechaty.wechaty.Message object at 0x7f22243743a0>
File "/usr/local/lib/python3.9/site-packages/wechaty/user/message.py", line 172, in say
message_id = await self.puppet.message_send_file(
│ └ <property object at 0x7f2226e08bd0>
└ <wechaty.wechaty.Message object at 0x7f22243743a0>
File "/usr/local/lib/python3.9/site-packages/wechaty_puppet_service/puppet.py", line 373, in message_send_file
response = await self.puppet_stub.message_send_file(
│ └ <property object at 0x7f22245ab630>
└ <wechaty_puppet_service.puppet.PuppetService object at 0x7f2224629b80>
File "/usr/local/lib/python3.9/site-packages/wechaty_grpc/wechaty/__init__.py", line 312, in message_send_file
return await self._unary_unary(
│ └ <function ServiceStub._unary_unary at 0x7f2227b2b5e0>
└ <wechaty_grpc.wechaty.PuppetStub object at 0x7f222439a3a0>
File "/usr/local/lib/python3.9/site-packages/betterproto/__init__.py", line 1125, in _unary_unary
assert response is not None
└ None
AssertionError: assert response is not None
docker log
01:36:47 ERR PuppetServiceImpl grpcError() messageSendFile() rejection: no url
Error: no url
at new FileBox (file:///wechaty/node_modules/file-box/src/file-box.ts:548:17)
at new FileBox (file:///wechaty/node_modules/clone-class/src/clone-class.ts:31:7)
at Function.fromUrl (file:///wechaty/node_modules/file-box/src/file-box.ts:164:12)
at Function.fromJSON (file:///wechaty/node_modules/file-box/src/file-box.ts:385:24)
at messageSendFile (file:///wechaty/node_modules/wechaty-puppet-service/src/server/puppet-implementation.ts:793:37)
at Object.messageSendFile (file:///wechaty/node_modules/wechaty-puppet-service/src/auth/auth-impl-token.ts:49:18)
at handleUnary (/wechaty/node_modules/@grpc/grpc-js/src/server.ts:925:11)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
Your experiments
please tell us your experiments and ideas about this issue. It's valuable for us to help you find the solution.