add some notes

Signed-off-by: mzivv <984084954@qq.com>
This commit is contained in:
mzivv
2022-11-07 17:13:54 +08:00
parent f2c70acd9c
commit 57580b20e1
2 changed files with 14 additions and 18 deletions

View File

@@ -39,15 +39,12 @@ def main():
# 接收消息
robot.enableRecvMsg()
# 每天7点发送天气预报
robot.onEveryTime("22:30", weather_report, robot=robot)
robot.onEveryTime("00:30", weather_report, robot=robot)
# 让机器人一直跑
robot.keepRunningAndBlockProcess()
if __name__ == "__main__":
main()

View File

@@ -12,7 +12,6 @@ from func_chengyu import cy
from job_mgmt import Job
class Robot(Job):
"""个性化自己的机器人
"""
@@ -24,7 +23,6 @@ class Robot(Job):
self.wxid = self.wcf.get_self_wxid()
#self.allContacts = self.getAllContacts()
def toAt(self, msg: Wcf.WxMsg) -> bool:
"""
处理被 @ 消息,现在只固定回复: "你@我干嘛?"
@@ -80,7 +78,6 @@ class Robot(Job):
self.sendTextMsg(content, receivers, msg.sender)
"""
# 群聊消息
if msg.from_group():
# 如果在群里被 @,回复发信人:“收到你的消息了!” 并 @他
@@ -147,8 +144,10 @@ class Robot(Job):
获取联系人(包括好友、公众号、服务号、群成员……)
格式: {"wxid": "NickName"}
"""
contacts = self.wcf.query_sql("MicroMsg.db", "SELECT UserName, NickName FROM Contact;")
return {contact["UserName"]: contact["NickName"] for contact in contacts}
contacts = self.wcf.query_sql(
"MicroMsg.db", "SELECT UserName, NickName FROM Contact;")
return {contact["UserName"]: contact["NickName"]
for contact in contacts}
def keepRunningAndBlockProcess(self) -> None:
"""