wechaty / python-wechaty

Python Wechaty is a Conversational RPA SDK for Chatbot Makers written in Python
https://wechaty.readthedocs.io/zh_CN/latest/
Apache License 2.0
1.55k stars 229 forks source link

[Bug]: 图片无法接受和保存在本地 #409

Open ashen001 opened 1 year ago

ashen001 commented 1 year ago

Environment

- wechaty:0.10.7
- wechaty-puppet:
- wechaty-puppet-service: 
- wechaty-plugin-contrib: 
- token type: padlocal
- the version of wechaty docker container: [0.68]

Description

昨天晚上还是好的。今天发现图片无法保存在本地了。发送图片就显示internal error <>错误。。

Minimum reproducible code

        elif msg.type()==Message.Type.MESSAGE_TYPE_IMAGE:
            img = await msg.to_file_box()
            say_time=time.strptime(str(msg.date()), '%Y-%m-%d %H:%M:%S')
            say_timestamp = str(time.mktime(say_time)).split('.')[0]

            sr = SystemRandom()
            n = sr.choice(range(1000, 10000))
            pin = format(n, '04')

            img_name=f'{say_timestamp}_{pin}.jpg'

            print(img_name)
            await img.to_file(f'img/{img_name}')