XZZ/worker/k.py
2021-04-18 10:36:30 +08:00

38 lines
1.4 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from zzcore import StdAns
import requests
class Ans(StdAns):
def GETMSG(self):
try:
picurl,status=Kemomimi()
except:
print()
msg = ''
if status==200:
# 显示图标
# msg += f'[CQ:xml,data=<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' \
# f'<msg serviceID="1">' \
# f'<item><title>来喽!!</title></item>' \
# f'<source name="K!" icon="{picurl}" action="web" appid="-1" />' \
# f'</msg>' \
# f']'
msg = f'[CQ:xml,data=<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n' \
f'<msg serviceID="1"\n' \
f'action="web" url="\n' \
f'https://brx86.gitee.io/kemomimi/202.jpg">\n' \
f'<item><title>ケモミミちゃん:</title><summary>Kemomimi酱来了</summary><picture cover="https://brx86.gitee.io/kemomimi/202.jpg"/></item>\n' \
f'</msg> ' \
f']'
# 显示卡片图片
# msg += f'[CQ:cardimage,file={picurl},maxheight=200]'
else:
msg+='图库丢了哦,不是咱的问题呀!'
return msg
def Kemomimi():
url="http://api.aya1.xyz:6/random.php"
# 获取重定向后的地址
imgurl=requests.get(url).url
status = requests.get(url).status_code
# print(imgurl)\
return imgurl,status