30行python代码实现微信自动陪女盆友聊天(itchat-uos + 无限制调用)

先放代码:

30行python代码实现微信自动陪女盆友聊天(itchat-uos + 无限制调用)_第1张图片

 再放个文字的(方便复制):

import itchat
import requests

def get_reply(keyword):
    try:
        url = f"https://open.drea.cc/bbsapi/chat/get?keyWord={keyword}&userName=type%3Dbbs"
        res = requests.get(url)
        data = res.json()
        return data['data']['reply']
    except:
        return "opps, 我还很笨,不造你在说啥"

@itchat.msg_register(itchat.content.TEXT, isFriendChat=True)
def auto_reply(msg):
    reply = "execuse me?"
    try:
        reply = get_reply(msg.text)
    except:
        pass
    finally:
        print(f'[In] {msg.text} \t [Out] {reply}')
        return reply


itchat.auto_login(hotReload=True)
itchat.run() 

你可能感兴趣的:(微信,python,开发语言,学习,程序人生)