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

how to send a local image #83

Open
pooluut opened this issue Jun 16, 2020 · 2 comments
Open

how to send a local image #83

pooluut opened this issue Jun 16, 2020 · 2 comments
Labels
🐛 bug Something isn't working

Comments

@pooluut
Copy link

pooluut commented Jun 16, 2020

file_box = FileBox.from_file('ding-dong-icon.png', name='ding-dong.png')
await conversation.say(file_box)

I use the code above to send local image. But I got:

INFO:Wechaty:receive <error> event <(<Status.INTERNAL: 13>, 'unknown filebox json object{type}: {"_metadata":{},"name":"ding-dong.png","boxType":5,"localPath":"ding-dong-icon.png"}', None)> 2020-06-16 14:22:13,145 - Wechaty - INFO - receive <error> event <(<Status.INTERNAL: 13>, 'unknown filebox json object{type}: {"_metadata":{},"name":"ding-dong.png","boxType":5,"localPath":"ding-dong-icon.png"}', None)>

@wj-Mcat wj-Mcat added the 🐛 bug Something isn't working label Jun 16, 2020
@wj-Mcat
Copy link
Collaborator

wj-Mcat commented Jun 16, 2020

Oh, yes, this interface is not work now. But there is a alternative solution:

with open('./avatar.jpg', 'rb') as f:
    content = base64.b64encode(f.read())
    file_box = FileBox.from_base64(name='avatar.jpg', base64=content)
    await conversation.say(file_box)

Thank you for reporting this issue. Please keep eye on this issue, we will create a pr according this issue to complete FileBox module.

@shiyu22
Copy link

shiyu22 commented Apr 26, 2023

Oh, yes, this interface is not work now. But there is a alternative solution:

with open('./avatar.jpg', 'rb') as f:
    content = base64.b64encode(f.read())
    file_box = FileBox.from_base64(name='avatar.jpg', base64=content)
    await conversation.say(file_box)

Thank you for reporting this issue. Please keep eye on this issue, we will create a pr according this issue to complete FileBox module.

Hi, it doesn't work for me, the error internal error <(<Status.UNIMPLEMENTED: 12>, '[object Object]', None)>.

Is there any other ideas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants