用python实现的一个自动聊天的机器人

时间:2023-03-09 14:39:27
用python实现的一个自动聊天的机器人

因为之前想过 如果每天早上微信能够发送天气预报给我,给我老婆多好,然后就动手看网上的教程做了一个可以定时发送天气预报的程序,

最近又想到折腾,做了一个更加详细的版本。但是需要主动操作

具体操作看图。

用python实现的一个自动聊天的机器人

用python实现的一个自动聊天的机器人

用python实现的一个自动聊天的机器人

部分代码:

#coding=utf8
import requests
from requests import exceptions
from urllib.request import urlopen
from bs4 import BeautifulSoup
from urllib.parse import urlencode
from threading import Timer
import re
from wxpy import *
import schedule
import time
import http
import json
import datetime
import random bot = Bot(cache_path=True,console_qr = 1)
myself = bot.self
bot.enable_puid('wxpy_puid.pkl')
tuling = Tuling(api_key='换成自己的图片key')
group = bot.groups().search(u'Test')
shgroup = bot.groups().search('伐木累