当前位置: 移动技术网 > IT编程>脚本编程>Python > Python之微信-微信群发

Python之微信-微信群发

2019年05月08日  | 移动技术网IT编程  | 我要评论

广东信宜新闻,清炖鱼的做法,乌尼思

python之微信-微信群发

#!/usr/bin/env python
# -*- coding:utf-8 -*-
import json
import requests
from wxpy import *

# bot = bot(cache_path=true)
bot = bot()


# 调用图灵机器人api,发送消息并获得机器人的回复
def auto_reply(text):
    url = "http://www.tuling123.com/openapi/api"
    # 0f6b8d0107ee43039aa1941dc94729de
    # 9df516a74fc443769b233b01e8536a42
    api_key = "0f6b8d0107ee43039aa1941dc94729de"
    payload = {
        "key": api_key,
        "info": text,
    }
    r = requests.post(url, data=json.dumps(payload))
    result = json.loads(r.content)  # 获取对方给你发送的消息
    if result == '你好':
        return "我不好"
    if result == "老公" or result == '老婆':
        return "ta睡着了,我爱死你了"
    if result == "我要剁手":
        return "那你把脚也剁了把"
    return "老婆大人,你好,我在打游戏,要打扰我"  # 回复好友消息


@bot.register()
def send_message(msg):
    return auto_reply(msg.text)


embed()

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网