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

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

Open
kvx07 opened this issue Aug 6, 2024 · 1 comment

Comments

@kvx07
Copy link

kvx07 commented Aug 6, 2024

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())

@doublewinter0
Copy link
Contributor

完善一下环境所使用库的版本信息,方便问题排查。

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