13
main.py
13
main.py
@@ -16,15 +16,15 @@ def weather_report(robot: Robot) -> None:
|
||||
|
||||
# 获取天气,需要自己实现,可以参考 https://gitee.com/lch0821/WeatherScrapy 获取天气。
|
||||
report = "这就是获取到的天气情况了"
|
||||
|
||||
|
||||
for r in receivers:
|
||||
robot.sendTextMsg(report, r)
|
||||
#robot.sendTextMsg(report, r, "nofity@all") # 发送消息并@所有人
|
||||
# robot.sendTextMsg(report, r, "nofity@all") # 发送消息并@所有人
|
||||
|
||||
|
||||
def main():
|
||||
wcf = Wcf()
|
||||
|
||||
|
||||
def handler(sig, frame):
|
||||
wcf.cleanup() # 退出前清理环境
|
||||
exit(0)
|
||||
@@ -35,18 +35,15 @@ def main():
|
||||
robot.LOG.info("正在启动机器人···")
|
||||
# 机器人启动发送测试消息
|
||||
robot.sendTextMsg("机器人启动成功!", "filehelper")
|
||||
|
||||
|
||||
# 接收消息
|
||||
robot.enableRecvMsg()
|
||||
|
||||
|
||||
# 每天7点发送天气预报
|
||||
robot.onEveryTime("22:30", weather_report, robot=robot)
|
||||
robot.onEveryTime("00:30", weather_report, robot=robot)
|
||||
|
||||
# 让机器人一直跑
|
||||
robot.keepRunningAndBlockProcess()
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user