Skip to content

Wechaty - ERROR - internal error <> #88

Open

Description

@yangningmoojing

这个 wechaty 只能接收文字消息和发送文字消息, 图片,文件,这两个接收能读到类型,但是保存不了,发送也不行,都是报 - Wechaty - ERROR - internal error <>
这个还能用吗?是不是不支持python 了

Activity

  1. yangningmoojing commented on Apr 13, 2023

    @yangningmoojing
    Author

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

    class MyBot(Wechaty):

    async def on_message(self, msg: Message):
    
        if msg.type() == Message.Type.MESSAGE_TYPE_TEXT:
            text = msg.text()
            print("收到文本消息:", text)
        elif msg.type() == Message.Type.MESSAGE_TYPE_IMAGE:
            # 发送图片消息
            print('16hang',msg.to_file_box)
            file_box = await msg.to_file_box()
            await file_box.to_file('image.jpg', overwrite=True)
            # file_box = await msg.to_file_box()
    
    
            # print('12hang接收图片消息', file_box)
            # await file_box.to_file(file_box.name)
    
            # await msg.say(file_box)
        elif msg.type() == Message.Type.MESSAGE_TYPE_ATTACHMENT:
            # 转发文件消息
            file_box = await msg.to_file_box()
            contact = await self.Contact.find('7881300811905286')
            await contact.say(file_box)
            # file_box = await msg.to_file_box()
            # print('17hang发送文件消息',file_box)
            # await msg.say(file_box)
    

    async def main():
    bot = MyBot()
    await bot.start()

    if name == 'main':
    try:
    # 填入的还是你前面申请的token
    os.environ["WECHATY_PUPPET_SERVICE_TOKEN"] = "puppet_workpro_***"
    # docker运行的主机地址+端口
    os.environ["WECHATY_PUPPET_SERVICE_ENDPOINT"] = "127.0.0.1:8080"
    asyncio.run(main())
    except Exception as e:
    print(e)

  2. shengzhou1216 commented on May 10, 2023

    @shengzhou1216

    可以重新扫码试试。手机扫码,如果手机上提示“Windows已登录”或“iPad已登录”,那么应该就可以了。

  3. Pengchengistaken commented on Oct 22, 2023

    @Pengchengistaken

    +1,mark

  4. lizihao001 commented on Mar 12, 2024

    @lizihao001

    @yangningmoojing 问题解决了嘛 我遇到相似error,文件可以识别出来,但是不能保存到本地

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions