Skip to content

不适配最新(2.2.2)urllib3库且降级(1.26.8)后会出现报错 #428

Open
@kvx07

Description

@kvx07

Environment

- wechaty:
- wechaty-puppet: 
- wechaty-puppet-service: 
- wechaty-plugin-contrib: 
- token type: padlocal|wxwork|xp
- the version of wechaty docker container: [0.65]

Description

ValueError: mutable default <class 'wechaty_puppet.schemas.puppet.PuppetOptions'> for field puppet_options is not allowed: use default_factory

Minimum reproducible code

from wechaty import Wechaty, Contact
from wechaty.user import Message, Room

class MyBot(Wechaty):

async def on_message(self, msg: Message):
    """
    监听消息事件
    """
    if msg.self() or msg.type() != Message.Type.MESSAGE_TYPE_TEXT:
        # 如果是自己发的消息或者不是文本消息,则不处理
        return

    # 获取消息文本
    text = msg.text()

    # 判断是否是群聊消息
    room = msg.room()
    if room:
        # 检查是否被@了
        if msg.mention_self():
            await msg.say('你好,我是测试机器人')
    else:
        # 私聊消息直接回复
        await msg.say('你好,我是测试机器人')

async def main():
# 初始化机器人
bot = MyBot()
# 启动机器人
await bot.start()

import asyncio

if name == 'main':
asyncio.run(main())

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