add some notes

Signed-off-by: mzivv <984084954@qq.com>
This commit is contained in:
mzivv
2022-11-07 17:30:10 +08:00
parent 57580b20e1
commit 9499621a60

View File

@@ -21,7 +21,7 @@ class Robot(Job):
self.config = Config()
self.LOG = logging.getLogger("Robot")
self.wxid = self.wcf.get_self_wxid()
#self.allContacts = self.getAllContacts()
self.allContacts = self.getAllContacts()
def toAt(self, msg: Wcf.WxMsg) -> bool:
"""
@@ -71,9 +71,9 @@ class Robot(Job):
"""当接收到消息的时候,会调用本方法。如果不实现本方法,则打印原始消息。
"""
""" 此处可进行自定义发送的内容,如通过关键字自动获取当前天气信息,并发送到对应的群组@发送者
""" 此处可进行自定义发送的内容,如通过 msg.content 关键字自动获取当前天气信息,并发送到对应的群组@发送者
群号msg.roomid 微信IDmsg.sender 消息内容msg.content
content = "天气查询"
content = "xx天气信息为"
receivers = msg.roomid
self.sendTextMsg(content, receivers, msg.sender)
"""
@@ -126,14 +126,8 @@ class Robot(Job):
if at_list:
wxids = at_list.split(",")
for wxid in wxids:
# 这里偷个懒,直接 @昵称
# 这里偷个懒,直接 @昵称。有必要的话可以通过 MicroMsg.db 里的 ChatRoom 表,解析群昵称
""" 若出现直接 @wxid则要通过 MicroMsg.db 里的 ChatRoom 表解析群昵称取消此处注释并注释141行
userInfo = self.getAllContacts()
everyUser = {'notify@all': '所有人'}
userInfo.update(everyUser) # 追加dict @所有人所需字段
ats = f" @{userInfo[wxid]}"
"""
ats = f" @{self.allContacts.get(wxid, '')}"
self.LOG.info(f"To {receiver}: {msg}{ats}")