mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 14:22:55 +08:00
Update data_source.py
This commit is contained in:
parent
54928478a3
commit
1be9305755
@ -32,54 +32,58 @@ async def get_qqbot_chat_result(text: str, img_url: str, user_id: int, user_name
|
|||||||
for key in keys:
|
for key in keys:
|
||||||
if text.find(key) != -1:
|
if text.find(key) != -1:
|
||||||
return random.choice(anime_data[key]).replace('你', user_name)
|
return random.choice(anime_data[key]).replace('你', user_name)
|
||||||
if text:
|
try:
|
||||||
req = {
|
if text:
|
||||||
"perception":
|
req = {
|
||||||
{
|
"perception":
|
||||||
"inputText":
|
{
|
||||||
{
|
"inputText":
|
||||||
"text": text
|
{
|
||||||
},
|
"text": text
|
||||||
"selfInfo":
|
},
|
||||||
{
|
"selfInfo":
|
||||||
"location":
|
{
|
||||||
{
|
"location":
|
||||||
"city": "陨石坑",
|
{
|
||||||
"province": "火星",
|
"city": "陨石坑",
|
||||||
"street": "第5坑位"
|
"province": "火星",
|
||||||
}
|
"street": "第5坑位"
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
"userInfo":
|
|
||||||
{
|
|
||||||
"apiKey": TL_KEY[index],
|
|
||||||
"userId": str(user_id)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
elif img_url:
|
|
||||||
req = {
|
|
||||||
"reqType": 1,
|
|
||||||
"perception":
|
|
||||||
{
|
|
||||||
"inputImage": {
|
|
||||||
"url": img_url
|
|
||||||
},
|
},
|
||||||
"selfInfo":
|
"userInfo":
|
||||||
{
|
{
|
||||||
"location":
|
"apiKey": TL_KEY[index],
|
||||||
{
|
"userId": str(user_id)
|
||||||
"city": "陨石坑",
|
}
|
||||||
"province": "火星",
|
}
|
||||||
"street": "第5坑位"
|
elif img_url:
|
||||||
}
|
req = {
|
||||||
}
|
"reqType": 1,
|
||||||
},
|
"perception":
|
||||||
"userInfo":
|
{
|
||||||
{
|
"inputImage": {
|
||||||
"apiKey": TL_KEY[index],
|
"url": img_url
|
||||||
"userId": str(user_id)
|
},
|
||||||
}
|
"selfInfo":
|
||||||
}
|
{
|
||||||
|
"location":
|
||||||
|
{
|
||||||
|
"city": "陨石坑",
|
||||||
|
"province": "火星",
|
||||||
|
"street": "第5坑位"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"userInfo":
|
||||||
|
{
|
||||||
|
"apiKey": TL_KEY[index],
|
||||||
|
"userId": str(user_id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
except IndexError:
|
||||||
|
index = 0
|
||||||
|
return no_result()
|
||||||
async with aiohttp.ClientSession() as sess:
|
async with aiohttp.ClientSession() as sess:
|
||||||
async with sess.post(url, json=req) as response:
|
async with sess.post(url, json=req) as response:
|
||||||
if response.status != 200:
|
if response.status != 200:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user