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)
    
    
posted @   luoganttcc  阅读(5)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!
· 周边上新:园子的第一款马克杯温暖上架
点击右上角即可分享
微信分享提示