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

[Bug]: 媒体内容无法接收保存,图片文件等内容也无法发送,只能文字消息可以接收,回复 #391

Open
yangningmoojing opened this issue Apr 14, 2023 · 1 comment

Comments

@yangningmoojing
Copy link

Environment

- wechaty:0.10.7
- wechaty-puppet: 0.4.23
- wechaty-puppet-service: 0.8.10
- wechaty-plugin-contrib: 0.0.25
- token type: xp
- the version of wechaty docker container: [0.65]

Description

2023-04-14 11:56:02,777 - Contact - INFO - load contact <Contact <1688856025449105> <🎉🎉🎉>>
2023-04-14 11:56:17,647 - Wechaty - INFO - receive <ready> event <EventReadyPayload(data='data ready')>
2023-04-14 11:57:58,723 - Contact - INFO - load contact <Contact <7881300811905286> <.>>
2023-04-14 11:57:58,723 - Wechaty - INFO - receive message <Message#message_type_text[🗣 Contact <7881300811905286> <.>	叮>
2023-04-14 11:57:58,724 - Message - INFO - say() <咚>
2023-04-14 11:57:59,330 - Wechaty - ERROR - internal error <>
2023-04-14 11:58:20,735 - Wechaty - INFO - receive message <Message#message_type_text[🗣 Contact <7881300811905286> <.>	媒体>
2023-04-14 11:58:20,736 - FileBox - INFO - init file-box<<class 'wechaty_puppet.file_box.type.FileBoxOptionsUrl'>, bot-qr-code.png>
2023-04-14 11:58:20,741 - FileBox - WARNING - mimeType will be deprecated after Dec, 2022, we suggest that you should use mediaType property
2023-04-14 11:58:20,741 - FileBox - INFO - init file-box<<class 'wechaty_puppet.file_box.type.FileBoxOptionsBase64'>, 消息.py>
2023-04-14 11:58:20,741 - FileBox - WARNING - mimeType will be deprecated after Dec, 2022, we suggest that you should use mediaType property
2023-04-14 11:58:20,741 - Message - INFO - say() <<wechaty_puppet.file_box.file_box.FileBox object at 0x10747c0a0>>
2023-04-14 11:58:20,742 - FileBox - WARNING - mimeType will be deprecated after Dec, 2022, we suggest that you should use mediaType property
2023-04-14 11:58:20,742 - FileBox - WARNING - mimeType will be deprecated after Dec, 2022, we suggest that you should use mediaType property
2023-04-14 11:58:21,018 - Wechaty - ERROR - internal error <>

Minimum reproducible code

import asyncio
from wechaty import Wechaty, Message
from wechaty import Wechaty, Contact, FileBox, UrlLink
import os

填入的还是你前面申请的token

os.environ["WECHATY_PUPPET_SERVICE_TOKEN"] = "puppet_workpro_*****"

docker运行的主机地址+端口

os.environ["WECHATY_PUPPET_SERVICE_ENDPOINT"] = "127.0.0.1:8080"

class MyBot(Wechaty):

async def on_message(self, msg: Message) -> None:
    text = msg.text()

    # 1. 发送文字到联系人
    if text == "叮":
        await msg.say('咚')
        return

    # 2. 发送媒体文件到联系人
    if text == "媒体":
        file_box1 = FileBox.from_url('https://wechaty.github.io/wechaty/images/bot-qr-code.png', "bot-qr-code.png")
        file_box2 = FileBox.from_file('消息.py', "消息.py")
        await msg.say(file_box1)
        await msg.say(file_box2)
        return

    # 3. 发送名片到联系人
    if text == "名片":
        contact_card = self.Contact.load('马伟伟')  # 把`lijiarui`更改为您在微信中的任意联系人的姓名
        await msg.say(contact_card)
        return

    # 4. 发送链接到联系人
    if text == "链接":
        url_link = UrlLink.create(
            description='WeChat Bot SDK for Individual Account, Powered by TypeScript, Docker, and Love',
            thumbnail_url='https://avatars0.githubusercontent.com/u/25162437?s=200&v=4',
            title='Welcome to Wechaty',
            url='https://github.com/wechaty/wechaty',
        )
        await msg.say(url_link)
        return

    # 5. 发送小程序 (暂时只有`wechaty-puppet-macpro`支持该服务)

    if text == "小程序":
        miniProgram = self.MiniProgram.create_from_json({
            "appid": 'gh_0aa444a25adc',
            "title": '我正在使用Authing认证身份,你也来试试吧',
            "pagePath": 'routes/explore.html',
            "description": '身份管家',
            "thumbUrl": '30590201000452305002010002041092541302033d0af802040b30feb602045df0c2c5042b777875706c6f61645f31373533353339353230344063686174726f6f6d3131355f313537363035393538390204010400030201000400',
            "thumbKey": '42f8609e62817ae45cf7d8fefb532e83',
        })
        await msg.say(miniProgram)
        return

asyncio.run(MyBot().start())

@ashen001
Copy link

ashen001 commented Jul 1, 2023

请问解决了吗?我今天突然也是这样。文字信息可以保存。图片,媒体信息无法保存到本地了。

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