python 操作微信定时发信息

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jul  6 11:52:20 2020

@author: lg
"""

# 导入模块
from wxpy import Bot
import datetime
import pandas as pd
# 初始化机器人,扫码登陆
import time

bot = Bot()

# 搜索名称含有 "游否" 的男性深圳好友
tt = bot.friends().search('海婷')[0]

cc =  bot.friends().search('鸿雁于飞')[0]

group= bot.groups().search('家庭重大议题--反稀缺')[0]




while 1:
    stamp0=datetime.datetime.now()
#    stamp1=stamp0.strftime("%Y-%m-%d %H:%M:%S")
    stamp1=stamp0.strftime("%Y-%m-%d %H:%M")
    stamp2=stamp1.split()
    
    if stamp2[1]=='19:30':
    #stamp2=pd.DataFrame([[stamp1]],columns=['stamp'])
    
        tt.send('儿子的晚饭吃完了吗')
        time.sleep(1)
        cc.send('儿子你的晚饭吃了吗')
        
        time.sleep(1)
        group.send('儿子的晚饭吃了吗')
        time.sleep(100)
        
    elif stamp2[1]=='20:00':
    
        tt.send('让大儿子洗澡')
        time.sleep(100)
        cc.send('宝贝儿子你应该洗澡了')
        
        time.sleep(1)
        group.send('罗金城开始洗澡了')
        time.sleep(100)
    elif stamp2[1]=='20:30':
    
        
        tt.send('儿子应该上床了')
        time.sleep(1)
        cc.send('宝贝儿子该上床了')
        
        time.sleep(1)
        group.send('罗金城上床了')
        time.sleep(100)
        
    elif stamp2[1]=='21:00':
    
        tt.send('睡觉')
        time.sleep(1)
        cc.send('睡觉')
        
        time.sleep(1)
        group.send('睡觉')
        time.sleep(100)
    elif stamp2[1]=='14:00':
    

        group.send('老婆大人,明天的早餐吃点什么好啊@海婷')
        time.sleep(100)
        
    time.sleep(10)
    
    

你可能感兴趣的:(PYTHON)