import time
from wxauto import WeChat
import os
while True:
time_now = time.strftime("%H:%M:%S", time.localtime())
sent_time = '设定时间'
if time_now == sent_time:
who = "群名"
t_delay1 = 2
t_delay2 = 3
chat_message = "文字内容"
chat_file_path = "文件绝对路径"
time.sleep(t_delay1)
wx = WeChat()
wx.GetSessionList()
wx.ChatWith(who)
time.sleep(t_delay2)
wx.SendMsg(chat_message)
wx.SendFiles(chat_file_path)
os.system("shutdown -s") #关机
exit(0)
使用时微信需要显示在屏幕上