python-wechaty
python-wechaty copied to clipboard
如何获得一个可用的Wechaty对象
Describe the desired 你好,我读了example里面的代码发现机器人都是继承Wechaty基类来通过自定义回调函数来实现各种功能。利用回调函数这样是很被动的,我想得到一个可直接调用的Wechaty对象,不通过start()进入循环监听, 而可以主动的发送信息,请问应该怎么实现? 需求伪代码:
bot = Wechaty()
room = await bot.Room.find({"topic":"xxxx"})
await room.say("hello")
期待得到您的帮助!
I think this is a simple question. You only just set the bot as the global accessible variable to say something to room/contact. But you should say something after on_ready event.
I hope it can help you to fix your problem.