老婆酱(聊天机器人),来自大神编写的一个Python代码,代号“老婆酱”,会称呼你为老公,并且还会以甜蜜的语气向你问好,可以根据需求给她更换不同的头像,小编试了下,还挺萌的,推荐给大家使用。
AI智能回复助手
有求必应,有问必答
每天必有的早安和晨报功能
Python代码,需要专业编译器编译后安装到QQ上使用
# -*- coding: utf-8 -*-
import requests
def post_data(data):
qmsg_url = 'https://qmsg.zendee.cn/send/key' #填你的key
res = requests.post(qmsg_url, data=data).json()
print(res['reason'])
def morning():
url = 'http://api.tianapi.com/txapi/zaoan/index?key=a161e1569f43507da7fe5396f6956fe1'
res = requests.get(url).json()
content = res['newslist'][0]['content']
data = {
'msg': "早上好呀,老公大人@face=2@@face=49@@face=109@\n%s@face=175@" % content
}
post_data(data)
def weather(code):
url = 'http://t.weather.itboy.net/api/weather/city/%d' % code
res = requests.get(url, headers=headers).json()
city = res['cityInfo']['city'] # 地区
forecast = res['data']['forecast'] # 具体天气
quality = res['data']['quality']
pm25 = res['data']['pm25']
pm10 = res['data']['pm10']
ganmao = res['data']['ganmao'] # ganmao: "各类人群可自由活动"
shidu = res['data']['shidu']
wendu = res['data']['wendu'] + '℃'
for lmaki_data, lmaki in zip(forecast, ['今天', '明天']):
ymd = lmaki_data['ymd'] # 时间
week = lmaki_data['week'] # 星期几
sunrise = lmaki_data['sunrise'] # 日出
sunset = lmaki_data['sunset'] # 日落
high = lmaki_data['high'] # 最高温
low = lmaki_data['low'] # 最低温
fx = lmaki_data['fx'] # 风向
fl = lmaki_data['fl'] # 几级风
type_we = lmaki_data['type'] # 天气
notice = lmaki_data['notice'] # 提示语
total = f'@face=6@{lmaki}是{week},天气是 {type_we} 哦,温度为{wendu},湿度为{shidu}\npm2.5的值为{pm25},pm1.0的值是{pm10},{ganmao}\n{high},{low},{notice},吹的是{fx},风速达到了{fl}了。\n太阳将在 {sunrise} 升起,{sunset} 落下\n天气质量为 {quality}@face=13@ {ymd} {city}'
data = {
'msg': total
}
post_data(data)
def main():
morning()
weather(101210805) #城市代码
if __name__ == '__main__':
headers = {
'User - Agent': 'Mozilla / 5.0(Windows NT 10.0;WOW64) AppleWebKit / 537.36(KHTML, likeGecko) Chrome / 86.0.4240.198Safari / 537.36'
}
main()
……
老婆酱-聊天机器人-老婆酱下载 vPython版 >>本地高速下载
>>本地下载