用Python语言写一段代码,让手机自动回复微信信息。写3份不一样
时间: 2024-06-10 11:07:09 浏览: 189
使用python实现微信自动回复
3星 · 编辑精心推荐
的代码。
代码1:
import itchat
@itchat.msg_register(itchat.content.TEXT)
def reply_msg(msg):
itchat.send('自动回复:我现在有事不在,一会儿再和您联系。', msg['FromUserName'])
itchat.auto_login(hotReload=True)
itchat.run()
代码2:
from wxpy import *
bot = Bot()
@bot.register()
def auto_reply(msg):
return '自动回复:我现在有事不在,一会儿再和您联系。'
embed()
代码3:
import time
from selenium import webdriver
driver = webdriver.Chrome()
driver.get('https://wx.qq.com/')
time.sleep(8)
driver.find_element_by_id('login_anchor').click()
time.sleep(8)
while True:
driver.execute_script("window.scrollTo(0,document.body.scrollHeight);")
time.sleep(4)
msgs = driver.find_elements_by_xpath('//div[@class="message simple"]//div[@class="bubble_cont"]/div[@class="js_message_plain"]')
if msgs:
msg = msgs[-1]
input_box = driver.find_element_by_xpath('//div[@class="chat_bd"]//div[@class="editable"]').\
send_keys('自动回复:我现在有事不在,一会儿再和您联系。')
time.sleep(2)
input_box.send_keys(Keys.RETURN)
time.sleep(10)
driver.quit()
阅读全文