From aa78a59e5384d8d85debef0e40778cfd764b327c Mon Sep 17 00:00:00 2001 From: Youfou Date: Sat, 25 Mar 2017 20:15:04 +0800 Subject: [PATCH] update doc --- wxpy/api/messages/message.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/wxpy/api/messages/message.py b/wxpy/api/messages/message.py index 2544c4a..1d1c682 100644 --- a/wxpy/api/messages/message.py +++ b/wxpy/api/messages/message.py @@ -222,6 +222,28 @@ def forward(self, chat, prefix=None, suffix=None, raise_for_unsupported=False): :param str suffix: 转发时增加的 **后缀** 文本,原消息为文本时会自动换行 :param bool raise_for_unsupported: | 为 True 时,将为不支持的消息类型抛出 `NotImplementedError` 异常 + + 例如,将公司群中的老板消息转发出来:: + + from wxpy import * + + bot = Bot() + + # 定位公司群 + company_group = ensure_one(bot.groups().search('公司微信群')) + + # 定位老板 + boss = ensure_one(company_group.search('老板大名')) + + # 将老板的消息转发到文件传输助手 + @bot.register(company_group) + def forward_boss_message(msg): + if msg.member == boss: + msg.forward(bot.file_helper, prefix='老板发言') + + # 堵塞线程 + embed() + """ def wrapped_send(send_type, *args, **kwargs):