2021-04-18 10:36:30 +08:00
|
|
|
|
from zzcore import StdAns
|
|
|
|
|
import requests
|
2021-06-11 09:06:40 +08:00
|
|
|
|
|
|
|
|
|
|
2021-04-18 10:36:30 +08:00
|
|
|
|
class Ans(StdAns):
|
|
|
|
|
def GETMSG(self):
|
|
|
|
|
try:
|
2021-06-11 09:06:40 +08:00
|
|
|
|
picurl, status = Kemomimi()
|
2021-04-18 10:36:30 +08:00
|
|
|
|
except:
|
|
|
|
|
print()
|
|
|
|
|
msg = ''
|
2021-06-11 09:06:40 +08:00
|
|
|
|
if status == 200:
|
2021-04-18 10:36:30 +08:00
|
|
|
|
# 显示图标
|
|
|
|
|
# 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:
|
2021-06-11 09:06:40 +08:00
|
|
|
|
msg += '图库丢了哦,不是咱的问题呀!'
|
2021-04-18 10:36:30 +08:00
|
|
|
|
return msg
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def Kemomimi():
|
2021-06-11 09:06:40 +08:00
|
|
|
|
url = "http://api.aya1.xyz:6/random0.php"
|
2021-04-18 10:36:30 +08:00
|
|
|
|
# 获取重定向后的地址
|
2021-06-11 09:06:40 +08:00
|
|
|
|
imgurl = requests.get(url).url
|
2021-04-18 10:36:30 +08:00
|
|
|
|
status = requests.get(url).status_code
|
|
|
|
|
# print(imgurl)\
|
2021-06-11 09:06:40 +08:00
|
|
|
|
return imgurl, status
|